POK(kernelpart)
/home/jaouen/pok_official/pok/trunk/kernel/arch/sparc/arch.c File Reference
#include <types.h>
#include <errno.h>
#include <core/partition.h>
#include "traps.h"
#include "space.h"
#include "psr.h"
#include "sparc_conf.h"
#include "syscalls.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

Author:
Fabien Chouteau

Definition in file arch.c.


Function Documentation

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

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

See also:
pok_sparc_isr

Definition at line 75 of file arch.c.

{
  if (pok_sparc_isr[vector] == NULL)
  {
    pok_sparc_isr[vector] = handler;
    return (POK_ERRNO_OK);
  }
  else
  {
    return (POK_ERRNO_UNAVAILABLE);
  }
}

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

Definition at line 60 of file arch.c.

{
  while (1)
  {
    /* Leon3 Only ? */
    asm volatile ("wr %g0, %asr19");
  }

   return (POK_ERRNO_OK);
}

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

Definition at line 34 of file arch.c.

{
  traps_init();
  psr_disable_interupt();
  psr_enable_traps();

  pok_arch_space_init();
  pok_syscalls_init();

  return (POK_ERRNO_OK);
}

Disable interruptions

Definition at line 46 of file arch.c.

{
  psr_disable_interupt();

  return (POK_ERRNO_OK);
}

Enable interruptions

Definition at line 53 of file arch.c.

{
  psr_enable_interupt();

  return (POK_ERRNO_OK);
}
uint32_t pok_thread_stack_addr ( const uint8_t  partition_id,
const uint32_t  local_thread_id 
)

Compute the stack adress for the given thread.

Definition at line 91 of file arch.c.

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