POK(kernelpart)
|
00001 /* 00002 * POK header 00003 * 00004 * The following file is a part of the POK project. Any modification should 00005 * made according to the POK licence. You CANNOT use this file or a part of 00006 * this file is this part of a file for your own project 00007 * 00008 * For more information on the POK licence, please see our LICENCE FILE 00009 * 00010 * Please follow the coding guidelines described in doc/CODING_GUIDELINES 00011 * 00012 * Copyright (c) 2007-2009 POK team 00013 * 00014 * Created by julien on Thu Jan 15 23:34:13 2009 00015 */ 00016 00022 #include <types.h> 00023 #include <errno.h> 00024 #include <core/partition.h> 00025 #include "traps.h" 00026 #include "space.h" 00027 #include "psr.h" 00028 #include "sparc_conf.h" 00029 #include "syscalls.h" 00030 00034 pok_ret_t pok_arch_init () 00035 { 00036 traps_init(); 00037 psr_disable_interupt(); 00038 psr_enable_traps(); 00039 00040 pok_arch_space_init(); 00041 pok_syscalls_init(); 00042 00043 return (POK_ERRNO_OK); 00044 } 00045 00046 pok_ret_t pok_arch_preempt_disable() 00047 { 00048 psr_disable_interupt(); 00049 00050 return (POK_ERRNO_OK); 00051 } 00052 00053 pok_ret_t pok_arch_preempt_enable() 00054 { 00055 psr_enable_interupt(); 00056 00057 return (POK_ERRNO_OK); 00058 } 00059 00060 pok_ret_t pok_arch_idle() 00061 { 00062 while (1) 00063 { 00064 /* Leon3 Only ? */ 00065 asm volatile ("wr %g0, %asr19"); 00066 } 00067 00068 return (POK_ERRNO_OK); 00069 } 00070 00075 pok_ret_t pok_arch_event_register (uint8_t vector, void (*handler)(void)) 00076 { 00077 if (pok_sparc_isr[vector] == NULL) 00078 { 00079 pok_sparc_isr[vector] = handler; 00080 return (POK_ERRNO_OK); 00081 } 00082 else 00083 { 00084 return (POK_ERRNO_UNAVAILABLE); 00085 } 00086 } 00087 00091 uint32_t pok_thread_stack_addr (const uint8_t partition_id, 00092 const uint32_t local_thread_id) 00093 { 00094 return pok_partitions[partition_id].size - (local_thread_id * POK_USER_STACK_SIZE); 00095 } 00096 00097