summaryrefslogtreecommitdiff
path: root/core/idle.inc
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-18 14:32:57 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-18 14:32:57 -0700
commit12ae69d843447d3a973b0d9087f4f34f18e96ae8 (patch)
tree4e301fda2cf201bddda9e9ed445958308e8e3e24 /core/idle.inc
parentb59d70ca4c0140550d9be8d029dc79e605fa3954 (diff)
parent4826c90afd85d3bc8ee963de0bf1438340db865a (diff)
downloadsyslinux-12ae69d843447d3a973b0d9087f4f34f18e96ae8.tar.gz
Merge branch 'master' into core32
Conflicts: core/extlinux.asm core/isolinux.asm core/ldlinux.asm core/pxeidle.inc core/pxelinux.asm Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'core/idle.inc')
-rw-r--r--core/idle.inc50
1 files changed, 50 insertions, 0 deletions
diff --git a/core/idle.inc b/core/idle.inc
new file mode 100644
index 00000000..4b073641
--- /dev/null
+++ b/core/idle.inc
@@ -0,0 +1,50 @@
+;; -*- fundamental -*- ---------------------------------------------------
+;;
+;; Copyright 2008 H. Peter Anvin - All Rights Reserved
+;; Copyright 2009 Intel Corporation; author: H. Peter Anvin
+;;
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+;; Boston MA 02110-1301, USA; either version 2 of the License, or
+;; (at your option) any later version; incorporated herein by reference.
+;;
+;; -----------------------------------------------------------------------
+
+ section .text16
+TICKS_TO_IDLE equ 4
+
+reset_idle:
+ push ax
+ mov ax,[cs:BIOS_timer]
+ mov [cs:IdleTimer],ax
+ pop ax
+ ret
+
+do_idle:
+ push ax
+ push ds
+ push es
+ mov ax,cs
+ mov ds,ax
+ mov es,ax
+ mov ax,[BIOS_timer]
+ sub ax,[IdleTimer]
+ cmp ax,TICKS_TO_IDLE
+ jb .done
+ call [IdleHook]
+ cmp word [NoHalt],0
+ jne .done
+ hlt
+.done:
+ pop es
+ pop ds
+ pop ax
+.ret: ret
+
+ section .data16
+NoHalt dw 0
+IdleHook dw do_idle.ret
+
+ section .bss16
+IdleTimer resw 1