Contents of /tags/mkinitrd-6_3_0/isolinux/idle.inc
Parent Directory | Revision Log
Revision 1139 -
(show annotations)
(download)
Thu Aug 19 10:14:02 2010 UTC (14 years, 1 month ago) by niro
File size: 1574 byte(s)
Thu Aug 19 10:14:02 2010 UTC (14 years, 1 month ago) by niro
File size: 1574 byte(s)
tagged 'mkinitrd-6_3_0'
1 | ;; -*- fundamental -*- --------------------------------------------------- |
2 | ;; |
3 | ;; Copyright 2008 H. Peter Anvin - All Rights Reserved |
4 | ;; Copyright 2009 Intel Corporation; author: H. Peter Anvin |
5 | ;; |
6 | ;; This program is free software; you can redistribute it and/or modify |
7 | ;; it under the terms of the GNU General Public License as published by |
8 | ;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
9 | ;; Boston MA 02110-1301, USA; either version 2 of the License, or |
10 | ;; (at your option) any later version; incorporated herein by reference. |
11 | ;; |
12 | ;; ----------------------------------------------------------------------- |
13 | |
14 | section .text |
15 | TICKS_TO_IDLE equ 4 |
16 | |
17 | reset_idle: |
18 | push ax |
19 | mov ax,[cs:BIOS_timer] |
20 | mov [cs:IdleTimer],ax |
21 | pop ax |
22 | sti ; Guard against BIOS/PXE brokenness... |
23 | ret |
24 | |
25 | do_idle: |
26 | push ax |
27 | push ds |
28 | push es |
29 | mov ax,cs |
30 | mov ds,ax |
31 | mov es,ax |
32 | pushf |
33 | pop ax |
34 | test ah,2 |
35 | jnz .ok |
36 | push si |
37 | push cx |
38 | mov si,hlt_err |
39 | call writestr |
40 | mov si,sp |
41 | add si,10 |
42 | mov cx,16 |
43 | .errloop: |
44 | ss lodsw |
45 | call writehex4 |
46 | dec cx |
47 | jz .endloop |
48 | mov al,' ' |
49 | call writechr |
50 | jmp .errloop |
51 | .endloop: |
52 | call crlf |
53 | pop cx |
54 | pop si |
55 | sti |
56 | .ok: |
57 | mov ax,[BIOS_timer] |
58 | sub ax,[IdleTimer] |
59 | cmp ax,TICKS_TO_IDLE |
60 | jb .done |
61 | call [IdleHook] |
62 | cmp dword [NoHalt],0 |
63 | jne .done |
64 | hlt |
65 | .done: |
66 | pop es |
67 | pop ds |
68 | pop ax |
69 | .ret: ret |
70 | |
71 | section .data |
72 | alignb 4 |
73 | NoHalt dw 0 ; NoHalt set by user |
74 | ForceNoHalt dw 0 ; NoHalt forced by hardware config |
75 | IdleHook dw do_idle.ret |
76 | |
77 | hlt_err db 'ERROR: idle with IF=0', CR, LF, 0 |
78 | |
79 | section .bss |
80 | IdleTimer resw 1 |