Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm32 Begin cleaning up the syscall path, a la i386.
details: https://anonhg.NetBSD.org/src/rev/a748f76ef5a5
branches: trunk
changeset: 500442:a748f76ef5a5
user: mycroft <mycroft%NetBSD.org@localhost>
date: Tue Dec 12 05:21:02 2000 +0000
description:
Begin cleaning up the syscall path, a la i386.
diffstat:
sys/arch/arm32/arm32/ast.c | 17 +----
sys/arch/arm32/arm32/fault.c | 15 +---
sys/arch/arm32/arm32/syscall.c | 128 +++++---------------------------------
sys/arch/arm32/arm32/undefined.c | 21 +-----
sys/arch/arm32/include/cpu.h | 6 +-
5 files changed, 33 insertions(+), 154 deletions(-)
diffs (truncated from 433 to 300 lines):
diff -r 5d2627accd55 -r a748f76ef5a5 sys/arch/arm32/arm32/ast.c
--- a/sys/arch/arm32/arm32/ast.c Tue Dec 12 05:11:15 2000 +0000
+++ b/sys/arch/arm32/arm32/ast.c Tue Dec 12 05:21:02 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ast.c,v 1.19 2000/06/29 08:52:57 mrg Exp $ */
+/* $NetBSD: ast.c,v 1.20 2000/12/12 05:21:02 mycroft Exp $ */
/*
* Copyright (c) 1994,1995 Mark Brinicombe
@@ -61,10 +61,8 @@
int want_resched = 0;
void
-userret(p, pc, oticks)
+userret(p)
struct proc *p;
- int pc;
- u_quad_t oticks;
{
int sig;
@@ -105,15 +103,6 @@
}
}
- /*
- * Not sure if this profiling bit is working yet ... Not been tested
- */
-
- if (p->p_flag & P_PROFIL) {
- extern int psratio;
- addupc_task(p, pc, (int)(p->p_sticks - oticks) * psratio);
- }
-
curcpu()->ci_schedstate.spc_curpriority = p->p_priority;
#ifdef DIAGNOSTIC
@@ -159,7 +148,7 @@
ADDUPROF(p);
}
- userret(p, frame->tf_pc, p->p_sticks);
+ userret(p);
}
/* End of ast.c */
diff -r 5d2627accd55 -r a748f76ef5a5 sys/arch/arm32/arm32/fault.c
--- a/sys/arch/arm32/arm32/fault.c Tue Dec 12 05:11:15 2000 +0000
+++ b/sys/arch/arm32/arm32/fault.c Tue Dec 12 05:21:02 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.46 2000/11/21 06:30:05 chs Exp $ */
+/* $NetBSD: fault.c,v 1.47 2000/12/12 05:21:02 mycroft Exp $ */
/*
* Copyright (c) 1994-1997 Mark Brinicombe.
@@ -143,7 +143,6 @@
u_int fault_instruction;
int fault_code;
int user;
- u_quad_t sticks = 0;
int error;
void *onfault;
@@ -233,8 +232,6 @@
/* Were we in user mode when the abort occurred ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
- sticks = p->p_sticks;
-
/*
* Note that the fault was from USR mode.
*/
@@ -360,7 +357,7 @@
* priveledged mode but uses USR mode
* permissions for its accesses.
*/
- userret(p, frame->tf_pc, p->p_sticks);
+ userret(p);
return;
}
map = kernel_map;
@@ -452,7 +449,7 @@
out:
/* Call userret() if it was a USR mode fault */
if (user)
- userret(p, frame->tf_pc, sticks);
+ userret(p);
}
@@ -478,7 +475,6 @@
register struct proc *p;
register struct pcb *pcb;
u_int fault_instruction;
- u_quad_t sticks;
pt_entry_t *pte;
int error;
@@ -539,7 +535,6 @@
/* Was the prefectch abort from USR32 mode ? */
if ((frame->tf_spsr & PSR_MODE) == PSR_USR32_MODE) {
- sticks = p->p_sticks;
p->p_md.md_regs = frame;
} else {
/*
@@ -563,7 +558,7 @@
fault_pc);
#endif
trapsignal(p, SIGSEGV, fault_pc);
- userret(p, frame->tf_pc, sticks);
+ userret(p);
return;
}
@@ -614,7 +609,7 @@
#endif /* DIAGNOSTIC */
}
- userret(p, frame->tf_pc, sticks);
+ userret(p);
}
int
diff -r 5d2627accd55 -r a748f76ef5a5 sys/arch/arm32/arm32/syscall.c
--- a/sys/arch/arm32/arm32/syscall.c Tue Dec 12 05:11:15 2000 +0000
+++ b/sys/arch/arm32/arm32/syscall.c Tue Dec 12 05:21:02 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.c,v 1.31 2000/11/26 15:13:50 chs Exp $ */
+/* $NetBSD: syscall.c,v 1.32 2000/12/12 05:21:02 mycroft Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -72,7 +72,7 @@
/* Macors to simplify the switch statement below */
#define SYSCALL_SPECIAL_RETURN \
- userret(p, frame->tf_pc, sticks); \
+ userret(p); \
return;
/*
@@ -89,11 +89,9 @@
caddr_t params;
const struct sysent *callp;
struct proc *p;
- int error, opc;
+ int error;
u_int argsize;
int args[8], rval[2];
- int nsys;
- u_quad_t sticks;
int regparams;
/*
@@ -106,32 +104,13 @@
uvmexp.syscalls++;
- /*
- * Trap SWI instructions executed in non-USR32 mode
- *
- * CONTINUE_AFTER_NONUSR_SYSCALL is used to determine whether the
- * kernel should continue running following a swi instruction in
- * non-USR32 mode. This was used for debugging and can problably
- * be removed altogether
- */
+#ifdef DEBUG
+ if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE)
+ panic("syscall: Not in SVC32 mode\n");
+#endif /* DEBUG */
-#ifdef DIAGNOSTIC
- if ((frame->tf_spsr & PSR_MODE) != PSR_USR32_MODE) {
- printf("syscall: swi 0x%x from non USR32 mode\n", code);
- printf("syscall: trapframe=%p\n", frame);
-
-#ifdef CONTINUE_AFTER_NONUSR_SYSCALL
- printf("syscall: The system should now be considered very unstable :-(\n");
- sigexit(curproc, SIGILL);
-
- /* Not reached */
-
- panic("syscall: How did we get here ?\n");
-#else
- panic("syscall in non USR32 mode\n");
-#endif /* CONTINUE_AFTER_NONUSR_SYSCALL */
- }
-#endif /* DIAGNOSTIC */
+ p = curproc;
+ p->p_md.md_regs = frame;
#ifdef CPU_ARM7
/*
@@ -151,45 +130,17 @@
* then we hit the bug.
*/
if ((ReadWord(frame->tf_pc - INSN_SIZE) & 0x0f000000) != 0x0f000000) {
-#ifdef ARM700BUGTRACK
- /* Verbose bug tracking */
-
- int loop;
-
- printf("ARM700 just stumbled at 0x%08x\n", frame->tf_pc - INSN_SIZE);
- printf("Code leading up to this was\n");
- for (loop = frame->tf_pc - 32; loop < frame->tf_pc; loop += 4)
- disassemble(loop);
-
- printf("CPU ID=%08x\n", cpu_id());
- printf("MMU Fault address=%08x status=%08x\n", cpu_faultaddress(), cpu_faultstatus());
- printf("Page table entry for 0x%08x at %p = 0x%08x\n",
- frame->tf_pc - INSN_SIZE, vtopte(frame->tf_pc - INSN_SIZE),
- *vtopte(frame->tf_pc - INSN_SIZE));
-#endif /* ARM700BUGTRACK */
-
frame->tf_pc -= INSN_SIZE;
++arm700bugcount;
-
- userret(curproc, frame->tf_pc, curproc->p_sticks);
-
+ userret(p);
return;
}
#endif /* CPU_ARM7 */
-#ifdef DIAGNOSTIC
- if ((GetCPSR() & PSR_MODE) != PSR_SVC32_MODE)
- panic("syscall: Not in SVC32 mode\n");
-#endif /* DIAGNOSTIC */
-
- p = curproc;
- sticks = p->p_sticks;
- p->p_md.md_regs = frame;
-
/*
* Support for architecture dependant SWIs
*/
- if (code > 0x00f00000) {
+ if (code & 0x00f00000) {
/*
* Support for the Architecture defined SWI's in case the
* processor does not support them.
@@ -204,41 +155,19 @@
break;
default:
/* Undefined so illegal instruction */
- trapsignal(p, SIGILL, ReadWord(frame->tf_pc - 4));
+ trapsignal(p, SIGILL, ReadWord(frame->tf_pc - INSN_SIZE));
break;
}
- userret(p, frame->tf_pc, sticks);
+ userret(p);
return;
}
-#ifdef PMAP_DEBUG
- /* Debug info */
- if (pmap_debug_level >= -1)
- printf("SYSCALL: code=%08x lr=%08x pid=%d\n",
- code, frame->tf_pc, p->p_pid);
-#endif /* PMAP_DEBUG */
-
- opc = frame->tf_pc;
params = (caddr_t)&frame->tf_r0;
regparams = 4;
- nsys = p->p_emul->e_nsysent;
callp = p->p_emul->e_sysent;
switch (code) {
-#if defined(DDB) && defined(PORTMASTER)
- /* Sometimes I want to enter the debugger outside of the interrupt handler */
- case 0x102e:
- if (securelevel > 0) {
- frame->tf_r0 = EPERM;
- frame->tf_spsr |= PSR_C_bit; /* carry bit */
- SYSCALL_SPECIAL_RETURN;
- }
- Debugger();
- SYSCALL_SPECIAL_RETURN;
- break;
-#endif /* DDB && PORTMASTER */
-
case SYS_syscall:
/* Don't have to look in user space, we have it in the trapframe */
/* code = fuword(params);*/
@@ -263,19 +192,7 @@
break;
}
- /* Validate syscall range */
- if (code < 0 || code >= nsys)
- callp += p->p_emul->e_nosys; /* illegal */
- else
- callp += code;
-
-#ifdef VERBOSE_ARM32
- /* Is the syscal valid ? */
- if (callp->sy_call == sys_nosys) {
- printf("syscall: nosys code=%d lr=%08x proc=%08x pid=%d %s\n",
Home |
Main Index |
Thread Index |
Old Index