Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* Project: OSLib |
2 | * Description: The OS Construction Kit |
||
3 | * Date: 1.6.2000 |
||
4 | * Idea by: Luca Abeni & Gerardo Lamastra |
||
5 | * |
||
6 | * OSLib is an SO project aimed at developing a common, easy-to-use |
||
7 | * low-level infrastructure for developing OS kernels and Embedded |
||
8 | * Applications; it partially derives from the HARTIK project but it |
||
9 | * currently is independently developed. |
||
10 | * |
||
11 | * OSLib is distributed under GPL License, and some of its code has |
||
12 | * been derived from the Linux kernel source; also some important |
||
13 | * ideas come from studying the DJGPP go32 extender. |
||
14 | * |
||
15 | * We acknowledge the Linux Community, Free Software Foundation, |
||
16 | * D.J. Delorie and all the other developers who believe in the |
||
17 | * freedom of software and ideas. |
||
18 | * |
||
19 | * For legalese, check out the included GPL license. |
||
20 | */ |
||
21 | |||
22 | /* As the name says... |
||
23 | All the hardware-dependent functions |
||
24 | IDT/GDT management |
||
25 | context switch |
||
26 | IRQ/Exc handling... */ |
||
27 | |||
28 | #ifndef __LL_I386_HW_FUNC_H__ |
||
29 | #define __LL_I386_HW_FUNC_H__ |
||
30 | |||
31 | #include <ll/i386/defs.h> |
||
32 | BEGIN_DEF |
||
33 | |||
34 | #include <ll/i386/hw-instr.h> |
||
35 | |||
36 | /* Low level exit functions! It will halt, reboot or |
||
37 | * give back the control to X, depending on how YAMME started... |
||
38 | */ |
||
39 | void __exit(int code) __attribute__((noreturn)); |
||
40 | void halt(void); |
||
41 | |||
42 | /* Functions to reboot the machine */ |
||
43 | void cold_reboot(void); |
||
44 | void warm_reboot(void); |
||
45 | void reboot(int mode); |
||
46 | |||
47 | /* System tables management functions */ |
||
48 | void IDT_place(BYTE num,void (*handler)(void)); |
||
49 | void GDT_place(WORD sel,DWORD base,DWORD lim,BYTE acc,BYTE gran); |
||
50 | DWORD GDT_read(WORD sel,DWORD *lim,BYTE *acc,BYTE *gran); |
||
51 | LIN_ADDR addr2linear(unsigned short sel,unsigned long offset); |
||
52 | |||
53 | /* These 3 function realize the context switching. The context_save has */ |
||
54 | /* to be the first call of a kernel primitive, and the context_change has */ |
||
55 | /* to be the last call. */ |
||
56 | /* The context_save disables the interrupt (a kernel primitive must be */ |
||
57 | /* atomic) and return the context of the running task. */ |
||
58 | /* The context_change take the context of the new task (or of the */ |
||
59 | /* same task), switch to the new context and return restoring the flag */ |
||
60 | /* register. */ |
||
61 | /* The context_load is used when the task is going to be killed; then its */ |
||
62 | /* context does not need to be saved; we only need to load the context of */ |
||
63 | /* the new task; the effective implementation of this functions can vary */ |
||
64 | /* greatly throughout different implementations as some of them are */ |
||
65 | /* mapped to empty functions or mapped one onto another */ |
||
66 | |||
67 | CONTEXT ll_context_save(void); |
||
68 | void ll_context_change(CONTEXT c); |
||
69 | void ll_context_load(CONTEXT c); |
||
70 | |||
71 | CONTEXT ll_context_from(void); |
||
72 | void ll_context_to(CONTEXT c); |
||
73 | |||
74 | |||
75 | |||
76 | void *l1_init(void); |
||
77 | void l1_end(void); |
||
78 | void l1_exc_bind(int i, void (*f)(int n)); |
||
79 | void l1_irq_bind(int i, void (*f)(int n)); |
||
80 | |||
81 | |||
82 | END_DEF |
||
83 | |||
84 | #endif |