Skip to content

Commit

Permalink
Replace XMSrequest external asm with inline asm for GCC.
Browse files Browse the repository at this point in the history
The external asm did not preserve the si register which
was problematic.


git-svn-id: https://svn.code.sf.net/p/freedos/svn/freecom/trunk@1834 6ac86273-5f31-0410-b378-82cca8765d1b
  • Loading branch information
bartoldeman committed Aug 14, 2018
1 parent 190d2d1 commit b0e5984
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
9 changes: 8 additions & 1 deletion include/cswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 0 additions & 8 deletions shell/cswap.asm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b0e5984

Please sign in to comment.