POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/arch/x86/arch.c File Reference

Provides generic architecture interface for x86 architecture. More...

#include <errno.h>
#include <core/partition.h>
#include "event.h"
#include "gdt.h"

Go to the source code of this file.

Functions

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

Provides generic architecture interface for x86 architecture.

Author:
Julian Pidancet
Julien Delange

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)

Attach the handler to the given trap number (vector).

See also:
pok_sparc_isr

Definition at line 60 of file arch.c.

{
   pok_idt_set_gate (vector,
                     GDT_CORE_CODE_SEGMENT << 3,
                     (uint32_t)handler,
                     IDTE_TRAP,
                     3);

   return (POK_ERRNO_OK);
}

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

Definition at line 50 of file arch.c.

{
   while (1)
   {
      asm ("hlt");
   }

   return (POK_ERRNO_OK);       
}

Function that initializes architecture concerns.

Initialize all SPARC managers (traps, syscalls, space).

Definition at line 30 of file arch.c.

Disable interruptions

Definition at line 38 of file arch.c.

{
  asm ("cli");
  return (POK_ERRNO_OK);
}

Enable interruptions

Definition at line 44 of file arch.c.

{
  asm ("sti");
  return (POK_ERRNO_OK);
}
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.

Compute the stack adress for the given thread.

Definition at line 72 of file arch.c.

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