[syslinux:master] com32: make __farcall() IF-preserving
syslinux-bot for H. Peter Anvin
hpa at linux.intel.com
Mon Jun 21 16:03:09 PDT 2010
Commit-ID: 859ead0a2ef7dfd0b5622ad4878dda1b26c22e29
Gitweb: http://syslinux.zytor.com/commit/859ead0a2ef7dfd0b5622ad4878dda1b26c22e29
Author: H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Mon, 21 Jun 2010 15:58:57 -0700
Committer: H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Mon, 21 Jun 2010 15:58:57 -0700
com32: make __farcall() IF-preserving
Make __farcall preserve the current value of IF. If we need to we can
create a __raw_farcall() operation which does not.
Signed-off-by: H. Peter Anvin <hpa at linux.intel.com>
---
com32/lib/sys/farcall.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/com32/lib/sys/farcall.c b/com32/lib/sys/farcall.c
index 7d195f1..988ee6d 100644
--- a/com32/lib/sys/farcall.c
+++ b/com32/lib/sys/farcall.c
@@ -4,8 +4,21 @@
#include <com32.h>
+static inline uint32_t eflags(void)
+{
+ uint32_t v;
+
+ asm volatile("pushfl ; popl %0" : "=rm" (v));
+ return v;
+}
+
void __farcall(uint16_t cs, uint16_t ip,
const com32sys_t * ireg, com32sys_t * oreg)
{
- __com32.cs_farcall((cs << 16) + ip, ireg, oreg);
+ com32sys_t xreg = *ireg;
+
+ /* Enable interrupts if and only if they are enabled in the caller */
+ xreg.eflags.l = (xreg.eflags.l & ~EFLAGS_IF) | (eflags() & EFLAGS_IF);
+
+ __com32.cs_farcall((cs << 16) + ip, &xreg, oreg);
}
More information about the Syslinux-commits
mailing list