aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib/sys/farcall.c
diff options
context:
space:
mode:
Diffstat (limited to 'com32/lib/sys/farcall.c')
-rw-r--r--com32/lib/sys/farcall.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/com32/lib/sys/farcall.c b/com32/lib/sys/farcall.c
index 7d195f10..988ee6d2 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);
}