diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S index e4868fff1e8a..e270422404a7 100644 --- a/sys/arch/amd64/amd64/locore.S +++ b/sys/arch/amd64/amd64/locore.S @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.5 2003/08/07 16:26:35 agc Exp $ */ +/* $NetBSD: locore.S,v 1.6 2003/08/20 21:48:47 fvdl Exp $ */ /* * Copyright-o-rama! @@ -1190,6 +1190,7 @@ IDTVEC(syscall) movq %rsp,L_MD_REGS(%r14) # save pointer to frame movq L_PROC(%r14),%r15 andl $~MDP_IRET,L_MD_FLAGS(%r14) + movq %rsp,%rdi call *P_MD_SYSCALL(%r15) 1: /* Check for ASTs on exit to user mode. */ cli @@ -1199,6 +1200,7 @@ IDTVEC(syscall) CLEAR_ASTPENDING(%r11) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + movq %rsp,%rdi call _C_LABEL(trap) jmp 1b 2: @@ -1288,6 +1290,7 @@ osyscall1: movq CPUVAR(CURLWP),%rdx movq %rsp,L_MD_REGS(%rdx) # save pointer to frame movq L_PROC(%rdx),%rdx + movq %rsp,%rdi call *P_MD_SYSCALL(%rdx) _C_LABEL(osyscall_return): 2: /* Check for ASTs on exit to user mode. */ @@ -1298,6 +1301,7 @@ _C_LABEL(osyscall_return): CLEAR_ASTPENDING(%r11) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + movq %rsp,%rdi call _C_LABEL(trap) jmp 2b iret_return: diff --git a/sys/arch/amd64/amd64/netbsd32_syscall.c b/sys/arch/amd64/amd64/netbsd32_syscall.c index 613d7a3d5d4f..d94769f8de7d 100644 --- a/sys/arch/amd64/amd64/netbsd32_syscall.c +++ b/sys/arch/amd64/amd64/netbsd32_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_syscall.c,v 1.2 2003/07/14 23:32:32 lukem Exp $ */ +/* $NetBSD: netbsd32_syscall.c,v 1.3 2003/08/20 21:48:48 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.2 2003/07/14 23:32:32 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.3 2003/08/20 21:48:48 fvdl Exp $"); #include "opt_syscall_debug.h" #include "opt_ktrace.h" @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_syscall.c,v 1.2 2003/07/14 23:32:32 lukem E #include void netbsd32_syscall_intern(struct proc *); -void netbsd32_syscall_plain(struct trapframe); -void netbsd32_syscall_fancy(struct trapframe); +void netbsd32_syscall_plain(struct trapframe *); +void netbsd32_syscall_fancy(struct trapframe *); void netbsd32_syscall_intern(p) @@ -89,7 +89,7 @@ netbsd32_syscall_intern(p) void netbsd32_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -104,9 +104,9 @@ netbsd32_syscall_plain(frame) l = curlwp; p = l->l_proc; - code = frame.tf_rax; + code = frame->tf_rax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_rsp + sizeof(int); + params = (caddr_t)frame->tf_rsp + sizeof(int); switch (code) { case SYS_syscall: @@ -150,9 +150,9 @@ netbsd32_syscall_plain(frame) error = (*callp->sy_call)(l, args, rval); switch (error) { case 0: - frame.tf_rax = rval[0]; - frame.tf_rdx = rval[1]; - frame.tf_rflags &= ~PSL_C; /* carry bit */ + frame->tf_rax = rval[0]; + frame->tf_rdx = rval[1]; + frame->tf_rflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -160,15 +160,15 @@ netbsd32_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_rip -= frame.tf_err; + frame->tf_rip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_rax = error; - frame.tf_rflags |= PSL_C; /* carry bit */ + frame->tf_rax = error; + frame->tf_rflags |= PSL_C; /* carry bit */ break; } @@ -180,7 +180,7 @@ netbsd32_syscall_plain(frame) void netbsd32_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -199,9 +199,9 @@ netbsd32_syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_rax; + code = frame->tf_rax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_rsp + sizeof(int); + params = (caddr_t)frame->tf_rsp + sizeof(int); switch (code) { case SYS_syscall: @@ -256,9 +256,9 @@ netbsd32_syscall_fancy(frame) error = (*callp->sy_call)(l, args, rval); switch (error) { case 0: - frame.tf_rax = rval[0]; - frame.tf_rdx = rval[1]; - frame.tf_rflags &= ~PSL_C; /* carry bit */ + frame->tf_rax = rval[0]; + frame->tf_rdx = rval[1]; + frame->tf_rflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -266,15 +266,15 @@ netbsd32_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_rip -= frame.tf_err; + frame->tf_rip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_rax = error; - frame.tf_rflags |= PSL_C; /* carry bit */ + frame->tf_rax = error; + frame->tf_rflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/amd64/amd64/spl.S b/sys/arch/amd64/amd64/spl.S index 8c3448b8ab42..44ebb25e82e7 100644 --- a/sys/arch/amd64/amd64/spl.S +++ b/sys/arch/amd64/amd64/spl.S @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.1 2003/04/26 18:39:32 fvdl Exp $ */ +/* $NetBSD: spl.S,v 1.2 2003/08/20 21:48:48 fvdl Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -182,6 +182,7 @@ IDTVEC(doreti) sti movl $T_ASTFLT,TF_TRAPNO(%rsp) /* XXX undo later.. */ /* Pushed T_ASTFLT into tf_trapno on entry. */ + movq %rsp,%rdi call _C_LABEL(trap) cli jmp 5b diff --git a/sys/arch/amd64/amd64/syscall.c b/sys/arch/amd64/amd64/syscall.c index e86119595c40..923337032d6f 100644 --- a/sys/arch/amd64/amd64/syscall.c +++ b/sys/arch/amd64/amd64/syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.2 2003/07/14 23:32:33 lukem Exp $ */ +/* $NetBSD: syscall.c,v 1.3 2003/08/20 21:48:49 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.2 2003/07/14 23:32:33 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.3 2003/08/20 21:48:49 fvdl Exp $"); #include "opt_syscall_debug.h" #include "opt_ktrace.h" @@ -65,8 +65,8 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.2 2003/07/14 23:32:33 lukem Exp $"); #include void syscall_intern __P((struct proc *)); -void syscall_plain __P((struct trapframe)); -void syscall_fancy __P((struct trapframe)); +void syscall_plain __P((struct trapframe *)); +void syscall_fancy __P((struct trapframe *)); void syscall_intern(p) @@ -94,7 +94,7 @@ syscall_intern(p) */ void syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -108,7 +108,7 @@ syscall_plain(frame) l = curlwp; p = l->l_proc; - code = frame.tf_rax; + code = frame->tf_rax; callp = p->p_emul->e_sysent; argoff = 0; argp = &args[0]; @@ -119,7 +119,7 @@ syscall_plain(frame) /* * Code is first argument, followed by actual args. */ - code = frame.tf_rdi; + code = frame->tf_rdi; argp = &args[1]; argoff = 1; break; @@ -134,24 +134,24 @@ syscall_plain(frame) if (argsize) { switch (MIN(argsize, 6)) { case 6: - args[5] = frame.tf_r9; + args[5] = frame->tf_r9; case 5: - args[4] = frame.tf_r8; + args[4] = frame->tf_r8; case 4: - args[3] = frame.tf_r10; + args[3] = frame->tf_r10; case 3: - args[2] = frame.tf_rdx; + args[2] = frame->tf_rdx; case 2: - args[1] = frame.tf_rsi; + args[1] = frame->tf_rsi; case 1: - args[0] = frame.tf_rdi; + args[0] = frame->tf_rdi; break; default: panic("impossible syscall argsize"); } if (argsize > 6) { argsize -= 6; - params = (caddr_t)frame.tf_rsp + sizeof(register_t); + params = (caddr_t)frame->tf_rsp + sizeof(register_t); error = copyin(params, (caddr_t)&args[6], argsize << 3); if (error != 0) @@ -171,9 +171,9 @@ syscall_plain(frame) switch (error) { case 0: - frame.tf_rax = rval[0]; - frame.tf_rdx = rval[1]; - frame.tf_rflags &= ~PSL_C; /* carry bit */ + frame->tf_rax = rval[0]; + frame->tf_rdx = rval[1]; + frame->tf_rflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -181,15 +181,15 @@ syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_rip -= frame.tf_err; + frame->tf_rip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_rax = error; - frame.tf_rflags |= PSL_C; /* carry bit */ + frame->tf_rax = error; + frame->tf_rflags |= PSL_C; /* carry bit */ break; } @@ -201,7 +201,7 @@ syscall_plain(frame) void syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -215,7 +215,7 @@ syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_rax; + code = frame->tf_rax; callp = p->p_emul->e_sysent; argp = &args[0]; argoff = 0; @@ -226,7 +226,7 @@ syscall_fancy(frame) /* * Code is first argument, followed by actual args. */ - code = frame.tf_rdi; + code = frame->tf_rdi; argp = &args[1]; argoff = 1; break; @@ -240,24 +240,24 @@ syscall_fancy(frame) if (argsize) { switch (MIN(argsize, 6)) { case 6: - args[5] = frame.tf_r9; + args[5] = frame->tf_r9; case 5: - args[4] = frame.tf_r8; + args[4] = frame->tf_r8; case 4: - args[3] = frame.tf_r10; + args[3] = frame->tf_r10; case 3: - args[2] = frame.tf_rdx; + args[2] = frame->tf_rdx; case 2: - args[1] = frame.tf_rsi; + args[1] = frame->tf_rsi; case 1: - args[0] = frame.tf_rdi; + args[0] = frame->tf_rdi; break; default: panic("impossible syscall argsize"); } if (argsize > 6) { argsize -= 6; - params = (caddr_t)frame.tf_rsp + sizeof(register_t); + params = (caddr_t)frame->tf_rsp + sizeof(register_t); error = copyin(params, (caddr_t)&args[6], argsize << 3); if (error != 0) @@ -277,9 +277,9 @@ syscall_fancy(frame) KERNEL_PROC_UNLOCK(l); switch (error) { case 0: - frame.tf_rax = rval[0]; - frame.tf_rdx = rval[1]; - frame.tf_rflags &= ~PSL_C; /* carry bit */ + frame->tf_rax = rval[0]; + frame->tf_rdx = rval[1]; + frame->tf_rflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -287,15 +287,15 @@ syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_rip -= frame.tf_err; + frame->tf_rip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_rax = error; - frame.tf_rflags |= PSL_C; /* carry bit */ + frame->tf_rax = error; + frame->tf_rflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index cd12864d57fd..0b0779736de7 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.7 2003/08/07 16:26:35 agc Exp $ */ +/* $NetBSD: trap.c,v 1.8 2003/08/20 21:48:49 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -75,12 +75,11 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7 2003/08/07 16:26:35 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.8 2003/08/20 21:48:49 fvdl Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" #include "opt_lockdebug.h" -#include "opt_math_emulate.h" #include "opt_multiprocessor.h" #include @@ -117,7 +116,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.7 2003/08/07 16:26:35 agc Exp $"); #include #endif -void trap __P((struct trapframe)); +void trap __P((struct trapframe *)); #if defined(I386_CPU) int trapwrite __P((unsigned)); #endif @@ -168,11 +167,11 @@ static void frame_dump(struct trapframe *); /*ARGSUSED*/ void trap(frame) - struct trapframe frame; + struct trapframe *frame; { struct lwp *l = curlwp; struct proc *p = l ? l->l_proc : 0; - int type = (int)frame.tf_trapno; + int type = (int)frame->tf_trapno; struct pcb *pcb; extern char fusuintrfailure[], resume_iret[], IDTVEC(oosyscall)[]; @@ -193,17 +192,17 @@ trap(frame) if (trapdebug) { printf("trap %d code %lx eip %lx cs %lx rflags %lx cr2 %lx " "cpl %x\n", - type, frame.tf_err, frame.tf_rip, frame.tf_cs, - frame.tf_rflags, rcr2(), curcpu()->ci_ilevel); + type, frame->tf_err, frame->tf_rip, frame->tf_cs, + frame->tf_rflags, rcr2(), curcpu()->ci_ilevel); printf("curlwp %p\n", curlwp); if (curlwp) printf("pid %d lid %d\n", l->l_proc->p_pid, l->l_lid); } #endif - if (!KERNELMODE(frame.tf_cs, frame.tf_rflags)) { + if (!KERNELMODE(frame->tf_cs, frame->tf_rflags)) { type |= T_USER; - l->l_md.md_regs = &frame; + l->l_md.md_regs = frame; } switch (type) { @@ -211,7 +210,7 @@ trap(frame) default: we_re_toast: #ifdef KGDB - if (kgdb_trap(type, &frame)) + if (kgdb_trap(type, frame)) return; else { /* @@ -225,18 +224,18 @@ trap(frame) } #endif #ifdef DDB - if (kdb_trap(type, 0, &frame)) + if (kdb_trap(type, 0, frame)) return; #endif - if (frame.tf_trapno < trap_types) - printf("fatal %s", trap_type[frame.tf_trapno]); + if (frame->tf_trapno < trap_types) + printf("fatal %s", trap_type[frame->tf_trapno]); else - printf("unknown trap %ld", (u_long)frame.tf_trapno); + printf("unknown trap %ld", (u_long)frame->tf_trapno); printf(" in %s mode\n", (type & T_USER) ? "user" : "supervisor"); printf("trap type %d code %lx rip %lx cs %lx rflags %lx cr2 " " %lx cpl %x rsp %lx\n", - type, frame.tf_err, (u_long)frame.tf_rip, frame.tf_cs, - frame.tf_rflags, rcr2(), curcpu()->ci_ilevel, frame.tf_rsp); + type, frame->tf_err, (u_long)frame->tf_rip, frame->tf_cs, + frame->tf_rflags, rcr2(), curcpu()->ci_ilevel, frame->tf_rsp); /* panic("trap"); */ cpu_reboot(RB_HALT, NULL); @@ -253,8 +252,8 @@ trap(frame) copyefault: error = EFAULT; copyfault: - frame.tf_rip = (u_int64_t)pcb->pcb_onfault; - frame.tf_rax = error; + frame->tf_rip = (u_int64_t)pcb->pcb_onfault; + frame->tf_rax = error; return; } @@ -275,9 +274,9 @@ copyfault: * at this point is the same as on exit from a `slow' * interrupt. */ - switch (*(u_char *)frame.tf_rip) { + switch (*(u_char *)frame->tf_rip) { case 0xcf: /* iret */ - vframe = (void *)((u_int64_t)&frame.tf_rsp - 44); + vframe = (void *)((u_int64_t)&frame->tf_rsp - 44); resume = resume_iret; break; /* @@ -288,11 +287,11 @@ copyfault: */ #if 0 case 0x1f: /* popl %ds */ - vframe = (void *)((u_int64_t)&frame.tf_rsp - 4); + vframe = (void *)((u_int64_t)&frame->tf_rsp - 4); resume = resume_pop_ds; break; case 0x07: /* popl %es */ - vframe = (void *)((u_int64_t)&frame.tf_rsp - 0); + vframe = (void *)((u_int64_t)&frame->tf_rsp - 0); resume = resume_pop_es; break; #endif @@ -302,7 +301,7 @@ copyfault: if (KERNELMODE(vframe->tf_cs, vframe->tf_rflags)) goto we_re_toast; - frame.tf_rip = (u_int64_t)resume; + frame->tf_rip = (u_int64_t)resume; return; case T_PROTFLT|T_USER: /* protection fault */ @@ -313,7 +312,7 @@ copyfault: case T_NMI|T_USER: #ifdef TRAP_SIGDEBUG printf("pid %d (%s): BUS at rip %lx addr %lx\n", - p->p_pid, p->p_comm, frame.tf_rip, rcr2()); + p->p_pid, p->p_comm, frame->tf_rip, rcr2()); frame_dump(&frame); #endif KERNEL_PROC_LOCK(l); @@ -325,7 +324,7 @@ copyfault: case T_FPOPFLT|T_USER: /* coprocessor operand fault */ #ifdef TRAP_SIGDEBUG printf("pid %d (%s): ILL at rip %lx addr %lx\n", - p->p_pid, p->p_comm, frame.tf_rip, rcr2()); + p->p_pid, p->p_comm, frame->tf_rip, rcr2()); frame_dump(&frame); #endif KERNEL_PROC_LOCK(l); @@ -365,7 +364,7 @@ copyfault: case T_ARITHTRAP|T_USER: case T_XMM|T_USER: - fputrap(&frame); + fputrap(frame); goto out; case T_PAGEFLT: /* allow page faults in kernel mode */ @@ -413,7 +412,7 @@ faultcommon: map = kernel_map; else map = &vm->vm_map; - if (frame.tf_err & PGEX_W) + if (frame->tf_err & PGEX_W) ftype = VM_PROT_WRITE; else ftype = VM_PROT_READ; @@ -482,7 +481,7 @@ faultcommon: } else { #ifdef TRAP_SIGDEBUG printf("pid %d (%s): SEGV at rip %lx addr %lx\n", - p->p_pid, p->p_comm, frame.tf_rip, va); + p->p_pid, p->p_comm, frame->tf_rip, va); frame_dump(&frame); #endif (*p->p_emul->e_trapsignal)(l, SIGSEGV, T_PAGEFLT); @@ -496,10 +495,10 @@ faultcommon: case T_TRCTRAP: /* Check whether they single-stepped into a lcall. */ - if (frame.tf_rip == (int)IDTVEC(oosyscall)) + if (frame->tf_rip == (int)IDTVEC(oosyscall)) return; - if (frame.tf_rip == (int)IDTVEC(oosyscall) + 1) { - frame.tf_rflags &= ~PSL_T; + if (frame->tf_rip == (int)IDTVEC(oosyscall) + 1) { + frame->tf_rflags &= ~PSL_T; return; } goto we_re_toast; @@ -510,7 +509,7 @@ faultcommon: trace: #endif if ((p->p_nras == 0) || - (ras_lookup(p, (caddr_t)frame.tf_rip) == (caddr_t)-1)) { + (ras_lookup(p, (caddr_t)frame->tf_rip) == (caddr_t)-1)) { KERNEL_PROC_LOCK(l); (*p->p_emul->e_trapsignal)(l, SIGTRAP, type &~ T_USER); KERNEL_PROC_UNLOCK(l); diff --git a/sys/arch/amd64/amd64/vector.S b/sys/arch/amd64/amd64/vector.S index 27b8a60b9d21..166398186087 100644 --- a/sys/arch/amd64/amd64/vector.S +++ b/sys/arch/amd64/amd64/vector.S @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.2 2003/05/04 23:46:41 fvdl Exp $ */ +/* $NetBSD: vector.S,v 1.3 2003/08/20 21:48:51 fvdl Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -225,6 +225,7 @@ calltrap: #ifdef DIAGNOSTIC movl CPUVAR(ILEVEL),%ebx #endif /* DIAGNOSTIC */ + movq %rsp,%rdi call _C_LABEL(trap) 2: /* Check for ASTs on exit to user mode. */ cli @@ -235,6 +236,7 @@ calltrap: 5: CLEAR_ASTPENDING(%r11) sti movl $T_ASTFLT,TF_TRAPNO(%rsp) + movq %rsp,%rdi call _C_LABEL(trap) jmp 2b #ifndef DIAGNOSTIC @@ -370,8 +372,8 @@ IDTVEC(intr_lapic_ltimer) #endif /* NLAPIC > 0 */ #ifdef MULTIPROCESSOR -#define LOCK_KERNEL call _C_LABEL(x86_intlock) -#define UNLOCK_KERNEL call _C_LABEL(x86_intunlock) +#define LOCK_KERNEL movq %rsp,%rdi ; call _C_LABEL(x86_intlock) +#define UNLOCK_KERNEL movq %rsp,%rdi ; call _C_LABEL(x86_intunlock) #else #define LOCK_KERNEL #define UNLOCK_KERNEL diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index 72980a987763..ad15fa13bac4 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $NetBSD: files.amd64,v 1.4 2003/07/27 01:19:25 thorpej Exp $ +# $NetBSD: files.amd64,v 1.5 2003/08/20 21:48:52 fvdl Exp $ # # new style config file for amd64 architecture # @@ -32,7 +32,7 @@ file arch/amd64/amd64/db_disasm.c ddb file arch/amd64/amd64/db_interface.c ddb file arch/amd64/amd64/db_memrw.c ddb | kgdb file arch/amd64/amd64/db_trace.c ddb -file arch/amd64/amd64/disksubr.c disk +file kern/subr_disk_mbr.c disk file arch/amd64/amd64/gdt.c # diff --git a/sys/arch/amd64/include/proc.h b/sys/arch/amd64/include/proc.h index a20faa9c5bb5..9903f7d7f8bb 100644 --- a/sys/arch/amd64/include/proc.h +++ b/sys/arch/amd64/include/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.2 2003/08/07 16:26:36 agc Exp $ */ +/* $NetBSD: proc.h,v 1.3 2003/08/20 21:48:52 fvdl Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -48,7 +48,7 @@ struct mdlwp { struct mdproc { int md_flags; /* Syscall handling function */ - void (*md_syscall) __P((struct trapframe)); + void (*md_syscall) __P((struct trapframe *)); __volatile int md_astpending; }; diff --git a/sys/arch/i386/i386/compat_13_machdep.c b/sys/arch/i386/i386/compat_13_machdep.c index 84dab9a46584..ce37cd9d3416 100644 --- a/sys/arch/i386/i386/compat_13_machdep.c +++ b/sys/arch/i386/i386/compat_13_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.11 2003/06/23 11:01:17 martin Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.12 2003/08/20 21:48:35 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.11 2003/06/23 11:01:17 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.12 2003/08/20 21:48:35 fvdl Exp $"); #include "opt_vm86.h" @@ -82,7 +82,7 @@ compat_13_sys_sigreturn(l, v, retval) tf = l->l_md.md_regs; #ifdef VM86 if (context.sc_eflags & PSL_VM) { - void syscall_vm86 __P((struct trapframe)); + void syscall_vm86 __P((struct trapframe *)); tf->tf_vm86_gs = context.sc_gs; tf->tf_vm86_fs = context.sc_fs; diff --git a/sys/arch/i386/i386/freebsd_machdep.c b/sys/arch/i386/i386/freebsd_machdep.c index 5887f10815d8..9f7787c11096 100644 --- a/sys/arch/i386/i386/freebsd_machdep.c +++ b/sys/arch/i386/i386/freebsd_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_machdep.c,v 1.36 2003/01/17 23:10:30 thorpej Exp $ */ +/* $NetBSD: freebsd_machdep.c,v 1.37 2003/08/20 21:48:36 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.36 2003/01/17 23:10:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: freebsd_machdep.c,v 1.37 2003/08/20 21:48:36 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -228,7 +228,7 @@ freebsd_sys_sigreturn(l, v, retval) tf = l->l_md.md_regs; #ifdef VM86 if (context.sc_efl & PSL_VM) { - void syscall_vm86 __P((struct trapframe)); + void syscall_vm86 __P((struct trapframe *)); tf->tf_vm86_gs = context.sc_gs; tf->tf_vm86_fs = context.sc_fs; diff --git a/sys/arch/i386/i386/freebsd_syscall.c b/sys/arch/i386/i386/freebsd_syscall.c index 0bb694ba661e..6c3ec5c1d3f0 100644 --- a/sys/arch/i386/i386/freebsd_syscall.c +++ b/sys/arch/i386/i386/freebsd_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: freebsd_syscall.c,v 1.12 2003/01/17 23:10:30 thorpej Exp $ */ +/* $NetBSD: freebsd_syscall.c,v 1.13 2003/08/20 21:48:36 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.12 2003/01/17 23:10:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.13 2003/08/20 21:48:36 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_syscall_debug.h" @@ -68,8 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: freebsd_syscall.c,v 1.12 2003/01/17 23:10:30 thorpej #include #include -void freebsd_syscall_plain __P((struct trapframe)); -void freebsd_syscall_fancy __P((struct trapframe)); +void freebsd_syscall_plain __P((struct trapframe *)); +void freebsd_syscall_fancy __P((struct trapframe *)); void freebsd_syscall_intern(p) @@ -98,7 +98,7 @@ freebsd_syscall_intern(p) */ void freebsd_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -112,9 +112,9 @@ freebsd_syscall_plain(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -150,7 +150,7 @@ freebsd_syscall_plain(frame) #endif /* SYSCALL_DEBUG */ rval[0] = 0; - rval[1] = frame.tf_edx; /* need to keep edx for shared FreeBSD bins */ + rval[1] = frame->tf_edx; /* need to keep edx for shared FreeBSD bins */ KERNEL_PROC_LOCK(l); error = (*callp->sy_call)(l, args, rval); @@ -158,9 +158,9 @@ freebsd_syscall_plain(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -168,15 +168,15 @@ freebsd_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -188,7 +188,7 @@ freebsd_syscall_plain(frame) void freebsd_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -202,9 +202,9 @@ freebsd_syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -240,14 +240,14 @@ freebsd_syscall_fancy(frame) goto bad; rval[0] = 0; - rval[1] = frame.tf_edx; /* need to keep edx for shared FreeBSD bins */ + rval[1] = frame->tf_edx; /* need to keep edx for shared FreeBSD bins */ error = (*callp->sy_call)(l, args, rval); KERNEL_PROC_UNLOCK(l); switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -255,15 +255,15 @@ freebsd_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/i386/i386/ibcs2_syscall.c b/sys/arch/i386/i386/ibcs2_syscall.c index 59729431db26..c77888c02e30 100644 --- a/sys/arch/i386/i386/ibcs2_syscall.c +++ b/sys/arch/i386/i386/ibcs2_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: ibcs2_syscall.c,v 1.21 2003/01/17 23:10:30 thorpej Exp $ */ +/* $NetBSD: ibcs2_syscall.c,v 1.22 2003/08/20 21:48:36 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.21 2003/01/17 23:10:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.22 2003/08/20 21:48:36 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_syscall_debug.h" @@ -71,8 +71,8 @@ __KERNEL_RCSID(0, "$NetBSD: ibcs2_syscall.c,v 1.21 2003/01/17 23:10:30 thorpej E #include #include -void ibcs2_syscall_plain __P((struct trapframe)); -void ibcs2_syscall_fancy __P((struct trapframe)); +void ibcs2_syscall_plain __P((struct trapframe *)); +void ibcs2_syscall_fancy __P((struct trapframe *)); extern struct sysent ibcs2_sysent[]; void @@ -101,7 +101,7 @@ ibcs2_syscall_intern(p) */ void ibcs2_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -113,11 +113,11 @@ ibcs2_syscall_plain(frame) uvmexp.syscalls++; l = curlwp; - code = frame.tf_eax; + code = frame->tf_eax; if (IBCS2_HIGH_SYSCALL(code)) code = IBCS2_CVT_HIGH_SYSCALL(code); callp = ibcs2_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -153,9 +153,9 @@ ibcs2_syscall_plain(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -163,7 +163,7 @@ ibcs2_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ @@ -171,8 +171,8 @@ ibcs2_syscall_plain(frame) default: bad: error = native_to_ibcs2_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -189,7 +189,7 @@ ibcs2_syscall_plain(frame) */ void ibcs2_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -203,11 +203,11 @@ ibcs2_syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; if (IBCS2_HIGH_SYSCALL(code)) code = IBCS2_CVT_HIGH_SYSCALL(code); callp = ibcs2_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -241,9 +241,9 @@ ibcs2_syscall_fancy(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -251,7 +251,7 @@ ibcs2_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ @@ -259,8 +259,8 @@ ibcs2_syscall_fancy(frame) default: bad: error = native_to_ibcs2_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/i386/i386/linux_syscall.c b/sys/arch/i386/i386/linux_syscall.c index 524a30766e2d..e634124ad91a 100644 --- a/sys/arch/i386/i386/linux_syscall.c +++ b/sys/arch/i386/i386/linux_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: linux_syscall.c,v 1.24 2003/01/17 23:10:30 thorpej Exp $ */ +/* $NetBSD: linux_syscall.c,v 1.25 2003/08/20 21:48:37 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.24 2003/01/17 23:10:30 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.25 2003/08/20 21:48:37 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_syscall_debug.h" @@ -72,8 +72,8 @@ __KERNEL_RCSID(0, "$NetBSD: linux_syscall.c,v 1.24 2003/01/17 23:10:30 thorpej E #include #include -void linux_syscall_plain __P((struct trapframe)); -void linux_syscall_fancy __P((struct trapframe)); +void linux_syscall_plain __P((struct trapframe *)); +void linux_syscall_fancy __P((struct trapframe *)); extern struct sysent linux_sysent[]; void @@ -102,7 +102,7 @@ linux_syscall_intern(p) */ void linux_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { register const struct sysent *callp; struct lwp *l; @@ -113,7 +113,7 @@ linux_syscall_plain(frame) uvmexp.syscalls++; l = curlwp; - code = frame.tf_eax; + code = frame->tf_eax; callp = linux_sysent; code &= (LINUX_SYS_NSYSENT - 1); @@ -126,17 +126,17 @@ linux_syscall_plain(frame) */ switch (argsize >> 2) { case 6: - args[5] = frame.tf_ebp; + args[5] = frame->tf_ebp; case 5: - args[4] = frame.tf_edi; + args[4] = frame->tf_edi; case 4: - args[3] = frame.tf_esi; + args[3] = frame->tf_esi; case 3: - args[2] = frame.tf_edx; + args[2] = frame->tf_edx; case 2: - args[1] = frame.tf_ecx; + args[1] = frame->tf_ecx; case 1: - args[0] = frame.tf_ebx; + args[0] = frame->tf_ebx; break; default: panic("linux syscall %d bogus argument size %d", @@ -156,8 +156,8 @@ linux_syscall_plain(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -165,15 +165,15 @@ linux_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: error = native_to_linux_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -190,7 +190,7 @@ linux_syscall_plain(frame) */ void linux_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { register const struct sysent *callp; struct lwp *l; @@ -203,7 +203,7 @@ linux_syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = linux_sysent; code &= (LINUX_SYS_NSYSENT - 1); @@ -216,17 +216,17 @@ linux_syscall_fancy(frame) */ switch (argsize >> 2) { case 6: - args[5] = frame.tf_ebp; + args[5] = frame->tf_ebp; case 5: - args[4] = frame.tf_edi; + args[4] = frame->tf_edi; case 4: - args[3] = frame.tf_esi; + args[3] = frame->tf_esi; case 3: - args[2] = frame.tf_edx; + args[2] = frame->tf_edx; case 2: - args[1] = frame.tf_ecx; + args[1] = frame->tf_ecx; case 1: - args[0] = frame.tf_ebx; + args[0] = frame->tf_ebx; break; default: panic("linux syscall %d bogus argument size %d", @@ -246,8 +246,8 @@ linux_syscall_fancy(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -255,7 +255,7 @@ linux_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ @@ -263,8 +263,8 @@ linux_syscall_fancy(frame) default: bad: error = native_to_linux_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/i386/i386/locore.S b/sys/arch/i386/i386/locore.S index 4bf3de8605bc..3a34ec8bb708 100644 --- a/sys/arch/i386/i386/locore.S +++ b/sys/arch/i386/i386/locore.S @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.14 2003/08/11 21:15:50 fvdl Exp $ */ +/* $NetBSD: locore.S,v 1.15 2003/08/20 21:48:37 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -2143,7 +2143,9 @@ syscall1: movl CPUVAR(CURLWP),%edx movl %esp,L_MD_REGS(%edx) # save pointer to frame movl L_PROC(%edx),%edx + pushl %esp call *P_MD_SYSCALL(%edx) # get pointer to syscall() function + addl $4,%esp 2: /* Check for ASTs on exit to user mode. */ cli CHECK_ASTPENDING(%eax) @@ -2152,7 +2154,9 @@ syscall1: CLEAR_ASTPENDING(%eax) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp jmp 2b #ifndef DIAGNOSTIC 1: INTRFASTEXIT diff --git a/sys/arch/i386/i386/mach_sigcode.S b/sys/arch/i386/i386/mach_sigcode.S index f8c33a68b849..bea82da6ebc0 100644 --- a/sys/arch/i386/i386/mach_sigcode.S +++ b/sys/arch/i386/i386/mach_sigcode.S @@ -1,4 +1,4 @@ -/* $NetBSD: mach_sigcode.S,v 1.4 2003/08/07 16:27:54 agc Exp $ */ +/* $NetBSD: mach_sigcode.S,v 1.5 2003/08/20 21:48:37 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -121,6 +121,8 @@ IDTVEC(mach_trap) CLEAR_ASTPENDING(%eax) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp jmp 2b 1: INTRFASTEXIT diff --git a/sys/arch/i386/i386/mach_syscall.c b/sys/arch/i386/i386/mach_syscall.c index afd7106bc9a9..2418ebe74d75 100644 --- a/sys/arch/i386/i386/mach_syscall.c +++ b/sys/arch/i386/i386/mach_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: mach_syscall.c,v 1.8 2003/01/22 17:48:18 christos Exp $ */ +/* $NetBSD: mach_syscall.c,v 1.9 2003/08/20 21:48:38 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.8 2003/01/22 17:48:18 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.9 2003/08/20 21:48:38 fvdl Exp $"); #include "opt_syscall_debug.h" #include "opt_vm86.h" @@ -66,8 +66,8 @@ __KERNEL_RCSID(0, "$NetBSD: mach_syscall.c,v 1.8 2003/01/22 17:48:18 christos Ex #include void mach_syscall_intern __P((struct proc *)); -void mach_syscall_plain __P((struct trapframe)); -void mach_syscall_fancy __P((struct trapframe)); +void mach_syscall_plain __P((struct trapframe *)); +void mach_syscall_fancy __P((struct trapframe *)); extern struct sysent mach_sysent[]; @@ -98,7 +98,7 @@ mach_syscall_intern(p) */ void mach_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -110,8 +110,8 @@ mach_syscall_plain(frame) uvmexp.syscalls++; - code = frame.tf_eax; - params = (caddr_t)frame.tf_esp + sizeof(int); + code = frame->tf_eax; + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -162,9 +162,9 @@ mach_syscall_plain(frame) error = (*callp->sy_call)(l, args, rval); switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -172,15 +172,15 @@ mach_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -192,7 +192,7 @@ mach_syscall_plain(frame) void mach_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { caddr_t params; const struct sysent *callp; @@ -204,9 +204,9 @@ mach_syscall_fancy(frame) uvmexp.syscalls++; - code = frame.tf_eax; + code = frame->tf_eax; realcode = code; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -256,9 +256,9 @@ mach_syscall_fancy(frame) error = (*callp->sy_call)(l, args, rval); switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -266,15 +266,15 @@ mach_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 3451b3a1bc33..c5a5f2305060 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.531 2003/08/17 14:23:16 kochi Exp $ */ +/* $NetBSD: machdep.c,v 1.532 2003/08/20 21:48:38 fvdl Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc. @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.531 2003/08/17 14:23:16 kochi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.532 2003/08/20 21:48:38 fvdl Exp $"); #include "opt_cputype.h" #include "opt_ddb.h" @@ -798,7 +798,7 @@ sys___sigreturn14(l, v, retval) tf = l->l_md.md_regs; #ifdef VM86 if (context.sc_eflags & PSL_VM) { - void syscall_vm86 __P((struct trapframe)); + void syscall_vm86 __P((struct trapframe *)); tf->tf_vm86_gs = context.sc_gs; tf->tf_vm86_fs = context.sc_fs; diff --git a/sys/arch/i386/i386/process_machdep.c b/sys/arch/i386/i386/process_machdep.c index 624fd5ef978f..08431d9f62dc 100644 --- a/sys/arch/i386/i386/process_machdep.c +++ b/sys/arch/i386/i386/process_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: process_machdep.c,v 1.48 2003/06/29 22:28:26 fvdl Exp $ */ +/* $NetBSD: process_machdep.c,v 1.49 2003/08/20 21:48:40 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000, 2001 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.48 2003/06/29 22:28:26 fvdl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.49 2003/08/20 21:48:40 fvdl Exp $"); #include "opt_vm86.h" #include "npx.h" @@ -301,7 +301,7 @@ process_write_regs(struct lwp *l, struct reg *regs) #ifdef VM86 if (regs->r_eflags & PSL_VM) { - void syscall_vm86 __P((struct trapframe)); + void syscall_vm86 __P((struct trapframe *)); tf->tf_vm86_gs = regs->r_gs; tf->tf_vm86_fs = regs->r_fs; diff --git a/sys/arch/i386/i386/spl.S b/sys/arch/i386/i386/spl.S index 8a881850554a..a1280074a712 100644 --- a/sys/arch/i386/i386/spl.S +++ b/sys/arch/i386/i386/spl.S @@ -1,4 +1,4 @@ -/* $NetBSD: spl.S,v 1.6 2003/01/17 23:10:32 thorpej Exp $ */ +/* $NetBSD: spl.S,v 1.7 2003/08/20 21:48:41 fvdl Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -162,7 +162,9 @@ IDTVEC(doreti) sti movl $T_ASTFLT,TF_TRAPNO(%esp) /* XXX undo later.. */ /* Pushed T_ASTFLT into tf_trapno on entry. */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp cli jmp 5b 3: diff --git a/sys/arch/i386/i386/svr4_machdep.c b/sys/arch/i386/i386/svr4_machdep.c index e880faad379f..18e207e3d211 100644 --- a/sys/arch/i386/i386/svr4_machdep.c +++ b/sys/arch/i386/i386/svr4_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_machdep.c,v 1.67 2003/07/27 14:14:44 mrg Exp $ */ +/* $NetBSD: svr4_machdep.c,v 1.68 2003/08/20 21:48:41 fvdl Exp $ */ /*- * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.67 2003/07/27 14:14:44 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_machdep.c,v 1.68 2003/08/20 21:48:41 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_vm86.h" @@ -218,7 +218,7 @@ svr4_setmcontext(l, mc, flags) tf = l->l_md.md_regs; #ifdef VM86 if (r[SVR4_X86_EFL] & PSL_VM) { - void syscall_vm86 __P((struct trapframe)); + void syscall_vm86 __P((struct trapframe *)); tf->tf_vm86_gs = r[SVR4_X86_GS]; tf->tf_vm86_fs = r[SVR4_X86_FS]; diff --git a/sys/arch/i386/i386/svr4_sigcode.S b/sys/arch/i386/i386/svr4_sigcode.S index 6d281323e543..459167d6ba44 100644 --- a/sys/arch/i386/i386/svr4_sigcode.S +++ b/sys/arch/i386/i386/svr4_sigcode.S @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_sigcode.S,v 1.5 2003/08/07 16:27:56 agc Exp $ */ +/* $NetBSD: svr4_sigcode.S,v 1.6 2003/08/20 21:48:42 fvdl Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -115,6 +115,8 @@ IDTVEC(svr4_fasttrap) CLEAR_ASTPENDING(%eax) sti /* Pushed T_ASTFLT into tf_trapno on entry. */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp jmp 2b 1: INTRFASTEXIT diff --git a/sys/arch/i386/i386/svr4_syscall.c b/sys/arch/i386/i386/svr4_syscall.c index 2bdd5f4d2930..7fc3a3fdf619 100644 --- a/sys/arch/i386/i386/svr4_syscall.c +++ b/sys/arch/i386/i386/svr4_syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: svr4_syscall.c,v 1.20 2003/01/17 23:10:32 thorpej Exp $ */ +/* $NetBSD: svr4_syscall.c,v 1.21 2003/08/20 21:48:42 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.20 2003/01/17 23:10:32 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.21 2003/08/20 21:48:42 fvdl Exp $"); #if defined(_KERNEL_OPT) #include "opt_syscall_debug.h" @@ -70,8 +70,8 @@ __KERNEL_RCSID(0, "$NetBSD: svr4_syscall.c,v 1.20 2003/01/17 23:10:32 thorpej Ex #include #include -void svr4_syscall_plain __P((struct trapframe)); -void svr4_syscall_fancy __P((struct trapframe)); +void svr4_syscall_plain __P((struct trapframe *)); +void svr4_syscall_fancy __P((struct trapframe *)); extern struct sysent svr4_sysent[]; void @@ -100,7 +100,7 @@ svr4_syscall_intern(p) */ void svr4_syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -112,9 +112,9 @@ svr4_syscall_plain(frame) uvmexp.syscalls++; l = curlwp; - code = frame.tf_eax; + code = frame->tf_eax; callp = svr4_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -150,9 +150,9 @@ svr4_syscall_plain(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -160,7 +160,7 @@ svr4_syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ @@ -168,8 +168,8 @@ svr4_syscall_plain(frame) default: bad: error = native_to_svr4_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -186,7 +186,7 @@ svr4_syscall_plain(frame) */ void svr4_syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -200,9 +200,9 @@ svr4_syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = svr4_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -236,9 +236,9 @@ svr4_syscall_fancy(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -246,7 +246,7 @@ svr4_syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ @@ -254,8 +254,8 @@ svr4_syscall_fancy(frame) default: bad: error = native_to_svr4_errno[error]; - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } diff --git a/sys/arch/i386/i386/syscall.c b/sys/arch/i386/i386/syscall.c index c6df14761461..421c8852015f 100644 --- a/sys/arch/i386/i386/syscall.c +++ b/sys/arch/i386/i386/syscall.c @@ -1,4 +1,4 @@ -/* $NetBSD: syscall.c,v 1.21 2003/08/04 18:43:38 drochner Exp $ */ +/* $NetBSD: syscall.c,v 1.22 2003/08/20 21:48:42 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.21 2003/08/04 18:43:38 drochner Exp $"); +__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.22 2003/08/20 21:48:42 fvdl Exp $"); #include "opt_syscall_debug.h" #include "opt_vm86.h" @@ -66,10 +66,10 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.21 2003/08/04 18:43:38 drochner Exp $" #include void syscall_intern __P((struct proc *)); -void syscall_plain __P((struct trapframe)); -void syscall_fancy __P((struct trapframe)); +void syscall_plain __P((struct trapframe *)); +void syscall_fancy __P((struct trapframe *)); #ifdef VM86 -void syscall_vm86 __P((struct trapframe)); +void syscall_vm86 __P((struct trapframe *)); #endif void @@ -98,7 +98,7 @@ syscall_intern(p) */ void syscall_plain(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -112,9 +112,9 @@ syscall_plain(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -158,9 +158,9 @@ syscall_plain(frame) switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -168,15 +168,15 @@ syscall_plain(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -188,7 +188,7 @@ syscall_plain(frame) void syscall_fancy(frame) - struct trapframe frame; + struct trapframe *frame; { register caddr_t params; register const struct sysent *callp; @@ -202,9 +202,9 @@ syscall_fancy(frame) l = curlwp; p = l->l_proc; - code = frame.tf_eax; + code = frame->tf_eax; callp = p->p_emul->e_sysent; - params = (caddr_t)frame.tf_esp + sizeof(int); + params = (caddr_t)frame->tf_esp + sizeof(int); switch (code) { case SYS_syscall: @@ -247,9 +247,9 @@ syscall_fancy(frame) KERNEL_PROC_UNLOCK(l); switch (error) { case 0: - frame.tf_eax = rval[0]; - frame.tf_edx = rval[1]; - frame.tf_eflags &= ~PSL_C; /* carry bit */ + frame->tf_eax = rval[0]; + frame->tf_edx = rval[1]; + frame->tf_eflags &= ~PSL_C; /* carry bit */ break; case ERESTART: /* @@ -257,15 +257,15 @@ syscall_fancy(frame) * the kernel through the trap or call gate. We pushed the * size of the instruction into tf_err on entry. */ - frame.tf_eip -= frame.tf_err; + frame->tf_eip -= frame->tf_err; break; case EJUSTRETURN: /* nothing to do */ break; default: bad: - frame.tf_eax = error; - frame.tf_eflags |= PSL_C; /* carry bit */ + frame->tf_eax = error; + frame->tf_eflags |= PSL_C; /* carry bit */ break; } @@ -277,7 +277,7 @@ syscall_fancy(frame) #ifdef VM86 void syscall_vm86(frame) - struct trapframe frame; + struct trapframe *frame; { struct lwp *l; struct proc *p; diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 0da7ba8cc942..6d698283546b 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.183 2003/08/07 16:27:56 agc Exp $ */ +/* $NetBSD: trap.c,v 1.184 2003/08/20 21:48:43 fvdl Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.183 2003/08/07 16:27:56 agc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.184 2003/08/20 21:48:43 fvdl Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -126,7 +126,7 @@ __KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.183 2003/08/07 16:27:56 agc Exp $"); #include "npx.h" -void trap __P((struct trapframe)); +void trap __P((struct trapframe *)); void trap_tss __P((struct i386tss *, int, int)); #if defined(I386_CPU) int trapwrite __P((unsigned)); @@ -196,7 +196,7 @@ trap_tss(struct i386tss *tss, int trapno, int code) tf.tf_eflags = tss->__tss_eflags; tf.tf_esp = tss->tss_esp; tf.tf_ss = tss->__tss_ss; - trap(tf); + trap(&tf); } /* @@ -210,11 +210,11 @@ trap_tss(struct i386tss *tss, int trapno, int code) /*ARGSUSED*/ void trap(frame) - struct trapframe frame; + struct trapframe *frame; { struct lwp *l = curlwp; struct proc *p = l ? l->l_proc : 0; - int type = frame.tf_trapno; + int type = frame->tf_trapno; struct pcb *pcb; extern char fusubail[], resume_iret[], resume_pop_ds[], resume_pop_es[], @@ -232,17 +232,17 @@ trap(frame) #ifdef DEBUG if (trapdebug) { printf("trap %d code %x eip %x cs %x eflags %x cr2 %x cpl %x\n", - frame.tf_trapno, frame.tf_err, frame.tf_eip, frame.tf_cs, - frame.tf_eflags, rcr2(), curcpu()->ci_ilevel); + frame->tf_trapno, frame->tf_err, frame->tf_eip, frame->tf_cs, + frame->tf_eflags, rcr2(), curcpu()->ci_ilevel); printf("curlwp %p%s", curlwp, curlwp ? " " : "\n"); if (curlwp) printf("pid %d lid %d\n", l->l_proc->p_pid, l->l_lid); } #endif - if (!KVM86MODE && !KERNELMODE(frame.tf_cs, frame.tf_eflags)) { + if (!KVM86MODE && !KERNELMODE(frame->tf_cs, frame->tf_eflags)) { type |= T_USER; - l->l_md.md_regs = &frame; + l->l_md.md_regs = frame; pcb->pcb_cr2 = 0; } @@ -266,7 +266,7 @@ trap(frame) } #endif #ifdef KGDB - if (kgdb_trap(type, &frame)) + if (kgdb_trap(type, frame)) return; else { /* @@ -280,17 +280,17 @@ trap(frame) } #endif #ifdef DDB - if (kdb_trap(type, 0, &frame)) + if (kdb_trap(type, 0, frame)) return; #endif - if (frame.tf_trapno < trap_types) - printf("fatal %s", trap_type[frame.tf_trapno]); + if (frame->tf_trapno < trap_types) + printf("fatal %s", trap_type[frame->tf_trapno]); else - printf("unknown trap %d", frame.tf_trapno); + printf("unknown trap %d", frame->tf_trapno); printf(" in %s mode\n", (type & T_USER) ? "user" : "supervisor"); printf("trap type %d code %x eip %x cs %x eflags %x cr2 %x ilevel %x\n", - type, frame.tf_err, frame.tf_eip, frame.tf_cs, - frame.tf_eflags, rcr2(), curcpu()->ci_ilevel); + type, frame->tf_err, frame->tf_eip, frame->tf_cs, + frame->tf_eflags, rcr2(), curcpu()->ci_ilevel); panic("trap"); /*NOTREACHED*/ @@ -298,7 +298,7 @@ trap(frame) case T_PROTFLT: #ifdef KVM86 if (KVM86MODE) { - kvm86_gpfault(&frame); + kvm86_gpfault(frame); return; } #endif @@ -312,8 +312,8 @@ trap(frame) copyefault: error = EFAULT; copyfault: - frame.tf_eip = (int)pcb->pcb_onfault; - frame.tf_eax = error; + frame->tf_eip = (int)pcb->pcb_onfault; + frame->tf_eax = error; return; } @@ -347,31 +347,31 @@ copyfault: * at this point is the same as on exit from a `slow' * interrupt. */ - switch (*(u_char *)frame.tf_eip) { + switch (*(u_char *)frame->tf_eip) { case 0xcf: /* iret */ - vframe = (void *)((int)&frame.tf_esp - + vframe = (void *)((int)&frame->tf_esp - offsetof(struct trapframe, tf_eip)); resume = (int)resume_iret; break; case 0x1f: /* popl %ds */ - vframe = (void *)((int)&frame.tf_esp - + vframe = (void *)((int)&frame->tf_esp - offsetof(struct trapframe, tf_ds)); resume = (int)resume_pop_ds; break; case 0x07: /* popl %es */ - vframe = (void *)((int)&frame.tf_esp - + vframe = (void *)((int)&frame->tf_esp - offsetof(struct trapframe, tf_es)); resume = (int)resume_pop_es; break; case 0x0f: /* 0x0f prefix */ - switch (*(u_char *)(frame.tf_eip+1)) { + switch (*(u_char *)(frame->tf_eip+1)) { case 0xa1: /* popl %fs */ - vframe = (void *)((int)&frame.tf_esp - + vframe = (void *)((int)&frame->tf_esp - offsetof(struct trapframe, tf_fs)); resume = (int)resume_pop_fs; break; case 0xa9: /* popl %gs */ - vframe = (void *)((int)&frame.tf_esp - + vframe = (void *)((int)&frame->tf_esp - offsetof(struct trapframe, tf_gs)); resume = (int)resume_pop_gs; break; @@ -383,12 +383,12 @@ copyfault: if (KERNELMODE(vframe->tf_cs, vframe->tf_eflags)) goto we_re_toast; - frame.tf_eip = resume; + frame->tf_eip = resume; return; case T_PROTFLT|T_USER: /* protection fault */ #ifdef VM86 - if (frame.tf_eflags & PSL_VM) { + if (frame->tf_eflags & PSL_VM) { vm86_gpfault(l, type & ~T_USER); goto out; } @@ -426,8 +426,8 @@ copyfault: case T_DNA|T_USER: { #ifdef MATH_EMULATE int rv; - if ((rv = math_emulate(&frame)) == 0) { - if (frame.tf_eflags & PSL_T) + if ((rv = math_emulate(frame)) == 0) { + if (frame->tf_eflags & PSL_T) goto trace; return; } @@ -456,7 +456,7 @@ copyfault: case T_ARITHTRAP|T_USER: KERNEL_PROC_LOCK(l); (*p->p_emul->e_trapsignal)(l, SIGFPE, - frame.tf_err & ~TC_FLAGMASK); + frame->tf_err & ~TC_FLAGMASK); KERNEL_PROC_UNLOCK(l); goto out; @@ -477,7 +477,7 @@ copyfault: #if 0 /* XXX - check only applies to 386's and 486's with WP off */ - if (frame.tf_err & PGEX_P) + if (frame->tf_err & PGEX_P) goto we_re_toast; #endif cr2 = rcr2(); @@ -512,7 +512,7 @@ copyfault: map = kernel_map; else map = &vm->vm_map; - if (frame.tf_err & PGEX_W) + if (frame->tf_err & PGEX_W) ftype = VM_PROT_WRITE; else ftype = VM_PROT_READ; @@ -590,10 +590,10 @@ copyfault: case T_TRCTRAP: /* Check whether they single-stepped into a lcall. */ - if (frame.tf_eip == (int)IDTVEC(osyscall)) + if (frame->tf_eip == (int)IDTVEC(osyscall)) return; - if (frame.tf_eip == (int)IDTVEC(osyscall) + 1) { - frame.tf_eflags &= ~PSL_T; + if (frame->tf_eip == (int)IDTVEC(osyscall) + 1) { + frame->tf_eflags &= ~PSL_T; return; } goto we_re_toast; @@ -607,7 +607,7 @@ copyfault: * Don't go single-stepping into a RAS. */ if ((p->p_nras == 0) || - (ras_lookup(p, (caddr_t)frame.tf_eip) == (caddr_t)-1)) { + (ras_lookup(p, (caddr_t)frame->tf_eip) == (caddr_t)-1)) { KERNEL_PROC_LOCK(l); (*p->p_emul->e_trapsignal)(l, SIGTRAP, type & ~T_USER); KERNEL_PROC_UNLOCK(l); @@ -621,11 +621,11 @@ copyfault: printf ("NMI ... going to debugger\n"); #ifdef KGDB - if (kgdb_trap(type, &frame)) + if (kgdb_trap(type, frame)) return; #endif #ifdef DDB - if (kdb_trap(type, 0, &frame)) + if (kdb_trap(type, 0, frame)) return; #endif #endif /* KGDB || DDB */ diff --git a/sys/arch/i386/i386/vector.S b/sys/arch/i386/i386/vector.S index 7187ca8a4bdd..f33dd00a2b63 100644 --- a/sys/arch/i386/i386/vector.S +++ b/sys/arch/i386/i386/vector.S @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.9 2003/06/23 11:01:22 martin Exp $ */ +/* $NetBSD: vector.S,v 1.10 2003/08/20 21:48:44 fvdl Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -235,8 +235,8 @@ IDTVEC(intr_lapic_ltimer) #endif /* NLAPIC > 0 */ #ifdef MULTIPROCESSOR -#define LOCK_KERNEL call _C_LABEL(x86_intlock) -#define UNLOCK_KERNEL call _C_LABEL(x86_intunlock) +#define LOCK_KERNEL pushl %esp ; call _C_LABEL(x86_intlock) ; addl $4,%esp +#define UNLOCK_KERNEL pushl %esp ; call _C_LABEL(x86_intunlock) ; addl $4,%esp #else #define LOCK_KERNEL #define UNLOCK_KERNEL @@ -857,7 +857,9 @@ calltrap: #ifdef DIAGNOSTIC movl CPUVAR(ILEVEL),%ebx #endif /* DIAGNOSTIC */ + pushl %esp call _C_LABEL(trap) + addl $4,%esp 2: /* Check for ASTs on exit to user mode. */ cli CHECK_ASTPENDING(%eax) @@ -871,7 +873,9 @@ calltrap: 5: CLEAR_ASTPENDING(%eax) sti movl $T_ASTFLT,TF_TRAPNO(%esp) + pushl %esp call _C_LABEL(trap) + addl $4,%esp jmp 2b #ifndef DIAGNOSTIC 1: INTRFASTEXIT diff --git a/sys/arch/i386/include/proc.h b/sys/arch/i386/include/proc.h index fabdc465728a..bfd494301e2a 100644 --- a/sys/arch/i386/include/proc.h +++ b/sys/arch/i386/include/proc.h @@ -1,4 +1,4 @@ -/* $NetBSD: proc.h,v 1.21 2003/08/07 16:27:59 agc Exp $ */ +/* $NetBSD: proc.h,v 1.22 2003/08/20 21:48:45 fvdl Exp $ */ /* * Copyright (c) 1991 Regents of the University of California. @@ -55,7 +55,7 @@ struct mdlwp { struct mdproc { /* Syscall handling function */ int md_flags; - void (*md_syscall) __P((struct trapframe)); + void (*md_syscall) __P((struct trapframe *)); __volatile int md_astpending; /* AST pending for this process */ }; diff --git a/sys/arch/x86/include/intr.h b/sys/arch/x86/include/intr.h index 0668d0bd2e19..7e0b4ff66730 100644 --- a/sys/arch/x86/include/intr.h +++ b/sys/arch/x86/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.5 2003/06/23 14:59:21 martin Exp $ */ +/* $NetBSD: intr.h,v 1.6 2003/08/20 21:48:46 fvdl Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -264,8 +264,8 @@ int x86_send_ipi(struct cpu_info *, int); void x86_broadcast_ipi(int); void x86_multicast_ipi(int, int); void x86_ipi_handler(void); -void x86_intlock(struct intrframe); -void x86_intunlock(struct intrframe); +void x86_intlock(struct intrframe *); +void x86_intunlock(struct intrframe *); void x86_softintlock(void); void x86_softintunlock(void); diff --git a/sys/arch/x86/x86/intr.c b/sys/arch/x86/x86/intr.c index db7999625720..00df145b3f33 100644 --- a/sys/arch/x86/x86/intr.c +++ b/sys/arch/x86/x86/intr.c @@ -1,4 +1,4 @@ -/* $NetBSD: intr.c,v 1.4 2003/07/14 22:32:39 lukem Exp $ */ +/* $NetBSD: intr.c,v 1.5 2003/08/20 21:48:47 fvdl Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.4 2003/07/14 22:32:39 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.5 2003/08/20 21:48:47 fvdl Exp $"); #include "opt_multiprocessor.h" @@ -626,16 +626,16 @@ cpu_intr_init(struct cpu_info *ci) #ifdef MULTIPROCESSOR void -x86_intlock(struct intrframe iframe) +x86_intlock(struct intrframe *iframe) { - if (iframe.if_ppl < IPL_SCHED) + if (iframe->if_ppl < IPL_SCHED) spinlockmgr(&kernel_lock, LK_EXCLUSIVE|LK_CANRECURSE, 0); } void -x86_intunlock(struct intrframe iframe) +x86_intunlock(struct intrframe *iframe) { - if (iframe.if_ppl < IPL_SCHED) + if (iframe->if_ppl < IPL_SCHED) spinlockmgr(&kernel_lock, LK_RELEASE, 0); }