Inlined ins/outs functions.

Obtained from:	NetBSD
This commit is contained in:
dg 1994-09-25 21:31:55 +00:00
parent 6eb62341ed
commit a93669f48d
5 changed files with 162 additions and 263 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.17 1994/09/12 11:38:09 davidg Exp $
* $Id: support.s,v 1.18 1994/09/16 13:33:27 davidg Exp $
*/
#include "assym.s" /* system definitions */
@ -56,49 +56,9 @@ ENTRY(__divsi3)
idivl 8(%esp)
ret
/*
* I/O bus instructions via C
*/
ENTRY(insb) /* insb(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insb
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insw) /* insw(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insw
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insl) /* insl(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insl
NOP
movl %edi,%eax
popl %edi
ret
/*
* Support for reading real time clock registers
*/
ENTRY(rtcin) /* rtcin(val) */
movl 4(%esp),%eax
outb %al,$0x70
@ -108,45 +68,6 @@ ENTRY(rtcin) /* rtcin(val) */
NOP
ret
ENTRY(outsb) /* outsb(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsb
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsw) /* outsw(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsw
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsl) /* outsl(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsl
NOP
movl %esi,%eax
popl %esi
ret
/*
* bcopy family
*/

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.17 1994/09/12 11:38:09 davidg Exp $
* $Id: support.s,v 1.18 1994/09/16 13:33:27 davidg Exp $
*/
#include "assym.s" /* system definitions */
@ -56,49 +56,9 @@ ENTRY(__divsi3)
idivl 8(%esp)
ret
/*
* I/O bus instructions via C
*/
ENTRY(insb) /* insb(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insb
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insw) /* insw(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insw
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insl) /* insl(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insl
NOP
movl %edi,%eax
popl %edi
ret
/*
* Support for reading real time clock registers
*/
ENTRY(rtcin) /* rtcin(val) */
movl 4(%esp),%eax
outb %al,$0x70
@ -108,45 +68,6 @@ ENTRY(rtcin) /* rtcin(val) */
NOP
ret
ENTRY(outsb) /* outsb(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsb
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsw) /* outsw(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsw
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsl) /* outsl(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsl
NOP
movl %esi,%eax
popl %esi
ret
/*
* bcopy family
*/

View File

@ -30,9 +30,41 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.25 1994/09/25 19:33:22 phk Exp $
*
* Portions:
* Copyright (c) 1993 Charles Hannum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Charles Hannum.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* $Id: cpufunc.h,v 1.26 1994/09/25 20:03:41 davidg Exp $
*/
/*
* Functions to provide access to special i386 instructions.
* XXX - bezillions more are defined in locore.s but are not declared anywhere.
@ -48,6 +80,48 @@
#ifdef __GNUC__
static __inline void
insb(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insb" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
insw(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insw" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
insl(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insl" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
outsb(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsb" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static __inline void
outsw(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsw" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static __inline void
outsl(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsl" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static inline u_char
inb(u_short port)
{
@ -188,12 +262,6 @@ extern void DELAY(int);
void setidt __P((int, void (*)(), int, int));
extern u_long kvtop(void *);
extern void outsb(int /*u_short*/, void *, size_t);
extern void outsw(int /*u_short*/, void *, size_t);
extern void outsl(int /*u_short*/, void *, size_t);
extern void insb(int /*u_short*/, void *, size_t);
extern void insw(int /*u_short*/, void *, size_t);
extern void insl(int /*u_short*/, void *, size_t);
extern void fillw(int /*u_short*/, void *, size_t);
extern void filli(int, void *, size_t);

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: support.s,v 1.17 1994/09/12 11:38:09 davidg Exp $
* $Id: support.s,v 1.18 1994/09/16 13:33:27 davidg Exp $
*/
#include "assym.s" /* system definitions */
@ -56,49 +56,9 @@ ENTRY(__divsi3)
idivl 8(%esp)
ret
/*
* I/O bus instructions via C
*/
ENTRY(insb) /* insb(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insb
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insw) /* insw(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insw
NOP
movl %edi,%eax
popl %edi
ret
ENTRY(insl) /* insl(port, addr, cnt) */
pushl %edi
movl 8(%esp),%edx
movl 12(%esp),%edi
movl 16(%esp),%ecx
cld
rep
insl
NOP
movl %edi,%eax
popl %edi
ret
/*
* Support for reading real time clock registers
*/
ENTRY(rtcin) /* rtcin(val) */
movl 4(%esp),%eax
outb %al,$0x70
@ -108,45 +68,6 @@ ENTRY(rtcin) /* rtcin(val) */
NOP
ret
ENTRY(outsb) /* outsb(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsb
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsw) /* outsw(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsw
NOP
movl %esi,%eax
popl %esi
ret
ENTRY(outsl) /* outsl(port, addr, cnt) */
pushl %esi
movl 8(%esp),%edx
movl 12(%esp),%esi
movl 16(%esp),%ecx
cld
rep
outsl
NOP
movl %esi,%eax
popl %esi
ret
/*
* bcopy family
*/

View File

@ -30,9 +30,41 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: cpufunc.h,v 1.25 1994/09/25 19:33:22 phk Exp $
*
* Portions:
* Copyright (c) 1993 Charles Hannum.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Charles Hannum.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* $Id: cpufunc.h,v 1.26 1994/09/25 20:03:41 davidg Exp $
*/
/*
* Functions to provide access to special i386 instructions.
* XXX - bezillions more are defined in locore.s but are not declared anywhere.
@ -48,6 +80,48 @@
#ifdef __GNUC__
static __inline void
insb(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insb" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
insw(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insw" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
insl(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;insl" :
: "d" (port), "D" (addr), "c" (cnt) : "%edi", "%ecx", "memory");
}
static __inline void
outsb(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsb" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static __inline void
outsw(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsw" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static __inline void
outsl(u_short port, void *addr, int cnt)
{
__asm __volatile("cld;repne;outsl" :
: "d" (port), "S" (addr), "c" (cnt) : "%esi", "%ecx");
}
static inline u_char
inb(u_short port)
{
@ -188,12 +262,6 @@ extern void DELAY(int);
void setidt __P((int, void (*)(), int, int));
extern u_long kvtop(void *);
extern void outsb(int /*u_short*/, void *, size_t);
extern void outsw(int /*u_short*/, void *, size_t);
extern void outsl(int /*u_short*/, void *, size_t);
extern void insb(int /*u_short*/, void *, size_t);
extern void insw(int /*u_short*/, void *, size_t);
extern void insl(int /*u_short*/, void *, size_t);
extern void fillw(int /*u_short*/, void *, size_t);
extern void filli(int, void *, size_t);