From 9cbd0df60a1efb5e2622a54f40de557133346246 Mon Sep 17 00:00:00 2001 From: hpa Date: Fri, 19 Aug 2005 03:08:45 +0000 Subject: [PATCH] Saner idle call semantics --- NEWS | 3 +++ com32/lib/sys/idle.c | 3 +-- comboot.doc | 11 +++++++---- comboot.inc | 8 ++++++++ pxelinux.asm | 2 ++ 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index ba4ebbf..ddc61e9 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,9 @@ Changes in 3.10: * Comments are now recognized even without a space following #. * Fix incorrect handling of mixes of entries with and without MENU PASSWD. + * The idle API call now harmlessly returns failure if it is a + no-op. That way the caller can decide whether or not to + bother invoking it again. Changes in 3.09: * gcc4 compilation fix. diff --git a/com32/lib/sys/idle.c b/com32/lib/sys/idle.c index df8cc4a..85e857f 100644 --- a/com32/lib/sys/idle.c +++ b/com32/lib/sys/idle.c @@ -51,8 +51,7 @@ void syslinux_idle(void) if ( do_idle ) { __intcall(0x22, &sys_idle, &idle_result); - if ( idle_result.eflags.l & EFLAGS_CF ) - do_idle = 0; + do_idle = ~idle_result.eflags.l & EFLAGS_CF; } cpu_relax(); diff --git a/comboot.doc b/comboot.doc index 8680b71..ec521ad 100644 --- a/comboot.doc +++ b/comboot.doc @@ -586,10 +586,13 @@ AX=0013h [3.08] Idle loop call the moment, this is a no-op on all derivatives except PXELINUX, where it executes PXE calls to answer ARP queries. - Note: it's safe to call this API call on previous SYSLINUX - versions (2.00 or later); it will just harmlessly fail. If - API call INT 22h, AX=0015h, bit 1 is set, there is no reason - (but safe) to call this routine. + Starting with version 3.10, this API call harmlessly returns + failure (CF=1) if invoked on a platform which does not need + idle calls. Additionally, it's safe to call this API call on + previous SYSLINUX versions (2.00 or later); it will just + harmlessly fail. Thus, if this call returns failure (CF=1), + it means that there is no technical reason to call this + function again, although doing so is of course safe. AX=0014h [3.10] Local boot [PXELINUX, ISOLINUX] diff --git a/comboot.inc b/comboot.inc index a065192..90d9e4b 100644 --- a/comboot.inc +++ b/comboot.inc @@ -647,11 +647,19 @@ comapi_shuffle: ; ; INT 22h AX=0013h Idle call ; +%ifdef HAVE_IDLE + comapi_idle: DO_IDLE clc ret +%else + +comapi_idle equ comapi_err + +%endif + ; ; INT 22h AX=0014h Local boot ; diff --git a/pxelinux.asm b/pxelinux.asm index 13bb79b..a83afd0 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -60,6 +60,8 @@ SECTOR_SIZE equ TFTP_BLOCKSIZE ; ; This is what we need to do when idle ; +%define HAVE_IDLE 1 ; idle is not a noop + %macro RESET_IDLE 0 call reset_idle %endmacro -- 2.7.4