Author: andrew
Date: Fri Jun  9 15:37:17 2017
New Revision: 319752
URL: https://svnweb.freebsd.org/changeset/base/319752

Log:
  Store the read-only thread pointer when scheduling a new thread. This is
  not currently set, however we may wish to set it later.

Modified:
  head/sys/arm64/arm64/genassym.c
  head/sys/arm64/arm64/swtch.S
  head/sys/arm64/include/pcb.h

Modified: head/sys/arm64/arm64/genassym.c
==============================================================================
--- head/sys/arm64/arm64/genassym.c     Fri Jun  9 15:30:41 2017        
(r319751)
+++ head/sys/arm64/arm64/genassym.c     Fri Jun  9 15:37:17 2017        
(r319752)
@@ -49,6 +49,7 @@ ASSYM(PCB_SIZE, roundup2(sizeof(struct pcb), STACKALIG
 ASSYM(PCB_SINGLE_STEP_SHIFT, PCB_SINGLE_STEP_SHIFT);
 ASSYM(PCB_REGS, offsetof(struct pcb, pcb_x));
 ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
+ASSYM(PCB_TPIDRRO, offsetof(struct pcb, pcb_tpidrro_el0));
 ASSYM(PCB_L0ADDR, offsetof(struct pcb, pcb_l0addr));
 ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
 ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));

Modified: head/sys/arm64/arm64/swtch.S
==============================================================================
--- head/sys/arm64/arm64/swtch.S        Fri Jun  9 15:30:41 2017        
(r319751)
+++ head/sys/arm64/arm64/swtch.S        Fri Jun  9 15:37:17 2017        
(r319752)
@@ -104,6 +104,8 @@ ENTRY(cpu_throw)
        ldp     x5, x6, [x4, #PCB_SP]
        mov     sp, x5
        msr     tpidr_el0, x6
+       ldr     x6, [x4, #PCB_TPIDRRO]
+       msr     tpidrro_el0, x6
        ldp     x8, x9, [x4, #PCB_REGS + 8 * 8]
        ldp     x10, x11, [x4, #PCB_REGS + 10 * 8]
        ldp     x12, x13, [x4, #PCB_REGS + 12 * 8]
@@ -149,6 +151,8 @@ ENTRY(cpu_switch)
        str     x30, [x4, #PCB_REGS + 30 * 8]
        /* And the old stack pointer */
        mov     x5, sp
+       mrs     x6, tpidrro_el0
+       str     x6, [x4, #PCB_TPIDRRO]
        mrs     x6, tpidr_el0
        stp     x5, x6, [x4, #PCB_SP]
 
@@ -215,6 +219,8 @@ ENTRY(cpu_switch)
        ldp     x5, x6, [x4, #PCB_SP]
        mov     sp, x5
        msr     tpidr_el0, x6
+       ldr     x6, [x4, #PCB_TPIDRRO]
+       msr     tpidrro_el0, x6
        ldp     x8, x9, [x4, #PCB_REGS + 8 * 8]
        ldp     x10, x11, [x4, #PCB_REGS + 10 * 8]
        ldp     x12, x13, [x4, #PCB_REGS + 12 * 8]
@@ -301,6 +307,8 @@ ENTRY(savectx)
        str     x30, [x0, #PCB_REGS + 30 * 8]
        /* And the old stack pointer */
        mov     x5, sp
+       mrs     x6, tpidrro_el0
+       str     x6, [x0, #PCB_TPIDRRO]
        mrs     x6, tpidr_el0
        stp     x5, x6, [x0, #PCB_SP]
 

Modified: head/sys/arm64/include/pcb.h
==============================================================================
--- head/sys/arm64/include/pcb.h        Fri Jun  9 15:30:41 2017        
(r319751)
+++ head/sys/arm64/include/pcb.h        Fri Jun  9 15:37:17 2017        
(r319752)
@@ -42,6 +42,7 @@ struct pcb {
        /* These two need to be in order as we access them together */
        uint64_t        pcb_sp;
        uint64_t        pcb_tpidr_el0;
+       uint64_t        pcb_tpidrro_el0;
        vm_offset_t     pcb_l0addr;
 
        /* Fault handler, the error value is passed in x0 */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to