diff options
author | 2013-09-12 11:43:51 +0000 | |
---|---|---|
committer | 2013-09-12 11:43:51 +0000 | |
commit | 09a5e7d85304d2ae4621a0334255b7fc7f5574e6 (patch) | |
tree | e440492fd1e4ce6006cc35d7fe911d001c886c8a | |
parent | Rename cpu_info_store to cpu_info_primary. Create an array of cpu_infos (diff) | |
download | wireguard-openbsd-09a5e7d85304d2ae4621a0334255b7fc7f5574e6.tar.xz wireguard-openbsd-09a5e7d85304d2ae4621a0334255b7fc7f5574e6.zip |
Store curpcb in cpu_info instead of a global variable, for SMP.
ok rapha@
-rw-r--r-- | sys/arch/arm/arm/bcopyinout.S | 30 | ||||
-rw-r--r-- | sys/arch/arm/arm/copystr.S | 14 | ||||
-rw-r--r-- | sys/arch/arm/arm/cpuswitch.S | 21 | ||||
-rw-r--r-- | sys/arch/arm/arm/cpuswitch7.S | 19 | ||||
-rw-r--r-- | sys/arch/arm/arm/genassym.cf | 4 | ||||
-rw-r--r-- | sys/arch/arm/include/cpu.h | 10 | ||||
-rw-r--r-- | sys/arch/arm/include/pcb.h | 10 |
7 files changed, 42 insertions, 66 deletions
diff --git a/sys/arch/arm/arm/bcopyinout.S b/sys/arch/arm/arm/bcopyinout.S index 7656c111de7..4d423e55797 100644 --- a/sys/arch/arm/arm/bcopyinout.S +++ b/sys/arch/arm/arm/bcopyinout.S @@ -1,4 +1,4 @@ -/* $OpenBSD: bcopyinout.S,v 1.2 2011/09/20 22:02:10 miod Exp $ */ +/* $OpenBSD: bcopyinout.S,v 1.3 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: bcopyinout.S,v 1.13 2003/10/31 16:54:05 scw Exp $ */ /* @@ -51,8 +51,8 @@ .Lcpu_info: .word _C_LABEL(cpu_info) #else -.Lcurpcb: - .word _C_LABEL(curpcb) +.Lcpu_info_primary: + .word _C_LABEL(cpu_info_primary) #endif #define SAVE_REGS stmfd sp!, {r4-r11} @@ -91,8 +91,8 @@ ENTRY(copyin) ldr r4, [r4, #CI_CURPCB] ldmfd sp!, {r0-r2, r14} #else - ldr r4, .Lcurpcb - ldr r4, [r4] + ldr r4, .Lcpu_info_primary + ldr r4, [r4, #CI_CURPCB] #endif ldr r5, [r4, #PCB_ONFAULT] @@ -314,8 +314,8 @@ ENTRY(copyout) ldr r4, [r4, #CI_CURPCB] ldmfd sp!, {r0-r2, r14} #else - ldr r4, .Lcurpcb - ldr r4, [r4] + ldr r4, .Lcpu_info_primary + ldr r4, [r4, #CI_CURPCB] #endif ldr r5, [r4, #PCB_ONFAULT] @@ -527,8 +527,8 @@ ENTRY(kcopy) ldr r4, [r4, #CI_CURPCB] ldmfd sp!, {r0-r2, r14} #else - ldr r4, .Lcurpcb - ldr r4, [r4] + ldr r4, .Lcpu_info_primary + ldr r4, [r4, #CI_CURPCB] #endif ldr r5, [r4, #PCB_ONFAULT] @@ -720,8 +720,8 @@ ENTRY(badaddr_read_1) ldr r2, [r2, #CI_CURPCB] ldmfd sp!, {r0-r1, r14} #else - ldr r2, .Lcurpcb - ldr r2, [r2] + ldr r2, .Lcpu_info_primary + ldr r2, [r2, #CI_CURPCB] #endif ldr ip, [r2, #PCB_ONFAULT] adr r3, 1f @@ -754,8 +754,8 @@ ENTRY(badaddr_read_2) ldr r2, [r2, #CI_CURPCB] ldmfd sp!, {r0-r1, r14} #else - ldr r2, .Lcurpcb - ldr r2, [r2] + ldr r2, .Lcpu_info_primary + ldr r2, [r2, #CI_CURPCB] #endif ldr ip, [r2, #PCB_ONFAULT] adr r3, 1f @@ -788,8 +788,8 @@ ENTRY(badaddr_read_4) ldr r2, [r2, #CI_CURPCB] ldmfd sp!, {r0-r1, r14} #else - ldr r2, .Lcurpcb - ldr r2, [r2] + ldr r2, .Lcpu_info_primary + ldr r2, [r2, #CI_CURPCB] #endif ldr ip, [r2, #PCB_ONFAULT] adr r3, 1f diff --git a/sys/arch/arm/arm/copystr.S b/sys/arch/arm/arm/copystr.S index aeb2f3c4db2..3723f1860f3 100644 --- a/sys/arch/arm/arm/copystr.S +++ b/sys/arch/arm/arm/copystr.S @@ -1,4 +1,4 @@ -/* $OpenBSD: copystr.S,v 1.3 2011/09/20 22:02:10 miod Exp $ */ +/* $OpenBSD: copystr.S,v 1.4 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: copystr.S,v 1.8 2002/10/13 14:54:48 bjh21 Exp $ */ /* @@ -49,8 +49,8 @@ .Lcpu_info: .word _C_LABEL(cpu_info) #else -.Lcurpcb: - .word _C_LABEL(curpcb) +.Lcpu_info_primary: + .word _C_LABEL(cpu_info_primary) #endif /* @@ -113,8 +113,8 @@ ENTRY(copyinstr) ldr r4, [r4, #CI_CURPCB] ldmfd sp!, {r0-r3, r14} #else - ldr r4, .Lcurpcb - ldr r4, [r4] + ldr r4, .Lcpu_info_primary + ldr r4, [r4, #CI_CURPCB] #endif #ifdef DEBUG @@ -170,8 +170,8 @@ ENTRY(copyoutstr) ldr r4, [r4, #CI_CURPCB] ldmfd sp!, {r0-r3, r14} #else - ldr r4, .Lcurpcb - ldr r4, [r4] + ldr r4, .Lcpu_info_primary + ldr r4, [r4, #CI_CURPCB] #endif #ifdef DEBUG diff --git a/sys/arch/arm/arm/cpuswitch.S b/sys/arch/arm/arm/cpuswitch.S index b18ecf84392..563500d47e6 100644 --- a/sys/arch/arm/arm/cpuswitch.S +++ b/sys/arch/arm/arm/cpuswitch.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch.S,v 1.13 2013/09/12 11:42:22 patrick Exp $ */ +/* $OpenBSD: cpuswitch.S,v 1.14 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $ */ /* @@ -108,23 +108,12 @@ .Lcpu_info_primary: .word _C_LABEL(cpu_info_primary) .Lcurproc: - .word _C_LABEL(cpu_info_parimary) + CI_CURPROC - -.Lcpufuncs: - .word _C_LABEL(cpufuncs) - -#ifndef MULTIPROCESSOR -.Lcurpcb: - .word _C_LABEL(curpcb) - .data - .global _C_LABEL(curpcb) -_C_LABEL(curpcb): - .word 0x00000000 - .text -#else + .word _C_LABEL(cpu_info_primary) + CI_CURPROC .Lcurpcb: .word _C_LABEL(cpu_info_primary) + CI_CURPCB -#endif + +.Lcpufuncs: + .word _C_LABEL(cpufuncs) .Lcpu_do_powersave: .word _C_LABEL(cpu_do_powersave) diff --git a/sys/arch/arm/arm/cpuswitch7.S b/sys/arch/arm/arm/cpuswitch7.S index 75d3f2618f4..33dbc7fe11d 100644 --- a/sys/arch/arm/arm/cpuswitch7.S +++ b/sys/arch/arm/arm/cpuswitch7.S @@ -1,4 +1,4 @@ -/* $OpenBSD: cpuswitch7.S,v 1.2 2013/09/12 11:42:22 patrick Exp $ */ +/* $OpenBSD: cpuswitch7.S,v 1.3 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: cpuswitch.S,v 1.41 2003/11/15 08:44:18 scw Exp $ */ /* @@ -109,22 +109,11 @@ .word _C_LABEL(cpu_info_primary) .Lcurproc: .word _C_LABEL(cpu_info_primary) + CI_CURPROC - -.Lcpufuncs: - .word _C_LABEL(cpufuncs) - -#ifndef MULTIPROCESSOR -.Lcurpcb: - .word _C_LABEL(curpcb) - .data - .global _C_LABEL(curpcb) -_C_LABEL(curpcb): - .word 0x00000000 - .text -#else .Lcurpcb: .word _C_LABEL(cpu_info_primary) + CI_CURPCB -#endif + +.Lcpufuncs: + .word _C_LABEL(cpufuncs) .Lcpu_do_powersave: .word _C_LABEL(cpu_do_powersave) diff --git a/sys/arch/arm/arm/genassym.cf b/sys/arch/arm/arm/genassym.cf index 8353560d59e..a9c30a9d9e5 100644 --- a/sys/arch/arm/arm/genassym.cf +++ b/sys/arch/arm/arm/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.12 2013/09/10 12:35:25 patrick Exp $ +# $OpenBSD: genassym.cf,v 1.13 2013/09/12 11:43:51 patrick Exp $ # $NetBSD: genassym.cf,v 1.27 2003/11/04 10:33:16 dsl Exp$ # Copyright (c) 1982, 1990 The Regents of the University of California. @@ -157,7 +157,7 @@ member cf_control struct cpu_info #member CI_CURPRIORITY ci_schedstate.spc_curpriority member ci_curproc -#member ci_curpcb +member ci_curpcb member ci_idepth # Constants required for in_cksum() and friends. diff --git a/sys/arch/arm/include/cpu.h b/sys/arch/arm/include/cpu.h index 6af4b80e716..a75285cd8fc 100644 --- a/sys/arch/arm/include/cpu.h +++ b/sys/arch/arm/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.37 2013/09/12 11:42:22 patrick Exp $ */ +/* $OpenBSD: cpu.h,v 1.38 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: cpu.h,v 1.34 2003/06/23 11:01:08 martin Exp $ */ /* @@ -179,15 +179,19 @@ void arm32_vector_init(vaddr_t, int); #include <sys/sched.h> struct cpu_info { struct device *ci_dev; /* Device corresponding to this CPU */ + struct cpu_info *ci_next; struct schedstate_percpu ci_schedstate; /* scheduler state */ struct proc *ci_curproc; + u_int32_t ci_cpuid; + u_int32_t ci_randseed; + + struct pcb *ci_curpcb; u_int32_t ci_arm_cpuid; /* aggregate CPU id */ u_int32_t ci_arm_cputype; /* CPU type */ u_int32_t ci_arm_cpurev; /* CPU revision */ u_int32_t ci_ctrl; /* The CPU control register */ - u_int32_t ci_randseed; uint32_t ci_cpl; uint32_t ci_ipending; @@ -230,6 +234,8 @@ extern struct cpu_info *cpu_info[MAXCPUS]; void cpu_boot_secondary_processors(void); #endif /* !MULTIPROCESSOR */ +#define curpcb curcpu()->ci_curpcb + /* * Scheduling glue */ diff --git a/sys/arch/arm/include/pcb.h b/sys/arch/arm/include/pcb.h index daf8b58d4eb..2ee7a801c93 100644 --- a/sys/arch/arm/include/pcb.h +++ b/sys/arch/arm/include/pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pcb.h,v 1.4 2011/09/20 22:02:13 miod Exp $ */ +/* $OpenBSD: pcb.h,v 1.5 2013/09/12 11:43:51 patrick Exp $ */ /* $NetBSD: pcb.h,v 1.10 2003/10/13 21:46:39 scw Exp $ */ /* @@ -93,12 +93,4 @@ struct md_coredump { int md_empty; }; -#ifdef _KERNEL -#ifdef MULTIPROCESSOR -#define curpcb (curcpu()->ci_curpcb) -#else -extern struct pcb *curpcb; -#endif -#endif /* _KERNEL */ - #endif /* _ARM_PCB_H_ */ |