Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: include/cpu.h
- ===================================================================
- RCS file: /cvsroot/src/sys/arch/vax/include/cpu.h,v
- retrieving revision 1.89
- diff -u -r1.89 cpu.h
- --- include/cpu.h 1 Jul 2010 19:50:12 -0000 1.89
- +++ include/cpu.h 12 Nov 2010 19:35:34 -0000
- @@ -144,6 +144,7 @@
- long ci_ipimsgs; /* Sent IPI bits */
- struct trapframe *ci_ddb_regs; /* Used by DDB */
- SIMPLEQ_ENTRY(cpu_info) ci_next; /* next cpu_info */
- + uintptr_t ci_cas_addr; /* current address doing CAS in a RAS */
- #endif
- };
- #define CI_MASTERCPU 1 /* Set if master CPU */
- Index: include/trap.h
- ===================================================================
- RCS file: /cvsroot/src/sys/arch/vax/include/trap.h,v
- retrieving revision 1.22
- diff -u -r1.22 trap.h
- --- include/trap.h 16 Feb 2009 23:55:31 -0000 1.22
- +++ include/trap.h 12 Nov 2010 19:35:34 -0000
- @@ -73,6 +73,9 @@
- #define AFLT_FLTDIV 0x9 /* floating divide-by-zero */
- #define AFLT_FLTUND 0xa /* floating underflow */
- +/* Used by RAS to detect an interrupted CAS */
- +#define CASMAGIC 0xBEDABABE /* high end of S0 space */
- +
- /* Trap's coming from user mode */
- #define T_USER 0x100
- Index: vax/genassym.cf
- ===================================================================
- RCS file: /cvsroot/src/sys/arch/vax/vax/genassym.cf,v
- retrieving revision 1.46
- diff -u -r1.46 genassym.cf
- --- vax/genassym.cf 12 May 2010 14:43:48 -0000 1.46
- +++ vax/genassym.cf 12 Nov 2010 19:35:34 -0000
- @@ -99,6 +99,7 @@
- define CI_MTX_COUNT offsetof(struct cpu_info, ci_mtx_count)
- define CI_MTX_OLDSPL offsetof(struct cpu_info, ci_mtx_oldspl)
- define CI_SOFTLWPS offsetof(struct cpu_info, ci_softlwps)
- +define CI_CAS_ADDR offsetof(struct cpu_info, ci_cas_addr)
- # mtpr register numbers
- define PR_KSP PR_KSP
- @@ -135,6 +136,8 @@
- define T_ASTFLT T_ASTFLT
- define T_KDBTRAP T_KDBTRAP
- +define CASMAGIC CASMAGIC
- +
- define USPACE USPACE
- define TRAPFRAMELEN sizeof(struct trapframe)
- define CALLSFRAMELEN sizeof(struct callsframe)
- Index: vax/lock_stubs.S
- ===================================================================
- RCS file: /cvsroot/src/sys/arch/vax/vax/lock_stubs.S,v
- retrieving revision 1.16
- diff -u -r1.16 lock_stubs.S
- --- vax/lock_stubs.S 1 Jul 2010 19:50:12 -0000 1.16
- +++ vax/lock_stubs.S 12 Nov 2010 19:35:34 -0000
- @@ -61,6 +61,9 @@
- #endif
- clrl %r2 /* set old value (zero) */
- mfpr $PR_SSP, %r3 /* set new value (curlwp) */
- +#ifndef MULTIPROCESSOR
- + addl3 $CI_CAS_ADDR, L_CPU(%r3), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- bsbw _do_cas+2 /* do the compare-and-swap */
- tstl %r0 /* is the old value what we wanted? */
- beql 2f /* yep, just branch to the return */
- @@ -78,6 +81,9 @@
- #endif
- mfpr $PR_SSP, %r2 /* get curlwp (old) */
- clrl %r3 /* get zero (new) */
- +#ifndef MULTIPROCESSOR
- + addl3 $CI_CAS_ADDR, L_CPU(%r2), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- bsbw _do_cas+2 /* do the compare-and-swap */
- cmpl %r0,%r2 /* return == old? */
- beql 2f /* yes, branch to return */
- @@ -160,6 +166,10 @@
- /* write active or pending? */
- bneq 3f /* yep, go slow */
- addl3 $RW_READ_INCR, %r2, %r3 /* incr. reader count (new) */
- +#ifndef MULTIPROCESSOR
- + mfpr $PR_SSP, %r4
- + addl3 $CI_CAS_ADDR, L_CPU(%r4), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- 1: bsbw _do_cas+2 /* do the compare-and-swap */
- cmpl %r0, %r2 /* did it succeed? */
- bneq 3f /* nope, go slow */
- @@ -185,6 +195,10 @@
- blbs %r2, 3f /* RW_HAS_WAITERS mbz */
- subl3 $RW_READ_INCR, %r2, %r3 /* decr. reader count (new) */
- blss 3f /* if less then 0, go slow */
- +#ifndef MULTIPROCESSOR
- + mfpr $PR_SSP, %r4 /* get curlwp */
- + addl3 $CI_CAS_ADDR, L_CPU(%r4), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- 1: bsbw _do_cas+2 /* do the compare-and-swap */
- cmpl %r0, %r2 /* did it succeed? */
- bneq 3f /* nope, go slow */
- @@ -211,6 +225,10 @@
- /* write active or pending? */
- bneq 2f /* yes, return failure */
- addl3 $RW_READ_INCR, %r2, %r3 /* incr reader count (new) */
- +#ifndef MULTIPROCESSOR
- + mfpr $PR_SSP, %r4
- + addl3 $CI_CAS_ADDR, L_CPU(%r4), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- 1: bsbw _do_cas+2 /* do the compare-and-swap */
- cmpl %r0, %r2 /* did it succeed? */
- bneq 2f /* no, we failed. */
- @@ -231,6 +249,10 @@
- ENTRY(_atomic_cas_32, 0)
- movq 4(%ap), %r1 /* cache ptr, old */
- movl 12(%ap), %r3 /* cache new */
- +#ifndef MULTIPROCESSOR
- + mfpr $PR_SSP, %r4
- + addl3 $CI_CAS_ADDR, L_CPU(%r4), %r4 /* r4 == &curcpu()->ci_cas_addr */
- +#endif
- bsbw _do_cas+2 /* do it */
- ret
- @@ -257,15 +279,27 @@
- 4:
- rsb /* return */
- #else
- - mfpr $PR_IPL, %r5 /* save IPL */
- - mtpr $IPL_SCHED, $PR_IPL /* block interrupts */
- - movl (%r1), %r0 /* get current value */
- - cmpl %r2, %r0 /* does it equal old value? */
- - bneq 1f /* no, don't update */
- - movl %r3, (%r1) /* yes, update */
- -1: mtpr %r5, $PR_IPL /* drop/restore IPL */
- - rsb /* return */
- -#endif
- +/*
- + * entry:
- + * r1 = address to be CAS'ed
- + * r2 = old value
- + * r3 = new value
- + * r4 = global cell to hold CAS address (common to all callers)
- + * e.g. address of curcpu()->ci_cas_addr
- + * exit:
- + * r0 = old value
- + */
- +JSBENTRY(cas32_ras_start)
- + movl %r1, (%r4)
- + movl *(%r4), %r0
- + cmpl %r2, %r0
- + bneq 1f
- + movl %r3, *(%r4)
- +JSBENTRY(cas32_ras_end)
- +1:
- + movl $CASMAGIC, *(%r4)
- + rsb
- +#endif /* !MULTIPROCESSOR */
- STRONG_ALIAS(atomic_cas_ptr,_atomic_cas_32)
- STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32)
- STRONG_ALIAS(atomic_cas_uint,_atomic_cas_32)
- Index: vax/trap.c
- ===================================================================
- RCS file: /cvsroot/src/sys/arch/vax/vax/trap.c,v
- retrieving revision 1.124
- diff -u -r1.124 trap.c
- --- vax/trap.c 23 Apr 2010 19:18:10 -0000 1.124
- +++ vax/trap.c 12 Nov 2010 19:35:34 -0000
- @@ -179,6 +179,22 @@
- }
- case T_PTELEN:
- +#ifndef MULTIPROCESSOR
- + /*
- + * If we referred to an address beyond the end of the system
- + * page table, it may be due to a failed CAS
- + * restartable-atomic-sequence. If it is, restart it at the
- + * beginning and restart.
- + */
- + extern const uint8_t cas32_ras_start[], cas32_ras_end[];
- + if (frame->code == CASMAGIC
- + && frame->pc >= (uintptr_t) cas32_ras_start
- + && frame->pc < (uintptr_t) cas32_ras_end) {
- + frame->pc = (uintptr_t) cas32_ras_start;
- + trapsig = false;
- + break;
- + }
- +#endif
- case T_ACCFLT:
- #ifdef TRAPDEBUG
- if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n",
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement