diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2018-02-18 14:50:09 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2018-02-18 14:50:09 +0000 |
commit | cb2d3b6fcf1ce89dd03f52a0334307efea18ae30 (patch) | |
tree | 5efe39f5aa4759ce1ff4fc5e4472b392bc0ab644 /sys/arch/octeon | |
parent | 59d4eaf9c8738de8016fecd5913756987bfee0bf (diff) |
Inline hw_{get,set}curcpu() to streamline the machine code.
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r-- | sys/arch/octeon/include/cpu.h | 19 | ||||
-rw-r--r-- | sys/arch/octeon/octeon/locore.S | 14 |
2 files changed, 17 insertions, 16 deletions
diff --git a/sys/arch/octeon/include/cpu.h b/sys/arch/octeon/include/cpu.h index afc9a037a92..6e5b880833c 100644 --- a/sys/arch/octeon/include/cpu.h +++ b/sys/arch/octeon/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.11 2018/01/18 14:02:54 visa Exp $ */ +/* $OpenBSD: cpu.h,v 1.12 2018/02/18 14:50:08 visa Exp $ */ /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. @@ -51,14 +51,27 @@ #if defined(MULTIPROCESSOR) && !defined(_LOCORE) #define MAXCPUS OCTEON_MAXCPUS struct cpu_info; -struct cpu_info *hw_getcurcpu(void); -void hw_setcurcpu(struct cpu_info *); void hw_cpu_boot_secondary(struct cpu_info *); void hw_cpu_hatch(struct cpu_info *); void hw_cpu_spinup_trampoline(struct cpu_info *); int hw_ipi_intr_establish(int (*)(void *), u_long); void hw_ipi_intr_set(u_long); void hw_ipi_intr_clear(u_long); + +/* Keep in sync with HW_GET_CPU_INFO(). */ +static inline struct cpu_info * +hw_getcurcpu(void) +{ + struct cpu_info *ci; + __asm__ volatile ("dmfc0 %0, $30" /* ErrorEPC */ : "=r" (ci)); + return ci; +} + +static inline void +hw_setcurcpu(struct cpu_info *ci) +{ + __asm__ volatile ("dmtc0 %0, $30" /* ErrorEPC */ : : "r" (ci)); +} #endif /* MULTIPROCESSOR && !_LOCORE */ #define CACHELINESIZE 128 diff --git a/sys/arch/octeon/octeon/locore.S b/sys/arch/octeon/octeon/locore.S index 928839b5d68..ff503c3d86c 100644 --- a/sys/arch/octeon/octeon/locore.S +++ b/sys/arch/octeon/octeon/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.16 2017/06/08 12:11:46 visa Exp $ */ +/* $OpenBSD: locore.S,v 1.17 2018/02/18 14:50:08 visa Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -156,16 +156,4 @@ LEAF(hw_cpu_spinup_trampoline, 0) jal hw_cpu_hatch nop END(hw_cpu_spinup_trampoline) - -LEAF(hw_getcurcpu, 0) - GET_CPU_INFO(v0, v1) - jr ra - nop -END(hw_getcurcpu) - -LEAF(hw_setcurcpu, 0) - dmtc0 a0, COP_0_ERROR_PC - j ra - nop -END(hw_setcurcpu) #endif /* MULTIPROCESSOR */ |