From 3a8752a5ab4fdde96758c4e514361f28a7f3327a Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Sat, 26 Nov 2005 18:59:53 +0000 Subject: [PATCH] add/use halt() wrapper for issuing "hlt" asm instruction git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1158 6ac86273-5f31-0410-b378-82cca8765d1b --- hdr/portab.h | 8 ++++++-- kernel/inthndlr.c | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hdr/portab.h b/hdr/portab.h index 14b398b..7a0dd0e 100644 --- a/hdr/portab.h +++ b/hdr/portab.h @@ -83,8 +83,9 @@ static char *portab_hRcsId = void __int__(int); #ifndef FORSYS void __emit__(char, ...); -#define disable() __emit__(0xfa) -#define enable() __emit__(0xfb) +#define disable() __emit__(0xfa) /* cli; disable interrupts */ +#define enable() __emit__(0xfb) /* sti; enable interrupts */ +#define halt() __emit__(0xf4) /* hlt; halt until interrupt */ #endif #elif defined (_MSC_VER) @@ -99,6 +100,7 @@ void __emit__(char, ...); #define __int__(intno) asm int intno; #define disable() asm cli #define enable() asm sti +#define halt() asm hlt #define _CS getCS() static unsigned short __inline getCS(void) { @@ -118,6 +120,8 @@ void disable(void); #pragma aux disable = "cli" modify exact []; void enable(void); #pragma aux enable = "sti" modify exact []; +void halt(void); +#pragma aux halt = "hlt" modify exact []; #define asm __asm #define far __far #define CDECL __cdecl diff --git a/kernel/inthndlr.c b/kernel/inthndlr.c index 02cf373..7af35f5 100644 --- a/kernel/inthndlr.c +++ b/kernel/inthndlr.c @@ -1929,8 +1929,8 @@ VOID ASMCFUNC int2F_12_handler(struct int2f12regs r) case 0x80: /* Win Release Time-slice */ { /* This function is generally only called in idle loops */ - __emit__(0xfb); /* sti; enable interrupts */ - __emit__(0xf4); /* hlt; halt until interrupt */ + enable(); /* sti; enable interrupts */ + halt(); /* hlt; halt until interrupt */ r.AX = 0; /* DebugPrintf(("Release Time Slice\n")); */ break;