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:
peter 2003-11-20 23:23:22 +00:00
parent 855c7a569b
commit d7a2504b1e
2 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -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