Re-introduced support for the i586 variant of the i386 architecture

This commit is contained in:
Pierre Pronchery 2011-04-18 22:12:51 +00:00
parent a308c18ee0
commit d3ac707bad
9 changed files with 150 additions and 7 deletions

View File

@ -52,6 +52,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/arch/i386.c \ $(PACKAGE)-$(VERSION)/src/arch/i386.c \
$(PACKAGE)-$(VERSION)/src/arch/i386_real.c \ $(PACKAGE)-$(VERSION)/src/arch/i386_real.c \
$(PACKAGE)-$(VERSION)/src/arch/i486.c \ $(PACKAGE)-$(VERSION)/src/arch/i486.c \
$(PACKAGE)-$(VERSION)/src/arch/i586.c \
$(PACKAGE)-$(VERSION)/src/arch/i686.c \ $(PACKAGE)-$(VERSION)/src/arch/i686.c \
$(PACKAGE)-$(VERSION)/src/arch/sparc.c \ $(PACKAGE)-$(VERSION)/src/arch/sparc.c \
$(PACKAGE)-$(VERSION)/src/arch/Makefile \ $(PACKAGE)-$(VERSION)/src/arch/Makefile \
@ -60,6 +61,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/arch/i386.ins \ $(PACKAGE)-$(VERSION)/src/arch/i386.ins \
$(PACKAGE)-$(VERSION)/src/arch/i386.reg \ $(PACKAGE)-$(VERSION)/src/arch/i386.reg \
$(PACKAGE)-$(VERSION)/src/arch/i486.ins \ $(PACKAGE)-$(VERSION)/src/arch/i486.ins \
$(PACKAGE)-$(VERSION)/src/arch/i586.ins \
$(PACKAGE)-$(VERSION)/src/arch/i686.ins \ $(PACKAGE)-$(VERSION)/src/arch/i686.ins \
$(PACKAGE)-$(VERSION)/src/arch/i686.reg \ $(PACKAGE)-$(VERSION)/src/arch/i686.reg \
$(PACKAGE)-$(VERSION)/src/arch/null.ins \ $(PACKAGE)-$(VERSION)/src/arch/null.ins \
@ -76,6 +78,7 @@ dist:
$(PACKAGE)-$(VERSION)/test/i386.S \ $(PACKAGE)-$(VERSION)/test/i386.S \
$(PACKAGE)-$(VERSION)/test/i386_real.S \ $(PACKAGE)-$(VERSION)/test/i386_real.S \
$(PACKAGE)-$(VERSION)/test/i486.S \ $(PACKAGE)-$(VERSION)/test/i486.S \
$(PACKAGE)-$(VERSION)/test/i586.S \
$(PACKAGE)-$(VERSION)/test/i686.S \ $(PACKAGE)-$(VERSION)/test/i686.S \
$(PACKAGE)-$(VERSION)/test/sparc.S \ $(PACKAGE)-$(VERSION)/test/sparc.S \
$(PACKAGE)-$(VERSION)/test/Makefile \ $(PACKAGE)-$(VERSION)/test/Makefile \

View File

