diff options
author | cognet <cognet@FreeBSD.org> | 2005-02-26 18:59:01 +0000 |
---|---|---|
committer | cognet <cognet@FreeBSD.org> | 2005-02-26 18:59:01 +0000 |
commit | 43586d701a28a6b1ef236ac59977399f1c91658e (patch) | |
tree | 754a92db74155793fdb77b1dabe591af0404d9f8 /sys/arm/arm/swtch.S | |
parent | d017d1bb8095eeec8316d252936d8810684f8c64 (diff) | |
download | FreeBSD-src-43586d701a28a6b1ef236ac59977399f1c91658e.zip FreeBSD-src-43586d701a28a6b1ef236ac59977399f1c91658e.tar.gz |
Instead of using sysarch() to store-retrieve the tp, add a magic address,
ARM_TP_ADDRESS, where the tp will be stored. On CPUs that support it, a cache
line will be allocated and locked for this address, so that it will never go
to RAM. On CPUs that does not, a page is allocated for it (it will be a bit
slower, and is wrong for SMP, but should be fine for UP).
The tp is still stored in the mdthread struct, and at each context switch,
ARM_TP_ADDRESS gets updated.
Suggested by: davidxu
Diffstat (limited to 'sys/arm/arm/swtch.S')
-rw-r--r-- | sys/arm/arm/swtch.S | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/arm/arm/swtch.S b/sys/arm/arm/swtch.S index 2bf7889..a52298b 100644 --- a/sys/arm/arm/swtch.S +++ b/sys/arm/arm/swtch.S @@ -201,6 +201,12 @@ ENTRY(cpu_throw) ldr r6, .Lcurthread str r5, [r6] + /* Set the new tp */ + ldr r6, [r5, #(TD_MD)] + add r6, r6, #(MD_TP) + mov r5, #ARM_TP_ADDRESS + str r6, [r5] + /* Hook in a new pcb */ ldr r6, .Lcurpcb str r7, [r6] @@ -253,7 +259,15 @@ ENTRY(cpu_switch) * NOTE: We can now use r8-r13 until it is time to restore * them for the new process. */ - + /* Store the old tp */ + mov r3, #ARM_TP_ADDRESS + ldr r9, [r3] + str r9, [r0, #(TD_MD + MD_TP)] + + /* Set the new tp */ + ldr r9, [r1, #(TD_MD + MD_TP)] + mov r3, #ARM_TP_ADDRESS + str r9, [r3] /* Get the user structure for the new process in r9 */ ldr r9, [r1, #(TD_PCB)] |