From e8f9ac26c88b71174cb2ec87c856bbf2da81f7c2 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 22 Sep 2002 04:45:21 +0000 Subject: Create inlines for ltr(sel), lldt(sel), lidt(addr) rather than functions that have one instruction. --- sys/i386/i386/support.s | 22 ---------------------- sys/i386/include/cpufunc.h | 27 ++++++++++++++++++++++++++- sys/i386/include/segments.h | 2 -- 3 files changed, 26 insertions(+), 25 deletions(-) (limited to 'sys/i386') diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 6e3286e..5e57315 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -1553,28 +1553,6 @@ ENTRY(lgdt) movl $KCSEL,4(%esp) lret -/* - * void lidt(struct region_descriptor *rdp); - */ -ENTRY(lidt) - movl 4(%esp),%eax - lidt (%eax) - ret - -/* - * void lldt(u_short sel) - */ -ENTRY(lldt) - lldt 4(%esp) - ret - -/* - * void ltr(u_short sel) - */ -ENTRY(ltr) - ltr 4(%esp) - ret - /* ssdtosd(*ssdp,*sdp) */ ENTRY(ssdtosd) pushl %ebx diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 1c4806f..c7f9ace 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -46,6 +46,7 @@ #include struct thread; +struct region_descriptor; __BEGIN_DECLS #define readb(va) (*(volatile u_int8_t *) (va)) @@ -468,6 +469,27 @@ load_gs(u_int sel) __asm __volatile("movl %0,%%gs" : : "rm" (sel)); } +/* void lidt(struct region_descriptor *addr); */ +static __inline void +lidt(struct region_descriptor *addr) +{ + __asm __volatile("lidt (%0)" : : "r" (addr)); +} + +/* void lldt(u_short sel); */ +static __inline void +lldt(u_short sel) +{ + __asm __volatile("lldt %0" : : "r" (sel)); +} + +/* void ltr(u_short sel); */ +static __inline void +ltr(u_short sel) +{ + __asm __volatile("ltr %0" : : "r" (sel)); +} + static __inline u_int rdr0(void) { @@ -622,6 +644,10 @@ void load_cr3(u_int cr3); void load_cr4(u_int cr4); void load_fs(u_int sel); void load_gs(u_int sel); +struct region_descriptor; +void lidt(struct region_descriptor *addr); +void lldt(u_short sel); +void ltr(u_short sel); void outb(u_int port, u_char data); void outl(u_int port, u_int data); void outsb(u_int port, void *addr, size_t cnt); @@ -663,7 +689,6 @@ void intr_restore(register_t ef); #endif /* __GNUC__ */ -void ltr(u_short sel); void reset_dbregs(void); __END_DECLS diff --git a/sys/i386/include/segments.h b/sys/i386/include/segments.h index fb5f76c..9f1f638 100644 --- a/sys/i386/include/segments.h +++ b/sys/i386/include/segments.h @@ -248,8 +248,6 @@ extern struct gate_descriptor *idt; extern union descriptor ldt[NLDT]; void lgdt(struct region_descriptor *rdp); -void lidt(struct region_descriptor *rdp); -void lldt(u_short sel); void sdtossd(struct segment_descriptor *sdp, struct soft_segment_descriptor *ssdp); void ssdtosd(struct soft_segment_descriptor *ssdp, -- cgit v1.1