Port-alpha archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Alpha and thread-local storage



On Mar 28, 2011, at 11:58 AM, Havard Eidnes wrote:

> Hi,
> 
> Joerg has worked on TLS.  He claims that the only thing missing
> for alpha is that inside cpu_switchto, the process unique
> register needs to be written.
> 
> Attached is my attempt at cargo-culting this code, but someone
> who knows how PAL_wrunique should be called should take a closer
> look, and preferably test the change.

Confirmed by reading Alpha ARM 2nd Edition, OSF/1 PALcode section 2.2.9 (Swap 
Process Context), if the process unique requester is implemented, swpctx does 
the unique value swap for you.  rdunique and wrunique on systems that lack the 
internal register access it from the current HWPCB.  So, there is no need to 
actually do this separately in the context switch routine.

> 
> Best regards,
> 
> - Håvard
> Index: alpha/genassym.cf
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/alpha/alpha/genassym.cf,v
> retrieving revision 1.19
> diff -u -r1.19 genassym.cf
> --- alpha/genassym.cf 15 Dec 2010 01:33:37 -0000      1.19
> +++ alpha/genassym.cf 28 Mar 2011 09:10:05 -0000
> @@ -162,6 +162,7 @@
> define        PCB_CONTEXT             offsetof(struct pcb, pcb_context[0])
> define        PCB_ONFAULT             offsetof(struct pcb, pcb_onfault)
> define        PCB_ACCESSADDR          offsetof(struct pcb, pcb_accessaddr)
> +define       PCB_APCB_UNIQUE         offsetof(struct pcb, pcb_hw.apcb_unique)
> 
> # Offsets into struct fpstate, for save, restore
> define        FPREG_FPR_REGS          offsetof(struct fpreg, fpr_regs[0])
> Index: alpha/locore.s
> ===================================================================
> RCS file: /cvsroot/src/sys/arch/alpha/alpha/locore.s,v
> retrieving revision 1.120
> diff -u -r1.120 locore.s
> --- alpha/locore.s    7 Jul 2010 01:17:49 -0000       1.120
> +++ alpha/locore.s    28 Mar 2011 09:10:05 -0000
> @@ -697,6 +697,12 @@
>       ldq     s0, L_PCB(s2)
> 
>       /*
> +      * Save process unique register.
> +      */
> +     ldq     a0, PCB_APCB_UNIQUE(s0)
> +     call_pal PAL_wrunique
> +
> +     /*
>        * Check for restartable atomic sequences (RAS).
>        */
>       ldq     a0, L_PROC(s2)                  /* first ras_lookup() arg */

-- thorpej



Home | Main Index | Thread Index | Old Index