Create inlines for ltr(sel), lldt(sel), lidt(addr) rather than

functions that have one instruction.
This commit is contained in:
Peter Wemm 2002-09-22 04:45:21 +00:00
parent e94ce82689
commit eb1443c8dd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103778
7 changed files with 52 additions and 72 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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