sh2 drc: add aarch64 backend for A64

This commit is contained in:
kub 2019-07-30 21:04:16 +02:00
parent d80a5fd2ab
commit b90e104fc9
5 changed files with 1404 additions and 6 deletions

View file

@ -49,15 +49,18 @@ asm_cdmemory ?= 1
asm_mix ?= 1
asm_32xdraw ?= 1
asm_32xmemory ?= 1
else # if not arm
else ifneq (,$(findstring 86,$(ARCH)))
use_fame ?= 1
use_cz80 ?= 1
ifneq (,$(findstring 86,$(ARCH)))
use_sh2drc ?= 1
endif
ifneq (,$(findstring mips,$(ARCH)))
else ifneq (,$(findstring mips,$(ARCH)))
use_fame ?= 1
use_cz80 ?= 1
use_sh2drc ?= 1
else ifneq (,$(findstring aarch64,$(ARCH)))
use_fame ?= 1
use_cz80 ?= 1
use_sh2drc ?= 1
endif
endif
-include Makefile.local
@ -247,7 +250,7 @@ pico/carthw_cfg.c: pico/carthw.cfg
# random deps
pico/carthw/svp/compiler.o : cpu/drc/emit_arm.c
cpu/sh2/compiler.o : cpu/drc/emit_arm.c
cpu/sh2/compiler.o : cpu/drc/emit_arm.c cpu/drc/emit_arm64.c
cpu/sh2/compiler.o : cpu/drc/emit_x86.c cpu/drc/emit_mips.c
cpu/sh2/mame/sh2pico.o : cpu/sh2/mame/sh2.c
pico/pico.o pico/cd/mcd.o pico/32x/32x.o : pico/pico_cmn.c pico/pico_int.h

15
config.aarch64 Normal file
View file

@ -0,0 +1,15 @@
# Automatically generated by configure
# Configured with: './configure' '--platform=generic'
CC = aarch64-linux-gnu-gcc
CXX = aarch64-linux-gnu-g++
AS = aarch64-linux-gnu-as
STRIP = aarch64-linux-gnu-strip
CFLAGS += -I/usr/include/SDL
CFLAGS += -D_GNU_SOURCE=1 -D_REENTRANT -Wno-unused-result -fno-stack-protector
ASFLAGS +=
LDFLAGS +=
LDLIBS += -lSDL -lasound -lpng -lz -lm -lstdc++ -ldl
ARCH = aarch64
PLATFORM = generic
SOUND_DRIVERS = alsa

1328
cpu/drc/emit_arm64.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -466,6 +466,56 @@ static cache_reg_t cache_regs[] = {
{ 7, HRF_REG },
};
#elif defined(__aarch64__)
#include "../drc/emit_arm64.c"
static guest_reg_t guest_regs[] = {
// SHR_R0 .. SHR_SP
{ GRF_STATIC,20 }, { GRF_STATIC,21 }, { 0 } , { 0 } ,
{ 0 } , { 0 } , { 0 } , { 0 } ,
{ 0 } , { 0 } , { 0 } , { 0 } ,
{ 0 } , { 0 } , { 0 } , { 0 } ,
// SHR_PC, SHR_PPC, SHR_PR, SHR_SR,
// SHR_GBR, SHR_VBR, SHR_MACH, SHR_MACL,
{ 0 } , { 0 } , { 0 } , { GRF_STATIC, 22 },
{ 0 } , { 0 } , { 0 } , { 0 } ,
};
// AAPCS64: params: r0-r7, return: r0-r1, temp: r8-r17, saved: r19-r29
// saved: r18 (for platform use)
// since drc never needs more than 4 parameters, r4-r7 are treated as temp.
static cache_reg_t cache_regs[] = {
{ 17, HRF_TEMP }, // temps
{ 16, HRF_TEMP },
{ 15, HRF_TEMP },
{ 14, HRF_TEMP },
{ 13, HRF_TEMP },
{ 12, HRF_TEMP },
{ 11, HRF_TEMP },
{ 10, HRF_TEMP },
{ 9, HRF_TEMP },
{ 8, HRF_TEMP },
{ 7, HRF_TEMP },
{ 6, HRF_TEMP },
{ 5, HRF_TEMP },
{ 4, HRF_TEMP },
{ 3, HRF_TEMP }, // params
{ 2, HRF_TEMP },
{ 1, HRF_TEMP },
{ 0, HRF_TEMP }, // RET_REG
{ 22, HRF_LOCKED }, // statics
{ 21, HRF_LOCKED },
{ 20, HRF_LOCKED },
{ 29, HRF_REG }, // other regs
{ 28, HRF_REG },
{ 27, HRF_REG },
{ 26, HRF_REG },
{ 25, HRF_REG },
{ 24, HRF_REG },
{ 23, HRF_REG },
{ 22, HRF_REG },
};
#elif defined(__mips__)
#include "../drc/emit_mips.c"

View file

@ -36,6 +36,8 @@ unsigned short scan_block(unsigned int base_pc, int is_slave,
// XXX MUST match definitions in cpu/sh2/compiler.c
#if defined(__arm__)
#define DRC_SR_REG r10
#elif defined(__aarch64__)
#define DRC_SR_REG r22
#elif defined(__mips__)
#define DRC_SR_REG s6
#elif defined(__i386__)