Rev 620 | Details | Compare with Previous | 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 | |||
620 | mauro | 22 | #include <ll/i386/hw-func.h> |
23 | |||
2 | pj | 24 | #include <ll/i386/stdlib.h> |
25 | #include <ll/unistd.h> |
||
26 | |||
27 | FILE(stdlib); |
||
28 | |||
620 | mauro | 29 | int ll_exit_mode = EXIT_MODE_REAL; |
30 | |||
2 | pj | 31 | unsigned abs(int x) |
32 | { |
||
620 | mauro | 33 | if (x < 0) return(-x); |
34 | else return(x); |
||
2 | pj | 35 | } |
36 | |||
620 | mauro | 37 | int ll_set_reboot(int mode) |
38 | { |
||
39 | switch(mode) { |
||
40 | case EXIT_MODE_HALT: |
||
41 | ll_exit_mode = EXIT_MODE_HALT; |
||
42 | break; |
||
43 | case EXIT_MODE_COLD: |
||
44 | ll_exit_mode = EXIT_MODE_COLD; |
||
45 | break; |
||
46 | case EXIT_MODE_WARM: |
||
47 | ll_exit_mode = EXIT_MODE_WARM; |
||
48 | break; |
||
49 | default: |
||
50 | ll_exit_mode = EXIT_MODE_REAL; |
||
51 | break; |
||
52 | } |
||
53 | return ll_exit_mode; |
||
54 | } |
||
55 | |||
2 | pj | 56 | void l1_exit(int code) |
57 | { |
||
620 | mauro | 58 | extern void bios_restore(void); |
2 | pj | 59 | |
620 | mauro | 60 | bios_restore(); |
622 | mauro | 61 | //printk("Exiting with mode: %d\n", ll_exit_mode); |
620 | mauro | 62 | switch (ll_exit_mode) { |
63 | case EXIT_MODE_HALT: |
||
64 | halt(); |
||
65 | break; |
||
66 | case EXIT_MODE_COLD: |
||
67 | cold_reboot(); |
||
68 | break; |
||
69 | case EXIT_MODE_WARM: |
||
70 | warm_reboot(); |
||
71 | break; |
||
72 | default: |
||
73 | __exit(code); |
||
74 | break; |
||
75 | } |
||
2 | pj | 76 | } |