@ -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 PREFIX = /usr/local
DESTDIR = DESTDIR =
LIBDIR = $(PREFIX)/lib LIBDIR = $(PREFIX)/lib
@ -39,6 +39,13 @@ i486_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
i486.so: $(i486_OBJS) i486.so: $(i486_OBJS)
$(LD) -o i486.so $(i486_OBJS) $(i486_LDFLAGS) $(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_OBJS = i686.o
i686_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) i686_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
i686_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) 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 i486.o: i486.c common.ins null.ins i386.h i386.ins i386.reg i486.ins
$(CC) $(i486_CFLAGS) -c i486.c $(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 i686.o: i686.c common.ins null.ins i386.h i386.ins i386.reg i486.ins i686.reg
$(CC) $(i686_CFLAGS) -c i686.c $(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 $(CC) $(sparc_CFLAGS) -c sparc.c
clean: 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 distclean: clean
$(RM) -- $(TARGETS) $(RM) -- $(TARGETS)
@ -82,6 +92,8 @@ install: $(TARGETS)
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
$(INSTALL) -m 0644 -- i486.so $(DESTDIR)$(LIBDIR)/asm/arch/i486.so $(INSTALL) -m 0644 -- i486.so $(DESTDIR)$(LIBDIR)/asm/arch/i486.so
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(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 $(INSTALL) -m 0644 -- i686.so $(DESTDIR)$(LIBDIR)/asm/arch/i686.so
$(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch $(MKDIR) $(DESTDIR)$(LIBDIR)/asm/arch
$(INSTALL) -m 0644 -- sparc.so $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so $(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.so
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i386_real.so $(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i386_real.so
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/i486.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/i686.so
$(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so $(RM) -- $(DESTDIR)$(LIBDIR)/asm/arch/sparc.so

View File

@ -419,6 +419,8 @@
{ "fwait", 0x9b, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, { "fwait", 0x9b, OP1F, AOT_NONE, AOT_NONE, AOT_NONE },
/* NOP 0x90 1 */ /* NOP 0x90 1 */
{ "nop", 0x90, OP1F, AOT_NONE, AOT_NONE, AOT_NONE }, { "nop", 0x90, OP1F, AOT_NONE, AOT_NONE, AOT_NONE },
/* REP */
/* FIXME implement */
/* RET 0xc2 1 imm16 */ /* RET 0xc2 1 imm16 */
{ "ret", 0xc2, OP1F, OP_U16, AOT_NONE, AOT_NONE }, { "ret", 0xc2, OP1F, OP_U16, AOT_NONE, AOT_NONE },
/* RET 0xca 1 imm16 */ /* RET 0xca 1 imm16 */

80
src/arch/i586.c Normal file
View File

@ -0,0 +1,80 @@
/* $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"
/* 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
};

20
src/arch/i586.ins Normal file
View File

@ -0,0 +1,20 @@
/* $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/>. */
/* instructions */
/* RDTSC 0x0f31 2 */
{ "rdtsc", 0x0f31, OP2F, AOT_NONE, AOT_NONE, AOT_NONE },

View File

@ -1,8 +1,8 @@
targets=i386,i386_real,i486,i686,sparc targets=i386,i386_real,i486,i586,i686,sparc
cppflags_force=-I ../../include cppflags_force=-I ../../include
cflags_force=-W cflags_force=-W
cflags=-Wall -fPIC -pedantic 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] [i386]
type=plugin type=plugin
@ -28,6 +28,14 @@ install=$(LIBDIR)/asm/arch
[i486.c] [i486.c]
depends=common.ins,null.ins,i386.h,i386.ins,i386.reg,i486.ins 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] [i686]
type=plugin type=plugin
sources=i686.c sources=i686.c

View File

@ -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 PREFIX = /usr/local
DESTDIR = DESTDIR =
BINDIR = $(PREFIX)/bin 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_OBJS = i486.o
i486.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i486 -f flat 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_OBJS = i686.o
i686.o_ASFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(ASFLAGS) -a i686 -f flat 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 i486.o: i486.S ../src/asm
$(AS) $(i486.o_ASFLAGS) -o i486.o i486.S $(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 i686.o: i686.S ../src/asm
$(AS) $(i686.o_ASFLAGS) -o i686.o i686.S $(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 $(AS) $(sparc.o_ASFLAGS) -o sparc.o sparc.S
clean: 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 distclean: clean
$(RM) -- $(TARGETS) $(RM) -- $(TARGETS)

3
test/i586.S Normal file
View File

@ -0,0 +1,3 @@
/* $Id$ */
.text
rdtsc /* 0f 31 */

View File

@ -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 as=../src/asm
dist=Makefile dist=Makefile
@ -26,6 +26,14 @@ sources=i486.S
asflags=-a i486 -f flat asflags=-a i486 -f flat
depends=../src/asm depends=../src/asm
[i586.o]
type=object
sources=i586.S
[i586.S]
asflags=-a i586 -f flat
depends=../src/asm
[i686.o] [i686.o]
type=object type=object
sources=i686.S sources=i686.S