Introducing the yasep architecture

This commit is contained in:
Pierre Pronchery 2011-09-28 12:04:05 +00:00
parent 9e9030f8df
commit fa4614af23
5 changed files with 113 additions and 4 deletions

View File

@ -61,6 +61,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/arch/mips.c \
$(PACKAGE)-$(VERSION)/src/arch/sparc.c \
$(PACKAGE)-$(VERSION)/src/arch/sparc64.c \
$(PACKAGE)-$(VERSION)/src/arch/yasep.c \
$(PACKAGE)-$(VERSION)/src/arch/Makefile \
$(PACKAGE)-$(VERSION)/src/arch/amd64.ins \
$(PACKAGE)-$(VERSION)/src/arch/amd64.reg \
@ -84,6 +85,7 @@ dist:
$(PACKAGE)-$(VERSION)/src/arch/sparc.h \
$(PACKAGE)-$(VERSION)/src/arch/sparc.ins \
$(PACKAGE)-$(VERSION)/src/arch/sparc.reg \
$(PACKAGE)-$(VERSION)/src/arch/yasep.ins \
$(PACKAGE)-$(VERSION)/src/arch/project.conf \
$(PACKAGE)-$(VERSION)/src/format/dex.c \
$(PACKAGE)-$(VERSION)/src/format/elf.c \

View File

@ -1,4 +1,4 @@
TARGETS = amd64.so arm.so dalvik.so i386.so i386_real.so i486.so i586.so i686.so java.so mips.so sparc.so sparc64.so
TARGETS = amd64.so arm.so dalvik.so i386.so i386_real.so i486.so i586.so i686.so java.so mips.so sparc.so sparc64.so yasep.so
PREFIX = /usr/local
DESTDIR =
LIBDIR = $(PREFIX)/lib
@ -102,6 +102,13 @@ sparc64_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
sparc64.so: $(sparc64_OBJS)
$(CCSHARED) -o sparc64.so $(sparc64_OBJS) $(sparc64_LDFLAGS)
yasep_OBJS = yasep.o
yasep_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS)
yasep_LDFLAGS = $(LDFLAGSF) $(LDFLAGS)
yasep.so: $(yasep_OBJS)
$(CCSHARED) -o yasep.so $(yasep_OBJS) $(yasep_LDFLAGS)
amd64.o: amd64.c amd64.ins amd64.reg common.ins null.ins i386.h i386.ins i386.reg i486.ins i686.ins i686.reg
$(CC) $(amd64_CFLAGS) -c amd64.c
@ -138,8 +145,11 @@ sparc.o: sparc.c common.ins null.ins sparc.h sparc.ins sparc.reg
sparc64.o: sparc64.c common.ins null.ins sparc.h sparc.ins sparc.reg
$(CC) $(sparc64_CFLAGS) -c sparc64.c
yasep.o: yasep.c common.ins null.ins yasep.ins
$(CC) $(yasep_CFLAGS) -c yasep.c
clean:
$(RM) -- $(amd64_OBJS) $(arm_OBJS) $(dalvik_OBJS) $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(i586_OBJS) $(i686_OBJS) $(java_OBJS) $(mips_OBJS) $(sparc_OBJS) $(sparc64_OBJS)
$(RM) -- $(amd64_OBJS) $(arm_OBJS) $(dalvik_OBJS) $(i386_OBJS) $(i386_real_OBJS) $(i486_OBJS) $(i586_OBJS) $(i686_OBJS) $(java_OBJS) $(mips_OBJS) $(sparc_OBJS) $(sparc64_OBJS) $(yasep_OBJS)
distclean: clean
$(RM) -- $(TARGETS)

View File

@ -1,8 +1,8 @@
targets=amd64,arm,dalvik,i386,i386_real,i486,i586,i686,java,mips,sparc,sparc64
targets=amd64,arm,dalvik,i386,i386_real,i486,i586,i686,java,mips,sparc,sparc64,yasep
cppflags_force=-I ../../include
cflags_force=-W `pkg-config --cflags libSystem`
cflags=-Wall -g -O2 -fPIC -pedantic
dist=Makefile,amd64.ins,amd64.reg,arm.h,arm.ins,arm.reg,common.ins,dalvik.ins,dalvik.reg,i386.h,i386.ins,i386.reg,i486.ins,i586.ins,i686.ins,i686.reg,mips.h,mips.ins,mips.reg,null.ins,sparc.h,sparc.ins,sparc.reg
dist=Makefile,amd64.ins,amd64.reg,arm.h,arm.ins,arm.reg,common.ins,dalvik.ins,dalvik.reg,i386.h,i386.ins,i386.reg,i486.ins,i586.ins,i686.ins,i686.reg,mips.h,mips.ins,mips.reg,null.ins,sparc.h,sparc.ins,sparc.reg,yasep.ins
[amd64]
type=plugin
@ -99,3 +99,10 @@ install=$(LIBDIR)/asm/arch
[sparc64.c]
depends=common.ins,null.ins,sparc.h,sparc.ins,sparc.reg
[yasep]
type=plugin
sources=yasep.c
[yasep.c]
depends=common.ins,null.ins,yasep.ins

50
src/arch/yasep.c Normal file
View File

@ -0,0 +1,50 @@
/* $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 "Asm.h"
/* yasep */
/* private */
/* variables */
static ArchInstruction _yasep_instructions[] =
{
#include "yasep.ins"
#include "common.ins"
#include "null.ins"
};
/* functions */
/* plug-in */
/* protected */
/* variables */
ArchPlugin arch_plugin =
{
NULL,
"yasep",
NULL,
NULL,
_yasep_instructions,
NULL,
NULL,
NULL,
NULL
};

40
src/arch/yasep.ins Normal file
View File

@ -0,0 +1,40 @@
/* $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/>. */
/* generic */
/* opcode */
#define OPIR(opcode) (opcode << 2)
#define OPRR(opcode) ((opcode << 2) | 0x2)
#define OPIRL(opcode) ((opcode << 2) | 0x1)
#define OPRRL(opcode) ((opcode << 2) | 0x3)
/* flags */
#define OPIRF (16 << AOD_SIZE)
#define OPRRF (16 << AOD_SIZE)
#define OPIRLF (32 << AOD_SIZE)
#define OPRRLF (32 << AOD_SIZE)
/* operands */
#define OP_DST3 AO_REGISTER(0, 32, 0)
#define OP_IMM4 AO_IMMEDIATE(0, 4, 0)
#define OP_IMM16 AO_IMMEDIATE(0, 16, 0)
#define OP_SI4 AO_REGISTER(0, 32, 0)
#define OP_SND AO_REGISTER(0, 32, 0)
/* instructions */
{ "add", OPIR(0x0c), OPIRF, AO_2(OP_IMM4, OP_SND) },
{ "add", OPRR(0x0c), OPRRF, AO_2(OP_SI4, OP_SND) },
{ "add", OPIRL(0x0c),OPIRLF, AO_2(OP_SI4, OP_IMM16) },
{ "add", OPRRL(0x0c),OPRRLF, AO_3(OP_SND, OP_SI4, OP_DST3) },