Re-introduced support for the i386 architecture in real mode
This commit is contained in:
parent
bcbded6fcc
commit
3f54a1eff2
2
Makefile
2
Makefile
@ -50,6 +50,7 @@ dist:
|
||||
$(PACKAGE)-$(VERSION)/src/token.h \
|
||||
$(PACKAGE)-$(VERSION)/src/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/src/arch/i386.c \
|
||||
$(PACKAGE)-$(VERSION)/src/arch/i386_real.c \
|
||||
$(PACKAGE)-$(VERSION)/src/arch/i486.c \
|
||||
$(PACKAGE)-$(VERSION)/src/arch/sparc.c \
|
||||
$(PACKAGE)-$(VERSION)/src/arch/Makefile \
|
||||
@ -70,6 +71,7 @@ dist:
|
||||
$(PACKAGE)-$(VERSION)/src/format/Makefile \
|
||||
$(PACKAGE)-$(VERSION)/src/format/project.conf \
|
||||
$(PACKAGE)-$(VERSION)/test/i386.S \
|
||||
$(PACKAGE)-$(VERSION)/test/i386_real.S \
|
||||
$(PACKAGE)-$(VERSION)/test/i486.S \
|
||||
$(PACKAGE)-$(VERSION)/test/sparc.S \
|
||||
$(PACKAGE)-$(VERSION)/test/Makefile \
|
||||
|
@ -1,4 +1,4 @@
|
||||
TARGETS = i386.so i486.so sparc.so
|
||||
TARGETS = i386.so i386_real.so i486.so sparc.so
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
LIBDIR = $(PREFIX)/lib
|
||||
@ -25,6 +25,13 @@ i386_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
i386.so: $(i386_OBJS)
|
||||
$(LD) -o i386.so $(i386_OBJS) $(i386_LDFLAGS)
|
||||
|
||||
i386_real_OBJS = i386_real.o
|
||||
i386_real_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
i386_real_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
|
||||
i386_real.so: $(i386_real_OBJS)
|
||||
$(LD) -o i386_real.so $(i386_real_OBJS) $(i386_real_LDFLAGS)
|
||||
|
||||
i486_OBJS = i486.o
|
||||
i486_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
|
||||
i486_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
|
||||
@ -42,6 +49,9 @@ sparc.so: $(sparc_OBJS)
|
||||
i386.o: i386.c common.ins null.ins i386.h i386.ins i386.reg
|
||||
$(CC) $(i386_CFLAGS) -c i386.c
|
||||
|
||||
i386_real.o: i386_real.c common.ins null.ins i386.h i386.ins i386.reg
|
||||
$(CC) $(i386_real_CFLAGS) -c i386_real.c
|
||||
|
||||
i486.o: i486.c common.ins null.ins i386.h i386.ins i386.reg i486.ins
|
||||
$(CC) $(i486_CFLAGS) -c i486.c
|
||||
|
||||
@ -49,7 +59,7 @@ sparc.o: sparc.c common.ins null.ins sparc.ins sparc.reg
|
||||
$(CC) $(sparc_CFLAGS) -c sparc.c
|
||||
|
||||
clean:
|
||||
$(RM) -- $(i386_OBJS) $(i486_OBJS) $(sparc_OBJS)
|
||||
$(RM) -- $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(sparc_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
@ -58,12 +68,15 @@ install: $(TARGETS)
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
|
||||
$(INSTALL) -m 0644 -- i386.so $(DESTDIR)$(LIBDIR)/asm/arch/i386.so
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
|
||||
$(INSTALL) -m 0644 -- i386_real.so $(DESTDIR)$(LIBDIR)/asm/arch/i386_real.so
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
|
||||
$(INSTALL) -m 0644 -- i486.so $(DESTDIR)$(LIBDIR)/asm/arch/i486.so
|
||||
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
|
||||
$(INSTALL) -m 0644 -- sparc.so $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so
|
||||
|
||||
uninstall:
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i386.so
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i386_real.so
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i486.so
|
||||
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so
|
||||
|
||||
|
@ -248,5 +248,14 @@
|
||||
{ "bts", 0x0fba, OP2F, OP_RMW_D8+5,OP_S8, AOT_NONE },
|
||||
{ "bts", 0x0fba, OP2F, OP_RMW_DW+5,OP_S8, AOT_NONE },
|
||||
{ "bts", 0x0fba, OP2F, OP_RMW_RW+5,OP_S8, AOT_NONE },
|
||||
/* CALL */
|
||||
/* FIXME implement */
|
||||
#if defined(ARCH_i386_real) /* i386 in real mode */
|
||||
/* CBW */
|
||||
{ "cbw", 0x98, OP1F, AOT_NONE, AOT_NONE, AOT_NONE },
|
||||
#else
|
||||
/* CWDE */
|
||||
{ "cwde", 0x98, OP1F, AOT_NONE, AOT_NONE, AOT_NONE },
|
||||
#endif
|
||||
/* NOP */
|
||||
{ "nop", 0x90, OP1F, AOT_NONE, AOT_NONE, AOT_NONE },
|
||||
|
79
src/arch/i386_real.c
Normal file
79
src/arch/i386_real.c
Normal file
@ -0,0 +1,79 @@
|
||||
/* $Id$ */
|
||||
/* Copyright (c) 2011 Pierre Pronchery <khorben@defora.org> */
|
||||
/* This file is part of DeforaOS Devel asm */
|
||||
/* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 3 of the License.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include "Asm.h"
|
||||
#define ARCH_i386_real
|
||||
|
||||
|
||||
/* i386_real */
|
||||
/* private */
|
||||
/* types */
|
||||
/* register sizes */
|
||||
#define REG(name, size, id) REG_ ## name ## _size = size,
|
||||
enum
|
||||
{
|
||||
#include "i386.reg"
|
||||
REG_size_count
|
||||
};
|
||||
#undef REG
|
||||
|
||||
/* register ids */
|
||||
#define REG(name, size, id) REG_ ## name ## _id = id,
|
||||
enum
|
||||
{
|
||||
#include "i386.reg"
|
||||
REG_id_count
|
||||
};
|
||||
#undef REG
|
||||
|
||||
|
||||
/* variables */
|
||||
#define REG(name, size, id) { "" # name, size, id },
|
||||
static ArchRegister _i386_real_registers[] =
|
||||
{
|
||||
#include "i386.reg"
|
||||
{ NULL, 0, 0 }
|
||||
};
|
||||
#undef REG
|
||||
|
||||
static ArchInstruction _i386_real_instructions[] =
|
||||
{
|
||||
#include "i386.ins"
|
||||
#include "common.ins"
|
||||
#include "null.ins"
|
||||
};
|
||||
|
||||
|
||||
/* functions */
|
||||
#include "i386.h"
|
||||
|
||||
|
||||
/* public */
|
||||
/* variables */
|
||||
/* plug-in */
|
||||
ArchPlugin arch_plugin =
|
||||
{
|
||||
NULL,
|
||||
"i386_real",
|
||||
NULL,
|
||||
_i386_real_registers,
|
||||
_i386_real_instructions,
|
||||
_i386_write,
|
||||
NULL
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
targets=i386,i486,sparc
|
||||
targets=i386,i386_real,i486,sparc
|
||||
cppflags_force=-I ../../include
|
||||
cflags_force=-W
|
||||
cflags=-Wall -fPIC -pedantic
|
||||
@ -12,6 +12,14 @@ install=$(LIBDIR)/asm/arch
|
||||
[i386.c]
|
||||
depends=common.ins,null.ins,i386.h,i386.ins,i386.reg
|
||||
|
||||
[i386_real]
|
||||
type=plugin
|
||||
sources=i386_real.c
|
||||
install=$(LIBDIR)/asm/arch
|
||||
|
||||
[i386_real.c]
|
||||
depends=common.ins,null.ins,i386.h,i386.ins,i386.reg
|
||||
|
||||
[i486]
|
||||
type=plugin
|
||||
sources=i486.c
|
||||
|
@ -1,4 +1,4 @@
|
||||
TARGETS = i386.o i486.o sparc.o
|
||||
TARGETS = i386.o i386_real.o i486.o sparc.o
|
||||
PREFIX = /usr/local
|
||||
DESTDIR =
|
||||
BINDIR = $(PREFIX)/bin
|
||||
@ -15,6 +15,9 @@ all: $(TARGETS)
|
||||
i386.o_OBJS = i386.o
|
||||
i386.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i386 -f flat
|
||||
|
||||
i386_real.o_OBJS = i386_real.o
|
||||
i386_real.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i386_real -f flat
|
||||
|
||||
i486.o_OBJS = i486.o
|
||||
i486.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i486 -f flat
|
||||
|
||||
@ -24,6 +27,9 @@ sparc.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc -f flat
|
||||
i386.o: i386.S ../src/asm
|
||||
$(AS) $(i386.o_ASFLAGS) -o i386.o i386.S
|
||||
|
||||
i386_real.o: i386_real.S ../src/asm
|
||||
$(AS) $(i386_real.o_ASFLAGS) -o i386_real.o i386_real.S
|
||||
|
||||
i486.o: i486.S ../src/asm
|
||||
$(AS) $(i486.o_ASFLAGS) -o i486.o i486.S
|
||||
|
||||
@ -31,7 +37,7 @@ sparc.o: sparc.S ../src/asm
|
||||
$(AS) $(sparc.o_ASFLAGS) -o sparc.o sparc.S
|
||||
|
||||
clean:
|
||||
$(RM) -- $(i386.o_OBJS) $(i486.o_OBJS) $(sparc.o_OBJS)
|
||||
$(RM) -- $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(sparc.o_OBJS)
|
||||
|
||||
distclean: clean
|
||||
$(RM) -- $(TARGETS)
|
||||
|
@ -74,5 +74,7 @@
|
||||
bts [%eax], %ecx /* 0f ab 08 */
|
||||
bts %eax, $0x42 /* 0f ba e8 42 */
|
||||
bts [%eax], $0x42 /* 0f ba 28 42 */
|
||||
/* CWDE */
|
||||
cwde
|
||||
/* NOP */
|
||||
nop
|
||||
|
4
test/i386_real.S
Normal file
4
test/i386_real.S
Normal file
@ -0,0 +1,4 @@
|
||||
/* $Id$ */
|
||||
.text
|
||||
/* CBW */
|
||||
cbw
|
@ -1,4 +1,4 @@
|
||||
targets=i386.o,i486.o,sparc.o
|
||||
targets=i386.o,i386_real.o,i486.o,sparc.o
|
||||
as=../src/asm
|
||||
dist=Makefile
|
||||
|
||||
@ -10,6 +10,14 @@ sources=i386.S
|
||||
asflags=-a i386 -f flat
|
||||
depends=../src/asm
|
||||
|
||||
[i386_real.o]
|
||||
type=object
|
||||
sources=i386_real.S
|
||||
|
||||
[i386_real.S]
|
||||
asflags=-a i386_real -f flat
|
||||
depends=../src/asm
|
||||
|
||||
[i486.o]
|
||||
type=object
|
||||
sources=i486.S
|
||||
|
Loading…
Reference in New Issue
Block a user