POK(kernelpart)
arch.c
Go to the documentation of this file.
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
24 #include <types.h>
25 #include <errno.h>
26 #include <core/partition.h>
27 #include "msr.h"
28 
29 extern void pok_arch_space_init (void);
30 
31 static inline unsigned int get_msr (void)
32 {
33  unsigned int res;
34  asm ("mfmsr %0\n" : "=r" (res));
35  return res;
36 }
37 
38 static inline void set_msr (unsigned int val)
39 {
40  asm volatile ("mtmsr %0\n" : : "r" (val));
41 }
42 
44 {
45  set_msr (MSR_IP);
46 #if POK_NEEDS_PARTITIONS
48 #endif
49 
50  return (POK_ERRNO_OK);
51 }
52 
54 {
55  unsigned int msr;
56 
57  msr = get_msr();
58  msr &= ~MSR_EE;
59  set_msr(msr);
60  return (POK_ERRNO_OK);
61 }
62 
64 {
65  unsigned int msr;
66 
67  msr = get_msr();
68  msr |= MSR_EE;
69  set_msr(msr);
70 
71  return (POK_ERRNO_OK);
72 }
73 
75 {
76  while (1)
77  {
78  }
79 
80  return (POK_ERRNO_OK);
81 }
82 
83 pok_ret_t pok_arch_event_register (uint8_t vector, void (*handler)(void))
84 {
85  (void) vector;
86  (void) handler;
87 
88  return (POK_ERRNO_OK);
89 }
90 
91 
93  const uint32_t local_thread_id)
94 {
95  return pok_partitions[partition_id].size - 16 - (local_thread_id * POK_USER_STACK_SIZE);
96 }
97 
98