-/* $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.
#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
-/* $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)
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 */