Removing executable bit from efi files.
[syslinux-debian/hramrach.git] / core / idle.inc
blob65d6c5c81d68b3557130815a5e5647369a5f1894
1 ;; -*- fundamental -*- ---------------------------------------------------
2 ;;
3 ;;   Copyright 2008 H. Peter Anvin - All Rights Reserved
4 ;;   Copyright 2009-2010 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.
12 ;; -----------------------------------------------------------------------
14                 section .text16
15 TICKS_TO_IDLE   equ 4           ; Also in idle.c
17 reset_idle:
18                 push eax
19                 mov eax,[cs:__jiffies]
20                 mov [cs:_IdleTimer],eax
21                 pop eax
22                 sti             ; Guard against BIOS/PXE brokenness...
23                 ret
25                 global do_idle:function hidden
26 do_idle:
27                 push eax
28                 push ds
29                 push es
30                 mov ax,cs
31                 mov ds,ax
32                 mov es,ax
33                 pushf
34                 pop ax
35                 test ah,2
36                 jnz .ok
37                 push si
38                 push cx
39                 mov si,hlt_err
40                 pm_call pm_writestr
41                 mov si,sp
42                 add si,10
43                 mov cx,16
44 .errloop:
45                 ss lodsw
46                 pm_call pm_writehex4
47                 dec cx
48                 jz .endloop
49                 mov al,' '
50                 pm_call pm_writechr
51                 jmp .errloop
52 .endloop:
53                 pm_call crlf
54                 pop cx
55                 pop si
56                 sti
57 .ok:
58                 ; Don't spend time jumping to PM unless we're actually idle...
60                 mov eax,[__jiffies]
61                 sub eax,[_IdleTimer]
62                 cmp eax,TICKS_TO_IDLE
63                 jb .done
65                 extern __idle
66                 pm_call __idle
67 .done:
68                 pop es
69                 pop ds
70                 pop eax
71 .ret:           ret
73                 section .data16
74                 alignz 4
75                 global _IdleTimer:data hidden
76 _IdleTimer      dd 0
78 hlt_err         db 'ERROR: idle with IF=0', CR, LF, 0 
80                 section .text16