summaryrefslogtreecommitdiffstats
path: root/sys/riscv
diff options
context:
space:
mode:
authorbr <br@FreeBSD.org>2016-02-04 14:30:46 +0000
committerbr <br@FreeBSD.org>2016-02-04 14:30:46 +0000
commit996520c667b5c94ff6e02725612083dc93269da3 (patch)
tree479f3597de676332ef5ad0850c947cc672044e3d /sys/riscv
parent87f75655f47c981626c6195bef391c7b49efb7cf (diff)
downloadFreeBSD-src-996520c667b5c94ff6e02725612083dc93269da3.zip
FreeBSD-src-996520c667b5c94ff6e02725612083dc93269da3.tar.gz
Access pcpup using gp register.
Diffstat (limited to 'sys/riscv')
-rw-r--r--sys/riscv/include/asm.h4
-rw-r--r--sys/riscv/riscv/exception.S4
-rw-r--r--sys/riscv/riscv/swtch.S14
3 files changed, 6 insertions, 16 deletions
diff --git a/sys/riscv/include/asm.h b/sys/riscv/include/asm.h
index fb0c844..adcc23a 100644
--- a/sys/riscv/include/asm.h
+++ b/sys/riscv/include/asm.h
@@ -59,9 +59,7 @@
.set alias,sym
#define SET_FAULT_HANDLER(handler, tmp) \
- la tmp, pcpup; \
- ld tmp, 0(tmp); \
- ld tmp, PC_CURTHREAD(tmp); \
+ ld tmp, PC_CURTHREAD(gp); \
ld tmp, TD_PCB(tmp); /* Load the pcb */ \
sd handler, PCB_ONFAULT(tmp) /* Set the handler */
diff --git a/sys/riscv/riscv/exception.S b/sys/riscv/riscv/exception.S
index 8bd9027..814fcf6 100644
--- a/sys/riscv/riscv/exception.S
+++ b/sys/riscv/riscv/exception.S
@@ -182,9 +182,7 @@ __FBSDID("$FreeBSD$");
1:
csrci sstatus, SSTATUS_IE
- la a1, pcpup
- ld a1, 0(a1)
- ld a1, PC_CURTHREAD(a1)
+ ld a1, PC_CURTHREAD(gp)
lw a2, TD_FLAGS(a1)
li a3, (TDF_ASTPENDING|TDF_NEEDRESCHED)
diff --git a/sys/riscv/riscv/swtch.S b/sys/riscv/riscv/swtch.S
index 5e9b3c9..c6336a9 100644
--- a/sys/riscv/riscv/swtch.S
+++ b/sys/riscv/riscv/swtch.S
@@ -46,14 +46,11 @@ __FBSDID("$FreeBSD$");
* void cpu_throw(struct thread *old, struct thread *new)
*/
ENTRY(cpu_throw)
- /* Load pcpu */
- la x14, pcpup
- ld x14, 0(x14)
/* Store the new curthread */
- sd a1, PC_CURTHREAD(x14)
+ sd a1, PC_CURTHREAD(gp)
/* And the new pcb */
ld x13, TD_PCB(a1)
- sd x13, PC_CURPCB(x14)
+ sd x13, PC_CURPCB(gp)
sfence.vm
@@ -103,14 +100,11 @@ END(cpu_throw)
* x3 to x7, x16 and x17 are caller saved
*/
ENTRY(cpu_switch)
- /* Load pcpu */
- la x14, pcpup
- ld x14, 0(x14)
/* Store the new curthread */
- sd a1, PC_CURTHREAD(x14)
+ sd a1, PC_CURTHREAD(gp)
/* And the new pcb */
ld x13, TD_PCB(a1)
- sd x13, PC_CURPCB(x14)
+ sd x13, PC_CURPCB(gp)
/* Save the old context. */
ld x13, TD_PCB(a0)
OpenPOWER on IntegriCloud