Skip to content

Commit

Permalink
Merge pull request #2191 from ghaerr/sigcb
Browse files Browse the repository at this point in the history
[libc] Fix longstanding signal handling bug with improperly set DS register
  • Loading branch information
ghaerr authored Jan 20, 2025
2 parents 7898cc9 + 0533753 commit 678dd4e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libc/system/signalcb.S
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ _signal_cbhandler:
push %dx
push %si
push %di
push %ds
push %es
mov %ss,%ax
mov %ax,%ds

mov 6(%bp),%bx
#ifndef __IA16_CALLCVT_REGPARMCALL
Expand All @@ -43,6 +46,7 @@ _signal_cbhandler:
#endif

pop %es
pop %ds
pop %di
pop %si
pop %dx
Expand Down
2 changes: 2 additions & 0 deletions libc/watcom/asm/signalcb.asm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ __signal_cbhandler proc far
push di
push ds
push es
mov ax,ss ; ensure valid DS (=SS)
mov ds,ax

mov ax,6[bp] ; get signal #
callf _signal_wchandler_ ; call user function from C
Expand Down

0 comments on commit 678dd4e

Please sign in to comment.