shithub: scc

Download patch

ref: 48a6d7f71087fc26fe03b357a22db8b93c6b7de6
parent: e76db7d9761db34692ea8365f4e10055bc42bd97
author: Roberto E. Vargas Caballero <[email protected]>
date: Fri Aug 31 03:54:22 EDT 2018

[tests/libc] Fix syscall numbers and sigaction

These numbers were taken from the NetBSD implementation and they
were correct except in a few cases. The way how sigaction is
implemented is totally different in OpenBSD (it is simpler).

--- a/lib/c/target/amd64-sysv-openbsd/Makefile
+++ b/lib/c/target/amd64-sysv-openbsd/Makefile
@@ -5,7 +5,7 @@
 
 SYSNAME    = amd64-sysv-openbsd
 SCC_CFLAGS = -fno-stack-protector -static -nostdinc -I$(INCDIR) -I$(INCDIR)/bits/amd64-sysv/ -I.
-SYSOBJ     = raise.o signal.o _setcontext.o _sigaction.o _sigaction2.o
+SYSOBJ     = raise.o signal.o _sigaction.o
 
 include syscall.mk
 include ../script/objlst.mk
--- a/lib/c/target/amd64-sysv-openbsd/_setcontext.s
+++ /dev/null
@@ -1,14 +1,0 @@
-
-	.text
-	.globl	_Exit
-	.globl	_setcontext
-
-_setcontext:
-	movq	%r15,%rdi
-	movq	$0x134,%rax
-	syscall
-
-	# Something was wrong, finish the program. We can't call
-	# abort here because it could generate a loop
-	movq	$-1,%rdi
-	jmp	_Exit
--- a/lib/c/target/amd64-sysv-openbsd/_sigaction.c
+++ /dev/null
@@ -1,15 +1,0 @@
-
-#include <stddef.h>
-#include <sys.h>
-
-extern int _sigaction2(int sig,
-                       struct sigaction *new, struct sigaction *old,
-                       int siginfo[], int num);
-
-int
-_sigaction(int sig, struct sigaction *new, struct sigaction *old)
-{
-	extern int _setcontext[];
-
-	return _sigaction2(sig, new, old, _setcontext, 2);
-}
--- a/lib/c/target/amd64-sysv-openbsd/_sigaction2.s
+++ /dev/null
@@ -1,12 +1,0 @@
-
-# This syscall cannot be autogenerated because it receives more than
-# 4 arguments
-
-	.text
-	.globl	_sigaction2
-
-_sigaction2:
-	mov	$0x154,%eax
-	mov	%rcx,%r10
-	syscall
-	retq
--- a/lib/c/target/amd64-sysv-openbsd/syscall.lst
+++ b/lib/c/target/amd64-sysv-openbsd/syscall.lst
@@ -6,6 +6,6 @@
 6	_close
 17	_brk
 20	_getpid
-37	_kill
 46	_sigaction
-199	_lseek
+122	_kill
+198	_lseek