Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
709 bytes
|
Rev | Line | |
---|
[e16e8f2] | 1 | /* |
---|
| 2 | * farcall.c |
---|
| 3 | */ |
---|
| 4 | |
---|
| 5 | #include <com32.h> |
---|
| 6 | |
---|
| 7 | static inline uint32_t eflags(void) |
---|
| 8 | { |
---|
| 9 | //uint32_t v; |
---|
| 10 | |
---|
| 11 | #if __SIZEOF_POINTER__ == 4 |
---|
| 12 | uint32_t v; |
---|
| 13 | asm volatile("pushfl ; popl %0" : "=rm" (v)); |
---|
| 14 | #elif __SIZEOF_POINTER__ == 8 |
---|
| 15 | uint64_t v; |
---|
| 16 | asm volatile("pushfq ; pop %0" : "=rm" (v)); |
---|
| 17 | #else |
---|
| 18 | #error "Unable to build for to-be-defined architecture type" |
---|
| 19 | #endif |
---|
| 20 | return v; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | void __farcall(uint16_t cs, uint16_t ip, |
---|
| 24 | const com32sys_t * ireg, com32sys_t * oreg) |
---|
| 25 | { |
---|
| 26 | com32sys_t xreg = *ireg; |
---|
| 27 | |
---|
| 28 | /* Enable interrupts if and only if they are enabled in the caller */ |
---|
| 29 | xreg.eflags.l = (xreg.eflags.l & ~EFLAGS_IF) | (eflags() & EFLAGS_IF); |
---|
| 30 | |
---|
| 31 | __com32.cs_farcall((cs << 16) + ip, &xreg, oreg); |
---|
| 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.