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

[watcom] Save DS register across syscalls, don't set DS on NULL pointers #2171

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Jan 3, 2025

The DS register would be set to zero when NULL was passed to system calls in the OpenWatcom version of the ELKS C library. This then allowed a NULL DS register to be write outside the process address space in the previous commit.

This PR now saves DS across Watcom system call wrappers using the OWC -Wc,-r option so this won't ever happen. In addition, the sys_setseg macro checks for NULL and won't set DS if so.

All pointer arguments to Watcom syscalls are now checked/set with sys_setseg, and the OWC syscall wrappers cleaned up.

A Watcom ASM version of fmemcmp is added to the C library, although still unused by 8086 toolchain as an inline version was written within AS86 for highest speed.

@ghaerr ghaerr merged commit feb61f7 into master Jan 3, 2025
2 checks passed
@ghaerr ghaerr deleted the watcom2 branch January 3, 2025 01:18
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

Successfully merging this pull request may close these issues.

1 participant