Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cswap.asm XMS handling not 8086-clean #15

Closed
ecm-pushbx opened this issue Jul 30, 2019 · 3 comments
Closed

cswap.asm XMS handling not 8086-clean #15

ecm-pushbx opened this issue Jul 30, 2019 · 3 comments

Comments

@ecm-pushbx
Copy link
Contributor

While testing my XMS implementation for 8086tiny ecm-pushbx/8086tiny@55bf203 I came upon several different, reproducable errors produced by different versions of FreeCOM. With a hack to make FreeCOM fail its XMS allocation, everything seemed to work and my own program (lDebug symbolic) successfully used the XMS interface.

I eventually chased the error to the handler that saves to XMS then is meant to jump into the resident portion:

		push dx			; save DS of transient portion
		push cs			; save segment of transient portion
		push WORD ret_from_resident
		push cx
		push WORD real_XMSexec
		retf

Push with an immediate is a 186+ instruction, but FreeCOM doesn't check for an 186 machine before using it.This likely wasn't noticed because XMS with actual extended memory requires a 286 at least.

@ecm-pushbx
Copy link
Contributor Author

I suggest that the NASM directive "cpu 8086" should be used to catch these and possibly additional bugs.

@ecm-pushbx
Copy link
Contributor Author

I disabled my first workaround and implemented the push imm16 instruction in my fork of 8086tiny. Now the XMS swapping works. Refer to ecm-pushbx/8086tiny@c09ef85

@bartoldeman
Copy link
Collaborator

Indeed XMS on a 8086 is nonsense. But forcing cpu 8086 is not a bad idea in other places and there is a better way in any case (a "call far" instruction).

Some code in the cswap.asm is still not 8088-safe but for the above reason I'm not going to fix it (namely that early models did not disable interrupts for one instruction past mov ss, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants