From 4859f66288057b4d8fffdacb5ed973777744f8ac Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 17 Apr 2011 13:18:51 +0000 Subject: [PATCH] Re-introduced the i686 architecture --- Makefile | 4 +++ src/arch/Makefile | 17 +++++++-- src/arch/i386.reg | 1 + src/arch/i686.c | 82 +++++++++++++++++++++++++++++++++++++++++++ src/arch/i686.ins | 20 +++++++++++ src/arch/i686.reg | 9 +++++ src/arch/project.conf | 12 +++++-- test/Makefile | 10 ++++-- test/project.conf | 10 +++++- 9 files changed, 158 insertions(+), 7 deletions(-) create mode 100644 src/arch/i686.c create mode 100644 src/arch/i686.ins create mode 100644 src/arch/i686.reg diff --git a/Makefile b/Makefile index a192a89..fb7b0eb 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/i686.c \ $(PACKAGE)-$(VERSION)/src/arch/sparc.c \ $(PACKAGE)-$(VERSION)/src/arch/Makefile \ $(PACKAGE)-$(VERSION)/src/arch/common.ins \ @@ -59,6 +60,8 @@ dist: $(PACKAGE)-$(VERSION)/src/arch/i386.ins \ $(PACKAGE)-$(VERSION)/src/arch/i386.reg \ $(PACKAGE)-$(VERSION)/src/arch/i486.ins \ + $(PACKAGE)-$(VERSION)/src/arch/i686.ins \ + $(PACKAGE)-$(VERSION)/src/arch/i686.reg \ $(PACKAGE)-$(VERSION)/src/arch/null.ins \ $(PACKAGE)-$(VERSION)/src/arch/sparc.ins \ $(PACKAGE)-$(VERSION)/src/arch/sparc.reg \ @@ -73,6 +76,7 @@ dist: $(PACKAGE)-$(VERSION)/test/i386.S \ $(PACKAGE)-$(VERSION)/test/i386_real.S \ $(PACKAGE)-$(VERSION)/test/i486.S \ + $(PACKAGE)-$(VERSION)/test/i686.S \ $(PACKAGE)-$(VERSION)/test/sparc.S \ $(PACKAGE)-$(VERSION)/test/Makefile \ $(PACKAGE)-$(VERSION)/test/project.conf \ diff --git a/src/arch/Makefile b/src/arch/Makefile index ca56d9b..6e36e1c 100644 --- a/src/arch/Makefile +++ b/src/arch/Makefile @@ -1,4 +1,4 @@ -TARGETS = i386.so i386_real.so i486.so sparc.so +TARGETS = i386.so i386_real.so i486.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) +i686_OBJS = i686.o +i686_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) +i686_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) + +i686.so: $(i686_OBJS) + $(LD) -o i686.so $(i686_OBJS) $(i686_LDFLAGS) + sparc_OBJS = sparc.o sparc_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) sparc_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) @@ -55,11 +62,14 @@ 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 +i686.o: i686.c common.ins null.ins i386.h i386.ins i386.reg i486.ins i686.reg + $(CC) $(i686_CFLAGS) -c i686.c + 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) $(sparc_OBJS) + $(RM) -- $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(i686_OBJS) $(sparc_OBJS) distclean: clean $(RM) -- $(TARGETS) @@ -72,12 +82,15 @@ 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 -- i686.so $(DESTDIR)$(LIBDIR)/asm/arch/i686.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/i686.so $(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so .PHONY: all clean distclean install uninstall diff --git a/src/arch/i386.reg b/src/arch/i386.reg index 31ebbcf..76a83d0 100644 --- a/src/arch/i386.reg +++ b/src/arch/i386.reg @@ -1,3 +1,4 @@ +/* $Id$ */ REG(al, 8, 0x00) REG(cl, 8, 0x01) REG(dl, 8, 0x02) diff --git a/src/arch/i686.c b/src/arch/i686.c new file mode 100644 index 0000000..9f7d4a2 --- /dev/null +++ b/src/arch/i686.c @@ -0,0 +1,82 @@ +/* $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" + + +/* i686 */ +/* 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" +#include "i686.reg" + REG_id_count +}; +#undef REG + + +/* variables */ +#define REG(name, size, id) { "" # name, size, id }, +static ArchRegister _i686_registers[] = +{ +#include "i386.reg" +#include "i686.reg" + { NULL, 0, 0 } +}; +#undef REG + +static ArchInstruction _i686_instructions[] = +{ +#include "i386.ins" +#include "i486.ins" +#include "i686.ins" +#include "common.ins" +#include "null.ins" +}; + + +/* functions */ +#include "i386.h" + + +/* public */ +/* variables */ +/* plug-in */ +ArchPlugin arch_plugin = +{ + NULL, + "i686", + NULL, + _i686_registers, + _i686_instructions, + _i386_write, + NULL +}; diff --git a/src/arch/i686.ins b/src/arch/i686.ins new file mode 100644 index 0000000..505c936 --- /dev/null +++ b/src/arch/i686.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 */ +/* EMMS 0x0f77 2 */ +{ "emms", 0x0f77, OP2F, AOT_NONE, AOT_NONE, AOT_NONE }, diff --git a/src/arch/i686.reg b/src/arch/i686.reg new file mode 100644 index 0000000..107227f --- /dev/null +++ b/src/arch/i686.reg @@ -0,0 +1,9 @@ +/* $Id$ */ +REG(mm0, 64, 0x08) +REG(mm1, 64, 0x09) +REG(mm2, 64, 0x0a) +REG(mm3, 64, 0x0b) +REG(mm4, 64, 0x0c) +REG(mm5, 64, 0x0d) +REG(mm6, 64, 0x0e) +REG(mm7, 64, 0x0f) diff --git a/src/arch/project.conf b/src/arch/project.conf index be7b54f..b5ae78c 100644 --- a/src/arch/project.conf +++ b/src/arch/project.conf @@ -1,8 +1,8 @@ -targets=i386,i386_real,i486,sparc +targets=i386,i386_real,i486,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,null.ins,sparc.ins,sparc.reg +dist=Makefile,common.ins,i386.h,i386.ins,i386.reg,i486.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 +[i686] +type=plugin +sources=i686.c +install=$(LIBDIR)/asm/arch + +[i686.c] +depends=common.ins,null.ins,i386.h,i386.ins,i386.reg,i486.ins,i686.reg + [sparc] type=plugin sources=sparc.c diff --git a/test/Makefile b/test/Makefile index cbd4937..533a82c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,4 +1,4 @@ -TARGETS = i386.o i386_real.o i486.o sparc.o +TARGETS = i386.o i386_real.o i486.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 +i686.o_OBJS = i686.o +i686.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i686 -f flat + sparc.o_OBJS = sparc.o sparc.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a sparc -f flat @@ -33,11 +36,14 @@ i386_real.o: i386_real.S ../src/asm i486.o: i486.S ../src/asm $(AS) $(i486.o_ASFLAGS) -o i486.o i486.S +i686.o: i686.S ../src/asm + $(AS) $(i686.o_ASFLAGS) -o i686.o i686.S + 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) $(sparc.o_OBJS) + $(RM) -- $(i386.o_OBJS) $(i386_real.o_OBJS) $(i486.o_OBJS) $(i686.o_OBJS) $(sparc.o_OBJS) distclean: clean $(RM) -- $(TARGETS) diff --git a/test/project.conf b/test/project.conf index 6897c1b..baf7f95 100644 --- a/test/project.conf +++ b/test/project.conf @@ -1,4 +1,4 @@ -targets=i386.o,i386_real.o,i486.o,sparc.o +targets=i386.o,i386_real.o,i486.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 +[i686.o] +type=object +sources=i686.S + +[i686.S] +asflags=-a i686 -f flat +depends=../src/asm + [sparc.o] type=object sources=sparc.S