mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-22 23:04:43 +00:00
sparc32: Implement hard_smp_processor_id() via instruction patching.
This is the last non-trivial user of btfixup. Like sparc64, use a special patch section to resolve the various implementations of how to read the current CPU's ID when we don't have current_thread_info()->cpu necessarily available. Signed-off-by: David S. Miller <davem@davemloft.net> Tested-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
5d83d66635
commit
c68e5d39a5
10 changed files with 99 additions and 175 deletions
|
@ -103,37 +103,24 @@
|
|||
st %scratch, [%cur_reg + TI_W_SAVED];
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* Results of LOAD_CURRENT() after BTFIXUP for SUN4M, SUN4D & LEON (comments) */
|
||||
#define LOAD_CURRENT4M(dest_reg, idreg) \
|
||||
rd %tbr, %idreg; \
|
||||
sethi %hi(current_set), %dest_reg; \
|
||||
srl %idreg, 10, %idreg; \
|
||||
or %dest_reg, %lo(current_set), %dest_reg; \
|
||||
and %idreg, 0xc, %idreg; \
|
||||
ld [%idreg + %dest_reg], %dest_reg;
|
||||
|
||||
#define LOAD_CURRENT4D(dest_reg, idreg) \
|
||||
lda [%g0] ASI_M_VIKING_TMP1, %idreg; \
|
||||
sethi %hi(C_LABEL(current_set)), %dest_reg; \
|
||||
sll %idreg, 2, %idreg; \
|
||||
or %dest_reg, %lo(C_LABEL(current_set)), %dest_reg; \
|
||||
ld [%idreg + %dest_reg], %dest_reg;
|
||||
|
||||
#define LOAD_CURRENT_LEON(dest_reg, idreg) \
|
||||
rd %asr17, %idreg; \
|
||||
sethi %hi(current_set), %dest_reg; \
|
||||
srl %idreg, 0x1c, %idreg; \
|
||||
or %dest_reg, %lo(current_set), %dest_reg; \
|
||||
sll %idreg, 0x2, %idreg; \
|
||||
ld [%idreg + %dest_reg], %dest_reg;
|
||||
|
||||
/* Blackbox - take care with this... - check smp4m and smp4d before changing this. */
|
||||
#define LOAD_CURRENT(dest_reg, idreg) \
|
||||
sethi %hi(___b_load_current), %idreg; \
|
||||
sethi %hi(current_set), %dest_reg; \
|
||||
sethi %hi(boot_cpu_id4), %idreg; \
|
||||
or %dest_reg, %lo(current_set), %dest_reg; \
|
||||
ldub [%idreg + %lo(boot_cpu_id4)], %idreg; \
|
||||
#define LOAD_CURRENT(dest_reg, idreg) \
|
||||
661: rd %tbr, %idreg; \
|
||||
srl %idreg, 10, %idreg; \
|
||||
and %idreg, 0xc, %idreg; \
|
||||
.section .cpuid_patch, "ax"; \
|
||||
/* Instruction location. */ \
|
||||
.word 661b; \
|
||||
/* SUN4D implementation. */ \
|
||||
lda [%g0] ASI_M_VIKING_TMP1, %idreg; \
|
||||
sll %idreg, 2, %idreg; \
|
||||
nop; \
|
||||
/* LEON implementation. */ \
|
||||
rd %asr17, %idreg; \
|
||||
srl %idreg, 0x1c, %idreg; \
|
||||
sll %idreg, 0x02, %idreg; \
|
||||
.previous; \
|
||||
sethi %hi(current_set), %dest_reg; \
|
||||
or %dest_reg, %lo(current_set), %dest_reg;\
|
||||
ld [%idreg + %dest_reg], %dest_reg;
|
||||
#else
|
||||
#define LOAD_CURRENT(dest_reg, idreg) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue