summaryrefslogtreecommitdiff
path: root/sys/dev/x86emu/x86emu_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/x86emu/x86emu_util.c')
-rw-r--r--sys/dev/x86emu/x86emu_util.c172
1 files changed, 89 insertions, 83 deletions
diff --git a/sys/dev/x86emu/x86emu_util.c b/sys/dev/x86emu/x86emu_util.c
index e96f3af9b30..e96efc24a42 100644
--- a/sys/dev/x86emu/x86emu_util.c
+++ b/sys/dev/x86emu/x86emu_util.c
@@ -1,36 +1,36 @@
-/* $OpenBSD: x86emu_util.c,v 1.4 2009/06/06 06:05:27 deraadt Exp $ */
+/* $OpenBSD: x86emu_util.c,v 1.5 2009/06/18 14:19:21 pirofti Exp $ */
/* $NetBSD: x86emu_util.c,v 1.2 2007/12/04 17:32:22 joerg Exp $ */
-/****************************************************************************
-*
-* Realmode X86 Emulator Library
-*
-* Copyright (C) 1996-1999 SciTech Software, Inc.
-* Copyright (C) David Mosberger-Tang
-* Copyright (C) 1999 Egbert Eich
-* Copyright (C) 2007 Joerg Sonnenberger
-*
-* ========================================================================
-*
-* Permission to use, copy, modify, distribute, and sell this software and
-* its documentation for any purpose is hereby granted without fee,
-* provided that the above copyright notice appear in all copies and that
-* both that copyright notice and this permission notice appear in
-* supporting documentation, and that the name of the authors not be used
-* in advertising or publicity pertaining to distribution of the software
-* without specific, written prior permission. The authors makes no
-* representations about the suitability of this software for any purpose.
-* It is provided "as is" without express or implied warranty.
-*
-* THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
-* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
-* EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
-* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-* USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-* PERFORMANCE OF THIS SOFTWARE.
-*
-****************************************************************************/
+/*
+ *
+ * Realmode X86 Emulator Library
+ *
+ * Copyright (C) 1996-1999 SciTech Software, Inc.
+ * Copyright (C) David Mosberger-Tang
+ * Copyright (C) 1999 Egbert Eich
+ * Copyright (C) 2007 Joerg Sonnenberger
+ *
+ * ========================================================================
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and
+ * its documentation for any purpose is hereby granted without fee,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of the authors not be used
+ * in advertising or publicity pertaining to distribution of the software
+ * without specific, written prior permission. The authors makes no
+ * representations about the suitability of this software for any purpose.
+ * It is provided "as is" without express or implied warranty.
+ *
+ * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
#include <sys/param.h>
#include <sys/endian.h>
@@ -39,16 +39,17 @@
#include <dev/x86emu/x86emu_regs.h>
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-RETURNS:
-Byte value read from emulator memory.
-
-REMARKS:
-Reads a byte value from the emulator memory.
-****************************************************************************/
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ *
+ * RETURNS:
+ * Byte value read from emulator memory.
+ *
+ * REMARKS:
+ * Reads a byte value from the emulator memory.
+ */
static uint8_t
rdb(struct x86emu *emu, uint32_t addr)
{
@@ -56,16 +57,17 @@ rdb(struct x86emu *emu, uint32_t addr)
x86emu_halt_sys(emu);
return emu->mem_base[addr];
}
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-
-RETURNS:
-Word value read from emulator memory.
-REMARKS:
-Reads a word value from the emulator memory.
-****************************************************************************/
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ *
+ * RETURNS:
+ * Word value read from emulator memory.
+ *
+ * REMARKS:
+ * Reads a word value from the emulator memory.
+ */
static uint16_t
rdw(struct x86emu *emu, uint32_t addr)
{
@@ -85,15 +87,16 @@ rdw(struct x86emu *emu, uint32_t addr)
return letoh16(*(u_int16_t *)(emu->mem_base + addr));
#endif
}
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-
-RETURNS:
-Long value read from emulator memory.
-REMARKS:
-Reads a long value from the emulator memory.
-****************************************************************************/
+
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ *
+ * RETURNS:
+ * Long value read from emulator memory.
+ * REMARKS:
+ * Reads a long value from the emulator memory.
+ */
static uint32_t
rdl(struct x86emu *emu, uint32_t addr)
{
@@ -115,14 +118,15 @@ rdl(struct x86emu *emu, uint32_t addr)
return letoh32(*(u_int32_t *)(emu->mem_base + addr));
#endif
}
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-val - Value to store
-
-REMARKS:
-Writes a byte value to emulator memory.
-****************************************************************************/
+
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ * val - Value to store
+ *
+ * REMARKS:
+ * Writes a byte value to emulator memory.
+ */
static void
wrb(struct x86emu *emu, uint32_t addr, uint8_t val)
{
@@ -130,14 +134,15 @@ wrb(struct x86emu *emu, uint32_t addr, uint8_t val)
x86emu_halt_sys(emu);
emu->mem_base[addr] = val;
}
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-val - Value to store
-
-REMARKS:
-Writes a word value to emulator memory.
-****************************************************************************/
+
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ * val - Value to store
+ *
+ * REMARKS:
+ * Writes a word value to emulator memory.
+ */
static void
wrw(struct x86emu *emu, uint32_t addr, uint16_t val)
{
@@ -155,14 +160,15 @@ wrw(struct x86emu *emu, uint32_t addr, uint16_t val)
*((u_int16_t *)(emu->mem_base + addr)) = htole16(val);
#endif
}
-/****************************************************************************
-PARAMETERS:
-addr - Emulator memory address to read
-val - Value to store
-
-REMARKS:
-Writes a long value to emulator memory.
-****************************************************************************/
+
+/*
+ * PARAMETERS:
+ * addr - Emulator memory address to read
+ * val - Value to store
+ *
+ * REMARKS:
+ * Writes a long value to emulator memory.
+ */
static void
wrl(struct x86emu *emu, uint32_t addr, uint32_t val)
{
@@ -183,7 +189,7 @@ wrl(struct x86emu *emu, uint32_t addr, uint32_t val)
#endif
}
-/*----------------------------- Setup -------------------------------------*/
+/* Setup */
void
x86emu_init_default(struct x86emu *emu)