diff options
author | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-09-30 06:22:01 +0000 |
---|---|---|
committer | Takuya ASADA <syuu@cvs.openbsd.org> | 2009-09-30 06:22:01 +0000 |
commit | 972b9cd3934a78937f80550d0ebfceea4d010956 (patch) | |
tree | 1b4429a3e7afc39f690f437b5175ddb7e36966e9 /sys/arch | |
parent | ea936621b858439241476551a88c4c5a040de69d (diff) |
curproc, curprocpaddr moved into cpu_info
OK miod@
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/mips64/include/asm.h | 14 | ||||
-rw-r--r-- | sys/arch/mips64/include/cpu.h | 3 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/context.S | 14 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/exception.S | 40 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/lcore_access.S | 44 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/lcore_ddb.S | 26 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/lcore_float.S | 13 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/tlbhandler.S | 14 | ||||
-rw-r--r-- | sys/arch/sgi/include/asm.h | 11 | ||||
-rw-r--r-- | sys/arch/sgi/include/cpu.h | 10 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/genassym.cf | 3 | ||||
-rw-r--r-- | sys/arch/sgi/sgi/machdep.c | 5 |
12 files changed, 128 insertions, 69 deletions
diff --git a/sys/arch/mips64/include/asm.h b/sys/arch/mips64/include/asm.h index e87474dfc1b..778a0635fe2 100644 --- a/sys/arch/mips64/include/asm.h +++ b/sys/arch/mips64/include/asm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asm.h,v 1.7 2004/10/20 12:49:15 pefo Exp $ */ +/* $OpenBSD: asm.h,v 1.8 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2001-2002 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -293,4 +293,16 @@ x: ; \ .asciiz str; \ .align 3 +#ifdef MULTIPROCESSOR +#define GET_CPU_INFO(ci, tmp) \ + HW_CPU_NUMBER(tmp); \ + PTR_SLL tmp, tmp, LOGREGSZ; \ + LA ci, cpu_info; \ + PTR_ADDU ci, ci, tmp; \ + PTR_L ci, 0(ci) +#else /* MULTIPROCESSOR */ +#define GET_CPU_INFO(ci, tmp) \ + LA ci, cpu_info_primary +#endif /* MULTIPROCESSOR */ + #endif /* !_MIPS_ASM_H */ diff --git a/sys/arch/mips64/include/cpu.h b/sys/arch/mips64/include/cpu.h index cf133a71d95..a74da48580f 100644 --- a/sys/arch/mips64/include/cpu.h +++ b/sys/arch/mips64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.36 2009/09/15 04:54:31 syuu Exp $ */ +/* $OpenBSD: cpu.h,v 1.37 2009/09/30 06:22:00 syuu Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -367,6 +367,7 @@ struct cpu_info { struct cpu_info *ci_self; /* pointer to this structure */ struct cpu_info *ci_next; /* next cpu */ struct proc *ci_curproc; + struct user *ci_curprocpaddr; struct schedstate_percpu ci_schedstate; diff --git a/sys/arch/mips64/mips64/context.S b/sys/arch/mips64/mips64/context.S index a57db3165d9..088e96e31cc 100644 --- a/sys/arch/mips64/mips64/context.S +++ b/sys/arch/mips64/mips64/context.S @@ -1,4 +1,4 @@ -/* $OpenBSD: context.S,v 1.23 2009/08/06 21:11:39 miod Exp $ */ +/* $OpenBSD: context.S,v 1.24 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -39,8 +39,6 @@ #include "assym.h" -#define curproc (cpu_info_primary + CI_CURPROC) - .set mips3 .set noreorder # Noreorder is default style! @@ -105,7 +103,8 @@ END(cpu_idle_cycle) * cpu_switchto(struct proc *oldproc, struct proc *newproc) */ NON_LEAF(cpu_switchto, FRAMESZ(CF_SZ), ra) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t3) + PTR_L t3, CI_CURPROCPADDR(t1) REG_S sp, PCB_CONTEXT+8*REGSZ(t3) # save old sp PTR_SUBU sp, sp, FRAMESZ(CF_SZ) @@ -148,9 +147,10 @@ NON_LEAF(cpu_switchto, FRAMESZ(CF_SZ), ra) move a0, s0 PTR_L t3, P_ADDR(s0) # get uarea pointer. - PTR_S s0, curproc # set curproc - PTR_S t3, curprocpaddr - + GET_CPU_INFO(t1, t0) + PTR_S s0, CI_CURPROC(t1) # set curproc + PTR_S t3, CI_CURPROCPADDR(t1) + li t1, SONPROC sb t1, P_STAT(s0) # set to onproc. diff --git a/sys/arch/mips64/mips64/exception.S b/sys/arch/mips64/mips64/exception.S index 6f3c8dccfec..4c6af38e399 100644 --- a/sys/arch/mips64/mips64/exception.S +++ b/sys/arch/mips64/mips64/exception.S @@ -1,4 +1,4 @@ -/* $OpenBSD: exception.S,v 1.21 2009/09/15 04:54:31 syuu Exp $ */ +/* $OpenBSD: exception.S,v 1.22 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2002-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -47,8 +47,6 @@ #include "assym.h" -#define curproc (cpu_info_primary + CI_CURPROC) - .set mips3 .data @@ -221,7 +219,8 @@ END(k_intr) NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra) .set noat .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ)) - PTR_L k0, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k0, CI_CURPROCPADDR(k1) SAVE_CPU(k0, 0) #if 0 cfc0 v1, COP_0_ICR @@ -248,12 +247,13 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra) ITLBNOPFIX 0: - PTR_L t0, curproc + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROC(t1) lw v0, P_ASTPENDING(t0) # any pending AST? beq v0, zero, 4f nop - PTR_L t0, P_ADDR(t0) # curprocpaddr + PTR_L t0, CI_CURPROCPADDR(t1) # curprocpaddr SAVE_CPU_SREG(t0, 0) #ifdef PERFCNTRS @@ -287,7 +287,8 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra) lw t0, cpu_is_rm7k beqz t0, 1f # not an RM7K. Don't do perf setup. - PTR_L t1, curproc # set up rm7k. + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROC(t1) # set up rm7k. ld v0, P_WATCH_1(t1) dmtc0 v0, COP_0_WATCH_1 ld v0, P_WATCH_2(t1) @@ -303,7 +304,8 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra) nop;nop;nop;nop 1: #endif - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) RESTORE_CPU_SREG(t0, 0) b 0b @@ -325,7 +327,8 @@ NNON_LEAF(u_intr, FRAMESZ(CF_SZ), ra) mtc0 t0, COP_0_STATUS_REG # must set exception level bit. ITLBNOPFIX - PTR_L k0, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k0, CI_CURPROCPADDR(k1) RESTORE_REG(a3, CPL, k0, 0) sw a3, cpl .set noat @@ -396,7 +399,8 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) .set noat .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ)) - PTR_L k0, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k0, CI_CURPROCPADDR(k1) SAVE_CPU(k0, 0) #if 0 cfc0 v1, COP_0_ICR @@ -415,7 +419,7 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) beqz t0, 1f # not an RM7K. Don't do perf save. mfc0 v0, COP_0_PC_CTRL - PTR_L t0, curproc + PTR_L t0, CI_CURPROC(k1) sw v0, P_PC_CTRL(t0) dmfc0 v0, COP_0_WATCH_1 dmfc0 v1, COP_0_WATCH_2 @@ -434,7 +438,8 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) PTR_S a3, CF_RA_OFFS(sp) # for debugging 0: - PTR_L t0, curproc + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROC(t1) lw v0, P_ASTPENDING(t0) # any pending AST? beq v0, zero, 4f nop @@ -445,7 +450,8 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) jal ast nop - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) RESTORE_CPU_SREG(t0, 0) b 0b @@ -456,7 +462,7 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) lw t0, cpu_is_rm7k beqz t0, 1f # not an RM7K. Don't do perf setup. - LOAD t0, curproc # set up rm7k. + LOAD t0, CI_CURPROC(k1) # set up rm7k. ld v0, P_WATCH_1(t0) dmtc0 v0, COP_0_WATCH_1 ld v0, P_WATCH_2(t0) @@ -482,7 +488,8 @@ NNON_LEAF(u_general, FRAMESZ(CF_SZ), ra) mtc0 t0, COP_0_STATUS_REG # must set exception level bit. ITLBNOPFIX - PTR_L k0, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k0, CI_CURPROCPADDR(k1) RESTORE_REG(a3, CPL, k0, 0) sw a3, cpl .set noat @@ -571,7 +578,8 @@ LEAF(proc_trampoline, 0) ITLBNOPFIX .set noat - PTR_L k0, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k0, CI_CURPROCPADDR(k1) RESTORE_CPU_SREG(k0, 0) RESTORE_REG(a0, PC, k0, 0) #if 0 diff --git a/sys/arch/mips64/mips64/lcore_access.S b/sys/arch/mips64/mips64/lcore_access.S index 88644bf3aab..15eea352aae 100644 --- a/sys/arch/mips64/mips64/lcore_access.S +++ b/sys/arch/mips64/mips64/lcore_access.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_access.S,v 1.17 2009/05/22 20:37:53 miod Exp $ */ +/* $OpenBSD: lcore_access.S,v 1.18 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -190,12 +190,14 @@ NON_LEAF(copyinstr, FRAMESZ(CF_SZ), ra) PTR_S ra, CF_RA_OFFS(sp) blt a0, zero, _copyerr # make sure address is in user space LI v0, KT_COPYERR - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) jal copystr sw v0, PCB_ONFAULT(t3) PTR_L ra, CF_RA_OFFS(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) sw zero, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ) j ra @@ -218,12 +220,14 @@ NON_LEAF(copyoutstr, FRAMESZ(CF_SZ), ra) PTR_S ra, CF_RA_OFFS(sp) blt a1, zero, _copyerr # make sure address is in user space LI v0, KT_COPYERR - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) jal copystr sw v0, PCB_ONFAULT(t3) PTR_L ra, CF_RA_OFFS(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) sw zero, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ) j ra @@ -243,12 +247,14 @@ NON_LEAF(copyin, FRAMESZ(CF_SZ), ra) PTR_S ra, CF_RA_OFFS(sp) blt a0, zero, _copyerr # make sure address is in user space li v0, KT_COPYERR - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) jal bcopy sw v0, PCB_ONFAULT(t3) PTR_L ra, CF_RA_OFFS(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) sw zero, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ) j ra @@ -268,12 +274,14 @@ NON_LEAF(copyout, FRAMESZ(CF_SZ), ra) PTR_S ra, CF_RA_OFFS(sp) blt a1, zero, _copyerr # make sure address is in user space li v0, KT_COPYERR - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) jal bcopy sw v0, PCB_ONFAULT(t3) PTR_L ra, CF_RA_OFFS(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) sw zero, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ) j ra @@ -282,7 +290,8 @@ END(copyout) _copyerr: PTR_L ra, CF_RA_OFFS(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) sw zero, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ) j ra @@ -295,7 +304,8 @@ NON_LEAF(kcopy, FRAMESZ(CF_SZ + REGSZ), ra) PTR_SUBU sp, sp, FRAMESZ(CF_SZ + REGSZ) .mask 0x80000000, (CF_RA_OFFS - FRAMESZ(CF_SZ + REGSZ)) PTR_S ra, CF_RA_OFFS + REGSZ(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) lw v1, PCB_ONFAULT(t3) li v0, KT_KCOPYERR PTR_S v1, CF_ARGSZ(sp) # save old pcb_onfault @@ -303,7 +313,8 @@ NON_LEAF(kcopy, FRAMESZ(CF_SZ + REGSZ), ra) sw v0, PCB_ONFAULT(t3) PTR_L v0, CF_ARGSZ(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) PTR_L ra, CF_RA_OFFS + REGSZ(sp) sw v0, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ + REGSZ) @@ -313,7 +324,8 @@ END(kcopy) _kcopyerr: PTR_L v0, CF_ARGSZ(sp) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) PTR_L ra, CF_RA_OFFS + REGSZ(sp) sw v0, PCB_ONFAULT(t3) PTR_ADDU sp, sp, FRAMESZ(CF_SZ + REGSZ) @@ -327,7 +339,8 @@ _kcopyerr: */ LEAF(guarded_read_4, 0) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) li v0, KT_GUARDERR lw v1, PCB_ONFAULT(t3) sw v0, PCB_ONFAULT(t3) @@ -341,7 +354,8 @@ LEAF(guarded_read_4, 0) END(guarded_read_4) LEAF(guarded_write_4, 0) - PTR_L t3, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t3, CI_CURPROCPADDR(t1) li v0, KT_GUARDERR lw v1, PCB_ONFAULT(t3) sw v0, PCB_ONFAULT(t3) diff --git a/sys/arch/mips64/mips64/lcore_ddb.S b/sys/arch/mips64/mips64/lcore_ddb.S index bf9306d5450..ee43279c83d 100644 --- a/sys/arch/mips64/mips64/lcore_ddb.S +++ b/sys/arch/mips64/mips64/lcore_ddb.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_ddb.S,v 1.9 2009/05/22 20:37:53 miod Exp $ */ +/* $OpenBSD: lcore_ddb.S,v 1.10 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -41,7 +41,8 @@ #ifdef __LP64__ LEAF(kdbpeekd, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 7 # unaligned ? bne v1, zero, 1f @@ -60,7 +61,8 @@ END(kdbpeekd) #endif LEAF(kdbpeek, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 3 # unaligned ? bne v1, zero, 1f @@ -78,7 +80,8 @@ LEAF(kdbpeek, 0) END(kdbpeek) LEAF(kdbpeekw, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 1 # unaligned ? bne v1, zero, 1f @@ -95,7 +98,8 @@ LEAF(kdbpeekw, 0) END(kdbpeekw) LEAF(kdbpeekb, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR sw v0, PCB_ONFAULT(t0) lb v0, 0(a0) @@ -110,7 +114,8 @@ kt_ddberr: #ifdef __LP64__ LEAF(kdbpoked, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 7 # unaligned ? bne v1, zero, 1f @@ -130,7 +135,8 @@ END(kdbpoked) LEAF(kdbpoke, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 3 # unaligned ? bne v1, zero, 1f @@ -148,7 +154,8 @@ LEAF(kdbpoke, 0) END(kdbpoke) LEAF(kdbpokew, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR and v1, a0, 1 # unaligned ? bne v1, zero, 1f @@ -164,7 +171,8 @@ LEAF(kdbpokew, 0) END(kdbpokew) LEAF(kdbpokeb, 0) - PTR_L t0, curprocpaddr + GET_CPU_INFO(t1, t0) + PTR_L t0, CI_CURPROCPADDR(t1) li v0, KT_DDBERR sw v0, PCB_ONFAULT(t0) sb a1, 0(a0) diff --git a/sys/arch/mips64/mips64/lcore_float.S b/sys/arch/mips64/mips64/lcore_float.S index e3545676b16..686661ab64d 100644 --- a/sys/arch/mips64/mips64/lcore_float.S +++ b/sys/arch/mips64/mips64/lcore_float.S @@ -1,4 +1,4 @@ -/* $OpenBSD: lcore_float.S,v 1.16 2009/05/22 20:37:53 miod Exp $ */ +/* $OpenBSD: lcore_float.S,v 1.17 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -36,8 +36,6 @@ #include "assym.h" -#define curproc (cpu_info_primary + CI_CURPROC) - .set noreorder # Noreorder is default style! .set mips3 @@ -451,7 +449,8 @@ NON_LEAF(MipsFPTrap, FRAMESZ(CF_SZ), ra) * The instruction is in the branch delay slot so the branch will have to * be emulated to get the resulting PC. */ - PTR_L a0, curprocpaddr # first arg is ptr to CPU regs + GET_CPU_INFO(t2, t3) + PTR_L a0, CI_CURPROCPADDR(t2) # first arg is ptr to CPU regs move a1, a2 # second arg is instruction PC move a2, t1 # third arg is the FP CSR jal MipsEmulateBranch # compute PC after branch @@ -471,7 +470,8 @@ NON_LEAF(MipsFPTrap, FRAMESZ(CF_SZ), ra) lw a0, 0(a2) # a0 = coproc instruction PTR_ADDU v0, a2, 4 # v0 = next pc 2: - PTR_L a3, curprocpaddr # first arg is ptr to CPU regs + GET_CPU_INFO(t2, t3) + PTR_L a3, CI_CURPROCPADDR(t2) # first arg is ptr to CPU regs PTR_S v0, PCB_REGS+(PC * REGSZ)(a3) # save new pc /* * Check to see if the instruction to be emulated is a floating-point @@ -485,7 +485,8 @@ NON_LEAF(MipsFPTrap, FRAMESZ(CF_SZ), ra) */ 3: cfc1 a2, FPC_CSR # code = FP exceptions - PTR_L a0, curproc # get current process + GET_CPU_INFO(t2, t3) + PTR_L a0, CI_CURPROC(t2) # get current process PTR_L a4, 3*REGSZ(sp) and v0, a2, FPC_EXCEPTION_INEXACT bnez v0, 4f diff --git a/sys/arch/mips64/mips64/tlbhandler.S b/sys/arch/mips64/mips64/tlbhandler.S index 087a2e0a974..022b73a55c1 100644 --- a/sys/arch/mips64/mips64/tlbhandler.S +++ b/sys/arch/mips64/mips64/tlbhandler.S @@ -1,4 +1,4 @@ -/* $OpenBSD: tlbhandler.S,v 1.19 2009/08/06 21:11:39 miod Exp $ */ +/* $OpenBSD: tlbhandler.S,v 1.20 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 1995-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -84,7 +84,8 @@ tlb_miss_err_r5k: .globl tlb_miss .ent tlb_miss, 0 tlb_miss: - PTR_L k1, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k1, CI_CURPROCPADDR(k1) dmfc0 k0, COP_0_BAD_VADDR bltz k0, _k_miss # kernel address space PTR_SRL k0, k0, SEGSHIFT - LOGREGSZ @@ -141,8 +142,12 @@ xtlb_miss: PTR_SRL k0, k0, SEGSHIFT sltiu k1, k0, PMAP_SEGTABSIZE beqz k1, _inv_seg # wrong if outside pm_segtab + nop + GET_CPU_INFO(k1, k0) + PTR_L k1, CI_CURPROCPADDR(k1) + dmfc0 k0, COP_0_BAD_VADDR + PTR_SRL k0, k0, SEGSHIFT PTR_SLL k0, k0, LOGREGSZ - PTR_L k1, curprocpaddr PTR_L k1, PCB_SEGTAB(k1) PTR_ADDU k1, k1, k0 PTR_L k1, 0(k1) # get pointer to page table @@ -321,7 +326,8 @@ NLEAF(k_tlb_miss, 0) eret sys_stk_chk: - PTR_L k1, curprocpaddr + GET_CPU_INFO(k1, k0) + PTR_L k1, CI_CURPROCPADDR(k1) PTR_SUBU k0, sp, k1 # check to see if we have a sltiu k0, 2048 # valid kernel stack beqz k0, go_k_general # yes, handle. diff --git a/sys/arch/sgi/include/asm.h b/sys/arch/sgi/include/asm.h index 997fa0dc94d..23aea156911 100644 --- a/sys/arch/sgi/include/asm.h +++ b/sys/arch/sgi/include/asm.h @@ -1,5 +1,14 @@ -/* $OpenBSD: asm.h,v 1.1 2004/08/06 21:12:18 pefo Exp $ */ +/* $OpenBSD: asm.h,v 1.2 2009/09/30 06:22:00 syuu Exp $ */ /* Use Mips generic include file */ +#ifdef MULTIPROCESSOR +#define HW_CPU_NUMBER(reg) \ + LA reg, HW_CPU_NUMBER_REG; \ + PTR_L reg, 0(reg) +#else /* MULTIPROCESSOR */ +#define HW_CPU_NUMBER(reg) \ + LI reg, 0 +#endif /* MULTIPROCESSOR */ + #include <mips64/asm.h> diff --git a/sys/arch/sgi/include/cpu.h b/sys/arch/sgi/include/cpu.h index b8740d1af54..18e457c2c5a 100644 --- a/sys/arch/sgi/include/cpu.h +++ b/sys/arch/sgi/include/cpu.h @@ -1,15 +1,15 @@ -/* $OpenBSD: cpu.h,v 1.2 2009/09/15 04:54:31 syuu Exp $ */ +/* $OpenBSD: cpu.h,v 1.3 2009/09/30 06:22:00 syuu Exp $ */ /* Use Mips generic include file */ #ifdef _KERNEL #ifdef MULTIPROCESSOR #if defined(TGT_OCTANE) -#define HW_CPU_NUMBER 0x900000000ff50000/* HEART_PRID */ -#else +#define HW_CPU_NUMBER_REG 0x900000000ff50000 /* HEART_PRID */ +#else /* TGT_OCTANE */ #error MULTIPROCESSOR kernel not supported on this configuration -#endif -#define hw_cpu_number() (*(uint64_t *)HW_CPU_NUMBER) +#endif /* TGT_OCTANE */ +#define hw_cpu_number() (*(uint64_t *)HW_CPU_NUMBER_REG) #else/* MULTIPROCESSOR */ #define hw_cpu_number() 0 #endif/* MULTIPROCESSOR */ diff --git a/sys/arch/sgi/sgi/genassym.cf b/sys/arch/sgi/sgi/genassym.cf index 8c68800f0dd..445e84bc2bc 100644 --- a/sys/arch/sgi/sgi/genassym.cf +++ b/sys/arch/sgi/sgi/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.13 2009/06/10 18:05:31 miod Exp $ +# $OpenBSD: genassym.cf,v 1.14 2009/09/30 06:22:00 syuu Exp $ # # Copyright (c) 1997 Per Fogelstrom / Opsycon AB # @@ -57,6 +57,7 @@ member pcb_segtab struct cpu_info member ci_curproc +member ci_curprocpaddr export VM_MIN_KERNEL_ADDRESS export SIGFPE diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c index 8059aa99591..d941ce5f241 100644 --- a/sys/arch/sgi/sgi/machdep.c +++ b/sys/arch/sgi/sgi/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.82 2009/08/19 12:33:06 jasper Exp $ */ +/* $OpenBSD: machdep.c,v 1.83 2009/09/30 06:22:00 syuu Exp $ */ /* * Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -103,7 +103,6 @@ int physmem; /* Max supported memory, changes to actual. */ int rsvdmem; /* Reserved memory not usable. */ int ncpu = 1; /* At least one CPU in the system. */ struct user *proc0paddr; -struct user *curprocpaddr; int console_ok; /* Set when console initialized. */ int kbd_reset; int16_t masternasid; @@ -490,7 +489,7 @@ mips_init(int argc, void *argv, caddr_t boot_esym) /* * Allocate U page(s) for proc[0], pm_tlbpid 1. */ - proc0.p_addr = proc0paddr = curprocpaddr = + proc0.p_addr = proc0paddr = curcpu()->ci_curprocpaddr = (struct user *)pmap_steal_memory(USPACE, NULL, NULL); proc0.p_md.md_regs = (struct trap_frame *)&proc0paddr->u_pcb.pcb_regs; tlb_set_pid(1); |