Skip to contentSkip to conversation

emulate osf/1 sys_indirect

alpha Richard Henderson 1 participant 1 message Nov 22, 2001

lore
Share & tools
lore
#0 lore raw

Noticed that Netscape wanted to use it.

r~

alpha/kernel/entry.S renamed from alpha/kernel/entry.S.orig +21 -1
@@ -488,6 +488,26 @@ entUnaUser:
 .end	entUnaUser
 
 /*
+ * No idea why OSF/1 didn't implement syscall(3) in userland.
+ * Implement this by shifting the registers around, backing up
+ * the pc to the callsys, and returning to usermode.
+ */
+.align 3
+.ent	sys_indirect
+sys_indirect:
+	ldq	$1, SP_OFF+8($30)
+	stq	$16, 0($30)
+	stq	$17, SP_OFF+24($30)
+	stq	$18, SP_OFF+32($30)
+	stq	$19, SP_OFF+40($30)
+	stq	$20, 72($30)
+	stq	$21, 80($30)
+	subq	$1, 4, $1
+	stq	$1, SP_OFF+8($30)
+	br	restore_all
+.end sys_indirect
+
+/*
  * A fork is the same as clone(SIGCHLD, 0);
  */
 .align 3
@@ -765,7 +785,7 @@ sys_rt_sigsuspend:
 	.align 3
 	.globl sys_call_table
 sys_call_table:
-	.quad alpha_ni_syscall			/* 0 */
+	.quad sys_indirect			/* 0 */
 	.quad sys_exit
 	.quad sys_fork
 	.quad sys_read