Skip to content

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

Merged
ghaerr merged 2 commits intomasterfrom
watcom2
Jan 3, 2025
Merged

[watcom] Save DS register across syscalls, don't set DS on NULL pointers#2171
ghaerr merged 2 commits intomasterfrom
watcom2

Conversation

@ghaerr
Copy link
Copy Markdown
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
@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