MFamd64: use a less compiler-intensive MD implementation of 'curthread'
so that the compiler doesn't have to do so much work. Approved by: re (jhb)
This commit is contained in:
parent
855c7a569b
commit
d7a2504b1e
@ -128,6 +128,9 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/ptrace.h>
|
||||
#include <machine/sigframe.h>
|
||||
|
||||
/* Sanity check for __curthread() */
|
||||
CTASSERT(offsetof(struct pcpu, pc_curthread) == 0);
|
||||
|
||||
extern void init386(int first);
|
||||
extern void dblfault_handler(void);
|
||||
|
||||
|
@ -151,6 +151,16 @@ extern struct pcpu *pcpup;
|
||||
#define PCPU_PTR(member) __PCPU_PTR(pc_ ## member)
|
||||
#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
|
||||
|
||||
static __inline struct thread *
|
||||
__curthread(void)
|
||||
{
|
||||
struct thread *td;
|
||||
|
||||
__asm __volatile("movl %%fs:0,%0" : "=r" (td));
|
||||
return (td);
|
||||
}
|
||||
#define curthread (__curthread())
|
||||
|
||||
#else
|
||||
#error gcc or lint is required to use this file
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user