diff --git a/Makefile b/Makefile index fb7b0eb..7107a45 100644 --- a/Makefile +++ b/Makefile @@ -52,6 +52,7 @@ dist: $(PACKAGE)-$(VERSION)/src/arch/i386.c \ $(PACKAGE)-$(VERSION)/src/arch/i386_real.c \ $(PACKAGE)-$(VERSION)/src/arch/i486.c \ + $(PACKAGE)-$(VERSION)/src/arch/i586.c \ $(PACKAGE)-$(VERSION)/src/arch/i686.c \ $(PACKAGE)-$(VERSION)/src/arch/sparc.c \ $(PACKAGE)-$(VERSION)/src/arch/Makefile \ @@ -60,6 +61,7 @@ dist: $(PACKAGE)-$(VERSION)/src/arch/i386.ins \ $(PACKAGE)-$(VERSION)/src/arch/i386.reg \ $(PACKAGE)-$(VERSION)/src/arch/i486.ins \ + $(PACKAGE)-$(VERSION)/src/arch/i586.ins \ $(PACKAGE)-$(VERSION)/src/arch/i686.ins \ $(PACKAGE)-$(VERSION)/src/arch/i686.reg \ $(PACKAGE)-$(VERSION)/src/arch/null.ins \ @@ -76,6 +78,7 @@ dist: $(PACKAGE)-$(VERSION)/test/i386.S \ $(PACKAGE)-$(VERSION)/test/i386_real.S \ $(PACKAGE)-$(VERSION)/test/i486.S \ + $(PACKAGE)-$(VERSION)/test/i586.S \ $(PACKAGE)-$(VERSION)/test/i686.S \ $(PACKAGE)-$(VERSION)/test/sparc.S \ $(PACKAGE)-$(VERSION)/test/Makefile \ diff --git a/src/arch/Makefile b/src/arch/Makefile index 6e36e1c..ae43986 100644 --- a/src/arch/Makefile +++ b/src/arch/Makefile @@ -1,4 +1,4 @@ -TARGETS = i386.so i386_real.so i486.so i686.so sparc.so +TARGETS = i386.so i386_real.so i486.so i586.so i686.so sparc.so PREFIX = /usr/local DESTDIR = LIBDIR = $(PREFIX)/lib @@ -39,6 +39,13 @@ i486_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) i486.so: $(i486_OBJS) $(LD) -o i486.so $(i486_OBJS) $(i486_LDFLAGS) +i586_OBJS = i586.o +i586_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) +i586_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) + +i586.so: $(i586_OBJS) + $(LD) -o i586.so $(i586_OBJS) $(i586_LDFLAGS) + i686_OBJS = i686.o i686_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) i686_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) @@ -62,6 +69,9 @@ i386_real.o: i386_real.c common.ins null.ins i386.h i386.ins i386.reg i486.o: i486.c common.ins null.ins i386.h i386.ins i386.reg i486.ins $(CC) $(i486_CFLAGS) -c i486.c +i586.o: i586.c common.ins null.ins i386.h i386.ins i386.reg i486.ins i586.ins + $(CC) $(i586_CFLAGS) -c i586.c + i686.o: i686.c common.ins null.ins i386.h i386.ins i386.reg i486.ins i686.reg $(CC) $(i686_CFLAGS) -c i686.c @@ -69,7 +79,7 @@ sparc.o: sparc.c common.ins null.ins sparc.ins sparc.reg $(CC) $(sparc_CFLAGS) -c sparc.c clean: - $(RM) -- $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(i686_OBJS) $(sparc_OBJS) + $(RM) -- $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(i586_OBJS) $(i686_OBJS) $(sparc_OBJS) distclean: clean $(RM) -- $(TARGETS) @@ -82,6 +92,8 @@ install: $(TARGETS) $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(INSTALL) -m 0644 -- i486.so $(DESTDIR)$(LIBDIR)/asm/arch/i486.so $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch + $(INSTALL) -m 0644 -- i586.so $(DESTDIR)$(LIBDIR)/asm/arch/i586.so + $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(INSTALL) -m 0644 -- i686.so $(DESTDIR)$(LIBDIR)/asm/arch/i686.so $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(INSTALL) -m 0644 -- sparc.so $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so @@ -90,6 +102,7 @@ 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/i586.so $(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i686.so $(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so diff --git a/src/arch/i386.ins b/src/arch/i386.ins index 4b64a5d..cf29bf4 100644 --- a/src/arch/i386.ins +++ b/src/arch/i386.ins @@ -419,6 +419,8 @@ { "fwait", 0x9b, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, /* NOP 0x90 1 */ { "nop", 0x90, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, +/* REP */ +/* FIXME implement */ /* RET 0xc2 1 imm16 */ { "ret", 0xc2, OP1F, OP_U16, AOT_NONE, AOT_NONE }, /* RET 0xca 1 imm16 */ diff --git a/src/arch/i586.c b/src/arch/i586.c new file mode 100644 index 0000000..d4b8667 --- /dev/null +++ b/src/arch/i586.c @@ -0,0 +1,80 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* 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 . */ + + + +#include +#include +#include "Asm.h" + + +/* i586 */ +/* 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 _i586_registers[] = +{ +#include "i386.reg" + { NULL, 0, 0 } +}; +#undef REG + +static ArchInstruction _i586_instructions[] = +{ +#include "i386.ins" +#include "i486.ins" +#include "i586.ins" +#include "common.ins" +#include "null.ins" +}; + + +/* functions */ +#include "i386.h" + + +/* public */ +/* variables */ +/* plug-in */ +ArchPlugin arch_plugin = +{ + NULL, + "i586", + NULL, + _i586_registers, + _i586_instructions, + _i386_write, + NULL +}; diff --git a/src/arch/i586.ins b/src/arch/i586.ins new file mode 100644 index 0000000..8cdd63e --- /dev/null +++ b/src/arch/i586.ins @@ -0,0 +1,20 @@ +/* $Id$ */ +/* Copyright (c) 2011 Pierre Pronchery */ +/* 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 . */ + + + +/* instructions */ +/* RDTSC 0x0f31 2 */ +{ "rdtsc", 0x0f31, OP2F, AOT_NONE, AOT_NONE, AOT_NONE }, diff --git a/src/arch/project.conf b/src/arch/project.conf index b5ae78c..6d9f21a 100644 --- a/src/arch/project.conf +++ b/src/arch/project.conf @@ -1,8 +1,8 @@ -targets=i386,i386_real,i486,i686,sparc +targets=i386,i386_real,i486,i586,i686,sparc cppflags_force=-I ../../include cflags_force=-W cflags=-Wall -fPIC -pedantic -dist=Makefile,common.ins,i386.h,i386.ins,i386.reg,i486.ins,i686.ins,i686.reg,null.ins,sparc.ins,sparc.reg +dist=Makefile,common.ins,i386.h,i386.ins,i386.reg,i486.ins,i586.ins,i686.ins,i686.reg,null.ins,sparc.ins,sparc.reg [i386] type=plugin @@ -28,6 +28,14 @@ install=$(LIBDIR)/asm/arch [i486.c] depends=common.ins,null.ins,i386.h,i386.ins,i386.reg,i486.ins +[i586] +type=plugin +sources=i586.c +install=$(LIBDIR)/asm/arch + +[i586.c] +depends=common.ins,null.ins,i386.h,i386.ins,i386.reg,i486.ins,i586.ins + [i686] type=plugin sources=i686.c diff --git a/test/Makefile b/test/Makefile index 533a82c..b8aa835 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,4 +1,4 @@ -TARGETS = i386.o i386_real.o i486.o i686.o sparc.o +TARGETS = i386.o i386_real.o i486.o i586.o i686.o sparc.o PREFIX = /usr/local DESTDIR = BINDIR = $(PREFIX)/bin @@ -21,6 +21,9 @@ 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 +i586.o_OBJS = i586.o +i586.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i586 -f flat + i686.o_OBJS = i686.o i686.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i686 -f flat @@ -36,6 +39,9 @@ i386_real.o: i386_real.S ../src/asm i486.o: i486.S ../src/asm $(AS) $(i486.o_ASFLAGS) -o i486.o i486.S +i586.o: i586.S ../src/asm + $(AS) $(i586.o_ASFLAGS) -o i586.o i586.S + i686.o: i686.S ../src/asm $(AS) $(i686.o_ASFLAGS) -o i686.o i686.S @@ -43,7 +49,7 @@ sparc.o: sparc.S ../src/asm $(AS) $(sparc.o_ASFLAGS) -o sparc.o sparc.S clean: - $(RM) -- $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(i686.o_OBJS) $(sparc.o_OBJS) + $(RM) -- $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(i586.o_OBJS) $(i686.o_OBJS) $(sparc.o_OBJS) distclean: clean $(RM) -- $(TARGETS) diff --git a/test/i586.S b/test/i586.S new file mode 100644 index 0000000..5c1bf12 --- /dev/null +++ b/test/i586.S @@ -0,0 +1,3 @@ +/* $Id$ */ +.text + rdtsc /* 0f 31 */ diff --git a/test/project.conf b/test/project.conf index baf7f95..820fc80 100644 --- a/test/project.conf +++ b/test/project.conf @@ -1,4 +1,4 @@ -targets=i386.o,i386_real.o,i486.o,i686.o,sparc.o +targets=i386.o,i386_real.o,i486.o,i586.o,i686.o,sparc.o as=../src/asm dist=Makefile @@ -26,6 +26,14 @@ sources=i486.S asflags=-a i486 -f flat depends=../src/asm +[i586.o] +type=object +sources=i586.S + +[i586.S] +asflags=-a i586 -f flat +depends=../src/asm + [i686.o] type=object sources=i686.S