Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/mips keep V0 value (system call number) and re...
details: https://anonhg.NetBSD.org/src/rev/0aa2b039c2ea
branches: trunk
changeset: 503723:0aa2b039c2ea
user: shin <shin%NetBSD.org@localhost>
date: Mon Feb 12 10:32:14 2001 +0000
description:
keep V0 value (system call number) and restore it in exception frame,
when error is ERESTART. otherwise, user process will re-issue syscall
with broken system call number and get SIGSYS signal and terminate.
patch made by Jason R Thorpe <thorpej%zembu.com@localhost>. tested by me.
diffstat:
sys/arch/mips/mips/syscall.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diffs (70 lines):
diff -r b237c9635cd4 -r 0aa2b039c2ea sys/arch/mips/mips/syscall.c
--- a/sys/arch/mips/mips/syscall.c Mon Feb 12 09:28:40 2001 +0000
+++ b/sys/arch/mips/mips/syscall.c Mon Feb 12 10:32:14 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.2 2001/01/18 17:48:01 tv Exp $ */
+/* $NetBSD: syscall.c,v 1.3 2001/02/12 10:32:14 shin Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -80,7 +80,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.2 2001/01/18 17:48:01 tv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.3 2001/02/12 10:32:14 shin Exp $");
#include "opt_ktrace.h"
#include "opt_syscall_debug.h"
@@ -138,7 +138,7 @@
syscall_plain(struct proc *p, u_int status, u_int cause, u_int opc)
{
struct frame *frame = (struct frame *)p->p_md.md_regs;
- mips_reg_t *args, copyargs[8];
+ mips_reg_t *args, copyargs[8], ov0;
size_t code, numsys, nsaved, nargs;
const struct sysent *callp;
int error;
@@ -152,7 +152,7 @@
callp = p->p_emul->e_sysent;
numsys = p->p_emul->e_nsysent;
- code = frame->f_regs[V0];
+ ov0 = code = frame->f_regs[V0];
switch (code) {
case SYS_syscall:
@@ -233,6 +233,7 @@
frame->f_regs[A3] = 0;
break;
case ERESTART:
+ frame->f_regs[V0] = ov0; /* restore syscall code */
frame->f_regs[PC] = opc;
break;
case EJUSTRETURN:
@@ -255,7 +256,7 @@
syscall_fancy(struct proc *p, u_int status, u_int cause, u_int opc)
{
struct frame *frame = (struct frame *)p->p_md.md_regs;
- mips_reg_t *args, copyargs[8];
+ mips_reg_t *args, copyargs[8], ov0;
size_t code, numsys, nsaved, nargs;
const struct sysent *callp;
int error;
@@ -269,7 +270,7 @@
callp = p->p_emul->e_sysent;
numsys = p->p_emul->e_nsysent;
- code = frame->f_regs[V0];
+ ov0 = code = frame->f_regs[V0];
switch (code) {
case SYS_syscall:
@@ -357,6 +358,7 @@
frame->f_regs[A3] = 0;
break;
case ERESTART:
+ frame->f_regs[V0] = ov0; /* restore syscall code */
frame->f_regs[PC] = opc;
break;
case EJUSTRETURN:
Home |
Main Index |
Thread Index |
Old Index