summaryrefslogtreecommitdiff
path: root/i386
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-11-05 19:55:48 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:50 +0200
commit0487d0193161eae0f56d2f9eab0d901dc8d0fe07 (patch)
treef4a4d4d374d5d33943ddae93fd46aa5f71ec3d1e /i386
parentffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5 (diff)
2006-11-05 Samuel Thibault <samuel.thibault@ens-lyon.org>
FPU, CPU and IO stubs cleanup. * i386/i386/fpu.h (fstcw): New macro. * i386/i386/locore.S (_fninit, _fstcw, _fldcw, _fnstsw, _fnclex) (_clts, _fpsave, _fprestore, set_cr3, get_cr3, flush_tlb, get_cr2) (get_ldt, set_ldt, get_tr, set_tr, _setts, outb, inb, outw, inw, outl) (inl, loutb, loutw, linb, linw): Remove functions. * i386/i386/proc_reg.h (flush_tlb): New macro. * i386/i386/db_interface.c: Include `i386/proc_reg.h'. * i386/intel/pmap.c: Likewise. * i386/intel/pmap.h: Likewise. * i386/i386/fpu.c: Include `i386/pio.h'. * i386/i386/pic.c: Likewise. * i386/i386/pit.c: Likewise. * i386/i386at/iopl.c: Likewise. * i386/i386at/kd.c: Likewise. * i386/i386at/kd_event.c: Likewise. * i386/i386at/kd_mouse.c: Likewise. * i386/i386at/rtc.c: Likewise.
Diffstat (limited to 'i386')
-rw-r--r--i386/i386/db_interface.c1
-rw-r--r--i386/i386/fpu.c1
-rw-r--r--i386/i386/fpu.h3
-rw-r--r--i386/i386/locore.S300
-rw-r--r--i386/i386/pic.c1
-rw-r--r--i386/i386/pit.c1
-rw-r--r--i386/i386/proc_reg.h2
-rw-r--r--i386/i386at/iopl.c1
-rw-r--r--i386/i386at/kd.c1
-rw-r--r--i386/i386at/kd_event.c1
-rw-r--r--i386/i386at/kd_mouse.c1
-rw-r--r--i386/i386at/rtc.c1
-rw-r--r--i386/intel/pmap.c1
-rw-r--r--i386/intel/pmap.h1
14 files changed, 16 insertions, 300 deletions
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index 8da6df4..f254776 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -38,6 +38,7 @@
#include <i386/trap.h>
#include <i386/setjmp.h>
#include <i386/pmap.h>
+#include <i386/proc_reg.h>
#include "gdt.h"
#include "trap.h"
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 350d172..c436cfe 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -40,6 +40,7 @@
#include <i386/thread.h>
#include <i386/fpu.h>
+#include <i386/pio.h>
#include "cpu_number.h"
#if 0
diff --git a/i386/i386/fpu.h b/i386/i386/fpu.h
index 37bd94e..bb332ad 100644
--- a/i386/i386/fpu.h
+++ b/i386/i386/fpu.h
@@ -44,6 +44,9 @@
#define fnstcw(control) \
asm("fnstcw %0" : "=m" (*(unsigned short *)(control)))
+#define fstcw(control) \
+ asm volatile("fstcw %0" : "=m" (*(unsigned short *)(control)))
+
#define fldcw(control) \
asm volatile("fldcw %0" : : "m" (*(unsigned short *) &(control)) )
diff --git a/i386/i386/locore.S b/i386/i386/locore.S
index 4f04670..db8fb18 100644
--- a/i386/i386/locore.S
+++ b/i386/i386/locore.S
@@ -1319,306 +1319,6 @@ copyout_fail:
movl $1,%eax /* return 1 for failure */
jmp copyout_ret /* pop frame and return */
-/* XXX turn the following stubs into inline functions. */
-
-/*
- * FPU routines.
- */
-
-/*
- * Initialize FPU.
- */
-ENTRY(_fninit)
- fninit
- ret
-
-/*
- * Read control word
- */
-ENTRY(_fstcw)
- pushl %eax /* get stack space */
- fstcw (%esp)
- popl %eax
- ret
-
-/*
- * Set control word
- */
-ENTRY(_fldcw)
- fldcw 4(%esp)
- ret
-
-/*
- * Read status word
- */
-ENTRY(_fnstsw)
- xor %eax,%eax /* clear high 16 bits of eax */
- fnstsw %ax /* read FP status */
- ret
-
-/*
- * Clear FPU exceptions
- */
-ENTRY(_fnclex)
- fnclex
- ret
-
-/*
- * Clear task-switched flag.
- */
-ENTRY(_clts)
- clts
- ret
-
-/*
- * Save complete FPU state. Save error for later.
- */
-ENTRY(_fpsave)
- movl 4(%esp),%eax /* get save area pointer */
- fnsave (%eax) /* save complete state, including */
- /* errors */
- ret
-
-/*
- * Restore FPU state.
- */
-ENTRY(_fprestore)
- movl 4(%esp),%eax /* get save area pointer */
- frstor (%eax) /* restore complete state */
- ret
-
-/*
- * Set cr3
- */
-ENTRY(set_cr3)
- movl 4(%esp),%eax /* get new cr3 value */
- movl %eax,%cr3 /* load it */
- ret
-
-/*
- * Read cr3
- */
-ENTRY(get_cr3)
- movl %cr3,%eax
- ret
-
-/*
- * Flush TLB
- */
-ENTRY(flush_tlb)
- movl %cr3,%eax /* flush tlb by reloading CR3 */
- movl %eax,%cr3 /* with itself */
- ret
-
-/*
- * Read cr2
- */
-ENTRY(get_cr2)
- movl %cr2,%eax
- ret
-
-/*
- * Read ldtr
- */
-ENTRY(get_ldt)
- xorl %eax,%eax
- sldt %ax
- ret
-
-/*
- * Set ldtr
- */
-ENTRY(set_ldt)
- lldt 4(%esp)
- ret
-
-/*
- * Read task register.
- */
-ENTRY(get_tr)
- xorl %eax,%eax
- str %ax
- ret
-
-/*
- * Set task register. Also clears busy bit of task descriptor.
- */
-ENTRY(set_tr)
- movl S_ARG0,%eax /* get task segment number */
- subl $8,%esp /* push space for SGDT */
- sgdt 2(%esp) /* store GDT limit and base (linear) */
- movl 4(%esp),%edx /* address GDT */
- movb $(ACC_P|ACC_PL_K|ACC_TSS),5(%edx,%eax)
- /* fix access byte in task descriptor */
- ltr %ax /* load task register */
- addl $8,%esp /* clear stack */
- ret /* and return */
-
-/*
- * Set task-switched flag.
- */
-ENTRY(_setts)
- movl %cr0,%eax /* get cr0 */
- orl $(CR0_TS),%eax /* or in TS bit */
- movl %eax,%cr0 /* set cr0 */
- ret
-
-/*
- * void outb(unsigned char *io_port,
- * unsigned char byte)
- *
- * Output a byte to an IO port.
- */
-ENTRY(outb)
- movl S_ARG0,%edx /* IO port address */
- movl S_ARG1,%eax /* data to output */
- outb %al,%dx /* send it out */
- ret
-
-/*
- * unsigned char inb(unsigned char *io_port)
- *
- * Input a byte from an IO port.
- */
-ENTRY(inb)
- movl S_ARG0,%edx /* IO port address */
- xor %eax,%eax /* clear high bits of register */
- inb %dx,%al /* get the byte */
- ret
-
-/*
- * void outw(unsigned short *io_port,
- * unsigned short word)
- *
- * Output a word to an IO port.
- */
-ENTRY(outw)
- movl S_ARG0,%edx /* IO port address */
- movl S_ARG1,%eax /* data to output */
- outw %ax,%dx /* send it out */
- ret
-
-/*
- * unsigned short inw(unsigned short *io_port)
- *
- * Input a word from an IO port.
- */
-ENTRY(inw)
- movl S_ARG0,%edx /* IO port address */
- xor %eax,%eax /* clear high bits of register */
- inw %dx,%ax /* get the word */
- ret
-
-/*
- * void outl(unsigned int *io_port,
- * unsigned int byte)
- *
- * Output an int to an IO port.
- */
-ENTRY(outl)
- movl S_ARG0,%edx /* IO port address */
- movl S_ARG1,%eax /* data to output */
- outl %eax,%dx /* send it out */
- ret
-
-/*
- * unsigned int inl(unsigned int *io_port)
- *
- * Input an int from an IO port.
- */
-ENTRY(inl)
- movl S_ARG0,%edx /* IO port address */
- inl %dx,%eax /* get the int */
- ret
-
-/*
- * void loutb(unsigned byte *io_port,
- * unsigned byte *data,
- * unsigned int count)
- *
- * Output an array of bytes to an IO port.
- */
-ENTRY(loutb)
- movl %esi,%eax /* save register */
- movl S_ARG0,%edx /* get io port number */
- movl S_ARG1,%esi /* get data address */
- movl S_ARG2,%ecx /* get count */
-
- cld /* count up */
-
- rep
- outsb /* output */
-
- movl %eax,%esi /* restore register */
- ret /* exit */
-
-
-/*
- * void loutw(unsigned short *io_port,
- * unsigned short *data,
- * unsigned int count)
- *
- * Output an array of shorts to an IO port.
- */
-ENTRY(loutw)
- movl %esi,%eax /* save register */
- movl S_ARG0,%edx /* get io port number */
- movl S_ARG1,%esi /* get data address */
- movl S_ARG2,%ecx /* get count */
-
- cld /* count up */
-
- rep
- outsw /* output */
-
- movl %eax,%esi /* restore register */
- ret /* exit */
-
-
-/*
- * void linb(unsigned char *io_port,
- * unsigned char *data,
- * unsigned int count)
- *
- * Input an array of bytes from an IO port.
- */
-ENTRY(linb)
- movl %edi,%eax /* save register */
- movl S_ARG0,%edx /* get io port number */
- movl S_ARG1,%edi /* get data address */
- movl S_ARG2,%ecx /* get count */
-
- cld /* count up */
-
- rep
- insb /* input */
-
- movl %eax,%edi /* restore register */
- ret /* exit */
-
-
-/*
- * void linw(unsigned short *io_port,
- * unsigned short *data,
- * unsigned int count)
- *
- * Input an array of shorts from an IO port.
- */
-ENTRY(linw)
- movl %edi,%eax /* save register */
- movl S_ARG0,%edx /* get io port number */
- movl S_ARG1,%edi /* get data address */
- movl S_ARG2,%ecx /* get count */
-
- cld /* count up */
-
- rep
- insw /* input */
-
- movl %eax,%edi /* restore register */
- ret /* exit */
-
-
/*
* int inst_fetch(int eip, int cs);
*
diff --git a/i386/i386/pic.c b/i386/i386/pic.c
index b681070..4fa17f7 100644
--- a/i386/i386/pic.c
+++ b/i386/i386/pic.c
@@ -53,6 +53,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <i386/ipl.h>
#include <i386/pic.h>
#include <i386/machspl.h>
+#include <i386/pio.h>
spl_t curr_ipl;
int pic_mask[NSPL];
diff --git a/i386/i386/pit.c b/i386/i386/pit.c
index 8e9f953..0cb02a4 100644
--- a/i386/i386/pit.c
+++ b/i386/i386/pit.c
@@ -52,6 +52,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <kern/time_out.h>
#include <i386/ipl.h>
#include <i386/pit.h>
+#include <i386/pio.h>
int pitctl_port = PITCTL_PORT; /* For 386/20 Board */
int pitctr0_port = PITCTR0_PORT; /* For 386/20 Board */
diff --git a/i386/i386/proc_reg.h b/i386/i386/proc_reg.h
index 428569d..a8d2c09 100644
--- a/i386/i386/proc_reg.h
+++ b/i386/i386/proc_reg.h
@@ -109,6 +109,8 @@ set_eflags(unsigned eflags)
asm volatile("mov %0, %%cr3" : : "r" (_temp__)); \
})
+#define flush_tlb() set_cr3(get_cr3())
+
#define set_ts() \
set_cr0(get_cr0() | CR0_TS)
diff --git a/i386/i386at/iopl.c b/i386/i386at/iopl.c
index ae67568..a732314 100644
--- a/i386/i386at/iopl.c
+++ b/i386/i386at/iopl.c
@@ -35,6 +35,7 @@
#include <i386/io_port.h>
#include <i386/pit.h>
+#include <i386/pio.h>
/*
* IOPL device.
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index 3858f70..f7b3fc8 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -86,6 +86,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <vm/vm_kern.h>
#include <i386/vm_param.h>
#include <i386/machspl.h>
+#include <i386/pio.h>
#include <i386at/cram.h>
#include <i386at/kd.h>
#include <i386at/kdsoft.h>
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index dbd1cbd..909f066 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -72,6 +72,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/tty.h>
#endif /* MACH_KERNEL */
#include <i386/machspl.h>
+#include <i386/pio.h>
#include <i386at/kd.h>
#include <i386at/kd_queue.h>
diff --git a/i386/i386at/kd_mouse.c b/i386/i386at/kd_mouse.c
index ecd28a4..82fdd78 100644
--- a/i386/i386at/kd_mouse.c
+++ b/i386/i386at/kd_mouse.c
@@ -80,6 +80,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/tty.h>
#endif /* MACH_KERNEL */
#include <i386/ipl.h>
+#include <i386/pio.h>
#include <chips/busses.h>
#include <i386at/kd.h>
#include <i386at/kd_queue.h>
diff --git a/i386/i386at/rtc.c b/i386/i386at/rtc.c
index 96aa86d..0f72792 100644
--- a/i386/i386at/rtc.c
+++ b/i386/i386at/rtc.c
@@ -50,6 +50,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <sys/time.h>
#include <kern/time_out.h>
#include <i386/machspl.h>
+#include <i386/pio.h>
#include <i386at/rtc.h>
static unsigned char rtc[RTC_NREG];
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 6827519..58fc5d4 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -77,6 +77,7 @@
#include <mach/machine/vm_param.h>
#include <machine/thread.h>
#include <i386/cpu_number.h>
+#include <i386/proc_reg.h>
#ifdef ORC
#define OLIVETTICACHE 1
diff --git a/i386/intel/pmap.h b/i386/intel/pmap.h
index 25ccc1a..17dc0ea 100644
--- a/i386/intel/pmap.h
+++ b/i386/intel/pmap.h
@@ -42,6 +42,7 @@
#include <mach/machine/vm_param.h>
#include <mach/vm_statistics.h>
#include <mach/kern_return.h>
+#include <i386/proc_reg.h>
/*
* Define the generic in terms of the specific