summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/cpufunc.h
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2002-09-22 04:45:21 +0000
committerpeter <peter@FreeBSD.org>2002-09-22 04:45:21 +0000
commite8f9ac26c88b71174cb2ec87c856bbf2da81f7c2 (patch)
tree336b9c28a5372b15800f7164f37383e1df6435de /sys/amd64/include/cpufunc.h
parent8dcc127f8742522e0fd59452b76ce27383488a90 (diff)
downloadFreeBSD-src-e8f9ac26c88b71174cb2ec87c856bbf2da81f7c2.zip
FreeBSD-src-e8f9ac26c88b71174cb2ec87c856bbf2da81f7c2.tar.gz
Create inlines for ltr(sel), lldt(sel), lidt(addr) rather than
functions that have one instruction.
Diffstat (limited to 'sys/amd64/include/cpufunc.h')
-rw-r--r--sys/amd64/include/cpufunc.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 1c4806f..c7f9ace 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -46,6 +46,7 @@
#include <machine/psl.h>
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
OpenPOWER on IntegriCloud