Only use the CPU ID register if SMP is defined. Some non-MPCore armv6 cpu,

such as the one found in the RPi, don't have it, and just hang when we try
to access it.
This commit is contained in:
Olivier Houchard 2014-02-02 23:29:51 +00:00
parent 2dfc0cd1b1
commit d5e7c3b7af
2 changed files with 6 additions and 3 deletions

View file

@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$");
#define DOMAIN_CLIENT 0x01
#ifdef _ARM_ARCH_6
#if defined(_ARM_ARCH_6) && defined(SMP)
#define GET_PCPU(tmp, tmp2) \
mrc p15, 0, tmp, c0, c0, 5; \
and tmp, tmp, #0xf; \
@ -240,8 +240,7 @@ ENTRY(cpu_switch)
/* Process is now on a processor. */
/* We have a new curthread now so make a note it */
GET_PCPU(r7, r2)
add r7, r7, #PC_CURTHREAD
str r1, [r7]
str r1, [r7, #PC_CURTHREAD]
#ifndef ARM_TP_ADDRESS
mcr p15, 0, r1, c13, c0, 4
#endif

View file

@ -65,11 +65,15 @@ extern struct pcpu *pcpup;
#define CPU_MASK (0xf)
#ifndef SMP
#define get_pcpu() (pcpup)
#else
#define get_pcpu() __extension__ ({ \
int id; \
__asm __volatile("mrc p15, 0, %0, c0, c0, 5" : "=r" (id)); \
(pcpup + (id & CPU_MASK)); \
})
#endif
static inline struct thread *
get_curthread(void)