diff --git a/include/cswap.h b/include/cswap.h index 8540d66b..5d30cb9e 100644 --- a/include/cswap.h +++ b/include/cswap.h @@ -44,7 +44,14 @@ extern unsigned long (far *far XMSdriverAdress)(unsigned request, #pragma aux XMSdriverAdress = parm [ax] [dx] [si] #elif defined(__GNUC__) extern unsigned far *far XMSdriverAdress; -extern unsigned long XMSrequest(unsigned request, unsigned dx, void *si); +static inline unsigned long XMSrequest(unsigned request, unsigned dx, void *si) +{ + long ret; + asm volatile("lcall *%%cs:XMSdriverAdress" : + "=A"(ret) : + "a"(request), "d"(dx), "S"(si)); + return ret; +} #else extern unsigned (far *far XMSdriverAdress)(void); extern void far XMSrequest(void); diff --git a/shell/cswap.asm b/shell/cswap.asm index 4604aa62..30ba4f1d 100644 --- a/shell/cswap.asm +++ b/shell/cswap.asm @@ -354,14 +354,6 @@ exec_error2: ;; Note: Because [CS:driverAdress] == [residentCS:driverAdress] ;; we need not use a similiar approach as with XMSexec XMSrequest: -%ifidn __OUTPUT_FORMAT__,elf ; GCC, calling near with stdcall conv. - pop cx ; return address - pop ax ; AX - pop dx ; DX - pop si ; SI - push cs - push cx ; far return from XMS driver -%endif jmp far [cs:XMSdriverAdress] ;; Added here to make it more easier for the C-part to call functions