POK(kernelpart)
arch.c File Reference

Provide generic architecture access for PPC architecture. More...

#include <types.h>
#include <errno.h>
#include <core/partition.h>
#include "msr.h"

Go to the source code of this file.

Functions

void pok_arch_space_init (void)
pok_ret_t pok_arch_init ()
pok_ret_t pok_arch_preempt_disable ()
pok_ret_t pok_arch_preempt_enable ()
pok_ret_t pok_arch_idle ()
pok_ret_t pok_arch_event_register (uint8_t vector, void(*handler)(void))
uint32_t pok_thread_stack_addr (const uint8_t partition_id, const uint32_t local_thread_id)

Detailed Description

Provide generic architecture access for PPC architecture.

Author:
Tristan Gingold
Date:
2009

Definition in file arch.c.


Function Documentation

pok_ret_t pok_arch_event_register ( uint8_t  vector,
void(*)(void)  handler 
)

Register an event (for example, an interruption)

Definition at line 83 of file arch.c.

{
(void) vector;
(void) handler;
return (POK_ERRNO_OK);
}
pok_ret_t pok_arch_idle ( )

Function that do nothing. Useful for the idle task for example.

Definition at line 74 of file arch.c.

{
while (1)
{
}
return (POK_ERRNO_OK);
}
pok_ret_t pok_arch_init ( )

Function that initializes architecture concerns.

Definition at line 43 of file arch.c.

{
set_msr (MSR_IP);
#if POK_NEEDS_PARTITIONS
#endif
return (POK_ERRNO_OK);
}
pok_ret_t pok_arch_preempt_disable ( )

Disable interruptions

Definition at line 53 of file arch.c.

{
unsigned int msr;
msr = get_msr();
msr &= ~MSR_EE;
set_msr(msr);
return (POK_ERRNO_OK);
}
pok_ret_t pok_arch_preempt_enable ( )

Enable interruptions

Definition at line 63 of file arch.c.

{
unsigned int msr;
msr = get_msr();
msr |= MSR_EE;
set_msr(msr);
return (POK_ERRNO_OK);
}
void pok_arch_space_init ( void  )

Initilize MMU tables.

Definition at line 132 of file space.c.

{
uint32_t sdr1;
pt_base = 0;
pt_mask = 0x3ff;
sdr1 = pt_base | (pt_mask >> 10);
asm volatile ("mtsdr1 %0" : : "r"(sdr1));
}
uint32_t pok_thread_stack_addr ( const uint8_t  partition_id,
const uint32_t  local_thread_id 
)

Returns the stack address for a the thread number N in a partition.

  • partition_id indicates the partition that contains the thread.
  • local_thread_id the thread-id of the thread inside the partition.
Returns:
the stack address of the thread.

Definition at line 92 of file arch.c.

{
return pok_partitions[partition_id].size - 16 - (local_thread_id * POK_USER_STACK_SIZE);
}