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 <errno.h>
25 #include <core/partition.h>
26 
27 #include "event.h"
28 #include "gdt.h"
29 
31 {
32  pok_gdt_init ();
33  pok_event_init ();
34 
35  return (POK_ERRNO_OK);
36 }
37 
39 {
40  asm ("cli");
41  return (POK_ERRNO_OK);
42 }
43 
45 {
46  asm ("sti");
47  return (POK_ERRNO_OK);
48 }
49 
51 {
52  while (1)
53  {
54  asm ("hlt");
55  }
56 
57  return (POK_ERRNO_OK);
58 }
59 
61  void (*handler)(void))
62 {
63  pok_idt_set_gate (vector,
65  (uint32_t)handler,
66  IDTE_TRAP,
67  3);
68 
69  return (POK_ERRNO_OK);
70 }
71 
73  const uint32_t local_thread_id)
74 {
75  return pok_partitions[partition_id].size - 4 - (local_thread_id * POK_USER_STACK_SIZE);
76 }
77