Merge pull request #6164 from starfrost013/bugfixes
Remove x86 and ARM32 support
This commit is contained in:
6
.ci/Jenkinsfile
vendored
6
.ci/Jenkinsfile
vendored
@@ -36,11 +36,8 @@ def osFlags = [
|
||||
]
|
||||
|
||||
def archNames = [
|
||||
'32': 'x86 (32-bit)',
|
||||
'x86': 'x86 (32-bit)',
|
||||
'64': 'x64 (64-bit)',
|
||||
'x86_64': 'x64 (64-bit)',
|
||||
'arm32': 'ARM (32-bit)',
|
||||
'arm64': 'ARM (64-bit)'
|
||||
]
|
||||
|
||||
@@ -57,11 +54,8 @@ def dynarecNames = [
|
||||
]
|
||||
|
||||
def dynarecArchs = [
|
||||
'32': ['ODR', 'NDR'],
|
||||
'x86': ['ODR', 'NDR'],
|
||||
'64': ['ODR', 'NDR'],
|
||||
'x86_64': ['ODR', 'NDR'],
|
||||
'arm32': ['NDR'],
|
||||
'arm64': ['NDR'],
|
||||
'x86_64+arm64': ['ODR', 'NDR']
|
||||
]
|
||||
|
||||
11
.ci/build.sh
11
.ci/build.sh
@@ -325,9 +325,7 @@ echo [-] Building [$package_name] for [$arch] with flags [$cmake_flags]
|
||||
toolchain_prefix=flags-gcc
|
||||
is_mac && toolchain_prefix=llvm-macos
|
||||
case $arch in
|
||||
32 | x86) toolchain="$toolchain_prefix-i686";;
|
||||
64 | x86_64*) toolchain="$toolchain_prefix-x86_64";;
|
||||
ARM32 | arm32) toolchain="$toolchain_prefix-armv7";;
|
||||
ARM64 | arm64) toolchain="$toolchain_prefix-aarch64";;
|
||||
*) toolchain="$toolchain_prefix-$arch";;
|
||||
esac
|
||||
@@ -670,9 +668,7 @@ then
|
||||
else
|
||||
# Determine Debian architecture.
|
||||
case $arch in
|
||||
x86) arch_deb="i386";;
|
||||
x86_64) arch_deb="amd64";;
|
||||
arm32) arch_deb="armhf";;
|
||||
*) arch_deb="$arch";;
|
||||
esac
|
||||
grep -q " bullseye " /etc/apt/sources.list || echo [!] WARNING: System not running the expected Debian version
|
||||
@@ -710,15 +706,12 @@ else
|
||||
|
||||
# Determine toolchain architecture triplet.
|
||||
case $arch in
|
||||
x86) arch_triplet="i686-linux-gnu";;
|
||||
arm32) arch_triplet="arm-linux-gnueabihf";;
|
||||
arm64) arch_triplet="aarch64-linux-gnu";;
|
||||
*) arch_triplet="$arch-linux-gnu";;
|
||||
esac
|
||||
|
||||
# Determine library directory name for this architecture.
|
||||
case $arch in
|
||||
x86) libdir="i386-linux-gnu";;
|
||||
*) libdir="$arch_triplet";;
|
||||
esac
|
||||
|
||||
@@ -791,9 +784,7 @@ rm -rf build
|
||||
|
||||
# Add ARCH to skip the arch_detect process.
|
||||
case $arch in
|
||||
32 | x86) cmake_flags_extra="$cmake_flags_extra -D ARCH=i386";;
|
||||
64 | x86_64*) cmake_flags_extra="$cmake_flags_extra -D ARCH=x86_64";;
|
||||
ARM32 | arm32) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm -D NEW_DYNAREC=ON";;
|
||||
ARM64 | arm64) cmake_flags_extra="$cmake_flags_extra -D ARCH=arm64 -D NEW_DYNAREC=ON";;
|
||||
*) cmake_flags_extra="$cmake_flags_extra -D \"ARCH=$arch\"";;
|
||||
esac
|
||||
@@ -1185,8 +1176,6 @@ then
|
||||
else
|
||||
# Determine AppImage runtime architecture.
|
||||
case $arch in
|
||||
x86) arch_appimage="i686";;
|
||||
arm32) arch_appimage="armhf";;
|
||||
arm64) arch_appimage="aarch64";;
|
||||
*) arch_appimage="$arch";;
|
||||
esac
|
||||
|
||||
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
3
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -52,9 +52,6 @@ body:
|
||||
- macOS - Universal (Intel and Apple Silicon)
|
||||
- Linux - x64 (64-bit)
|
||||
- Linux - ARM (64-bit)
|
||||
- Windows - x86 (32-bit)
|
||||
- Linux - ARM (32-bit)
|
||||
- Linux - x86 (32-bit)
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
|
||||
@@ -139,7 +139,7 @@ option(DISCORD "Discord Rich Presence support"
|
||||
option(DEBUGREGS486 "Enable debug register opeartion on 486+ CPUs" OFF)
|
||||
option(LIBASAN "Enable compilation with the addresss sanitizer" OFF)
|
||||
|
||||
if((ARCH STREQUAL "arm64") OR (ARCH STREQUAL "arm"))
|
||||
if((ARCH STREQUAL "arm64"))
|
||||
set(NEW_DYNAREC ON)
|
||||
else()
|
||||
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#
|
||||
# 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
# running old operating systems and software designed for IBM
|
||||
# PC systems and compatibles from 1981 through fairly recent
|
||||
# system designs based on the PCI bus.
|
||||
#
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for ARMv7 targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -march=armv7-a+fp -mfloat-abi=hard")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=armv7-a+fp -mfloat-abi=hard")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
@@ -1,20 +0,0 @@
|
||||
#
|
||||
# 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
# running old operating systems and software designed for IBM
|
||||
# PC systems and compatibles from 1981 through fairly recent
|
||||
# system designs based on the PCI bus.
|
||||
#
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file defining GCC compiler flags
|
||||
# for 32-bit x86 targets.
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
string(APPEND CMAKE_C_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign")
|
||||
string(APPEND CMAKE_CXX_FLAGS_INIT " -m32 -march=i686 -msse2 -mfpmath=sse -mstackrealign")
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc.cmake)
|
||||
@@ -1,30 +0,0 @@
|
||||
#
|
||||
# 86Box A hypervisor and IBM PC system emulator that specializes in
|
||||
# running old operating systems and software designed for IBM
|
||||
# PC systems and compatibles from 1981 through fairly recent
|
||||
# system designs based on the PCI bus.
|
||||
#
|
||||
# This file is part of the 86Box distribution.
|
||||
#
|
||||
# CMake toolchain file for Clang on Windows builds (x86 target).
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
#
|
||||
# Copyright 2021 David Hrdlička.
|
||||
#
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/flags-gcc-i686.cmake)
|
||||
|
||||
# Use the GCC-compatible Clang executables in order to use our flags
|
||||
set(CMAKE_C_COMPILER clang)
|
||||
set(CMAKE_CXX_COMPILER clang++)
|
||||
|
||||
# `llvm-rc` is barely usable as of LLVM 13, using MS' rc.exe for now
|
||||
set(CMAKE_RC_COMPILER rc)
|
||||
|
||||
set(CMAKE_C_COMPILER_TARGET i686-pc-windows-msvc)
|
||||
set(CMAKE_CXX_COMPILER_TARGET i686-pc-windows-msvc)
|
||||
|
||||
set(CMAKE_SYSTEM_PROCESSOR X86)
|
||||
|
||||
# TODO: set the vcpkg target triplet perhaps?
|
||||
3
debian/control
vendored
3
debian/control
vendored
@@ -25,10 +25,9 @@ Homepage: https://86box.net/
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: 86box
|
||||
Architecture: amd64 armhf arm64 i386
|
||||
Architecture: amd64 arm64
|
||||
Depends: ${shlibs:Depends},
|
||||
${misc:Depends},
|
||||
sse2-support [i386]
|
||||
Recommends: libpcap0.8-dev
|
||||
Description: An emulator for classic IBM PC clones
|
||||
86Box is a low level x86 emulator that runs older operating systems and software
|
||||
|
||||
14
debian/rules
vendored
14
debian/rules
vendored
@@ -5,20 +5,12 @@
|
||||
|
||||
ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
|
||||
|
||||
ifeq ($(ARCH), $(filter $(ARCH), amd64 i386))
|
||||
ifeq ($(ARCH), $(filter $(ARCH), amd64))
|
||||
NDR=off
|
||||
ifeq ($(ARCH),amd64)
|
||||
TOOLCHAIN=cmake/flags-gcc-x86_64.cmake
|
||||
else
|
||||
TOOLCHAIN=cmake/flags-gcc-i686.cmake
|
||||
endif
|
||||
TOOLCHAIN=cmake/flags-gcc-x86_64.cmake
|
||||
else
|
||||
NDR=on
|
||||
ifeq ($(ARCH),armhf)
|
||||
TOOLCHAIN=cmake/flags-gcc-armv7.cmake
|
||||
else
|
||||
TOOLCHAIN=cmake/flags-gcc-aarch64.cmake
|
||||
endif
|
||||
TOOLCHAIN=cmake/flags-gcc-aarch64.cmake
|
||||
endif
|
||||
|
||||
%:
|
||||
|
||||
@@ -135,14 +135,6 @@ if(HAIKU)
|
||||
target_link_libraries(86Box be)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND ARCH STREQUAL "i386")
|
||||
if(MINGW)
|
||||
target_link_options(86Box PRIVATE "LINKER:--large-address-aware")
|
||||
else()
|
||||
target_link_options(86Box PRIVATE "LINKER:/LARGEADDRESSAWARE")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(STATIC_BUILD)
|
||||
if(MINGW OR UNIX)
|
||||
target_link_options(86Box PRIVATE "-static")
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
# error ARCH arm
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
# error ARCH arm64
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
# error ARCH i386
|
||||
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
|
||||
# error ARCH x86_64
|
||||
#endif
|
||||
|
||||
@@ -10,9 +10,11 @@
|
||||
#
|
||||
# Authors: David Hrdlička, <hrdlickadavid@outlook.com>
|
||||
# Jasmine Iwanek, <jriwanek@gmail.com>
|
||||
# Connor Hyde, <mario64crashed@gmail.com>
|
||||
#
|
||||
# Copyright 2020-2021 David Hrdlička.
|
||||
# Copyright 2024 Jasmine Iwanek.
|
||||
# Copyright 2025 Connor Hyde / starfrost
|
||||
#
|
||||
|
||||
if(DYNAREC)
|
||||
@@ -21,19 +23,15 @@ if(DYNAREC)
|
||||
codegen_ops.c
|
||||
)
|
||||
|
||||
if(ARCH STREQUAL "i386")
|
||||
target_sources(dynarec PRIVATE
|
||||
codegen_x86.c
|
||||
codegen_accumulate_x86.c
|
||||
)
|
||||
elseif(ARCH STREQUAL "x86_64")
|
||||
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
target_sources(dynarec PRIVATE
|
||||
codegen_x86-64.c
|
||||
codegen_accumulate_x86-64.c
|
||||
)
|
||||
else()
|
||||
message(SEND_ERROR
|
||||
"Dynarec is incompatible with target platform ${ARCH}")
|
||||
"Old dynarec is incompatible with target platform ${ARCH}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(86Box dynarec cgt)
|
||||
|
||||
@@ -42,8 +42,6 @@
|
||||
|
||||
#ifdef __amd64__
|
||||
# include "codegen_x86-64.h"
|
||||
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined _M_X64
|
||||
# include "codegen_x86.h"
|
||||
#else
|
||||
# error Dynamic recompiler not implemented on your platform
|
||||
#endif
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <86box/86box.h>
|
||||
#include "cpu.h"
|
||||
#include <86box/mem.h>
|
||||
|
||||
#include "codegen.h"
|
||||
#include "codegen_accumulate.h"
|
||||
|
||||
static struct
|
||||
{
|
||||
int count;
|
||||
uintptr_t dest_reg;
|
||||
} acc_regs[] = {
|
||||
[ACCREG_cycles] = {0, (uintptr_t) & (cycles)}
|
||||
};
|
||||
|
||||
void
|
||||
codegen_accumulate(int acc_reg, int delta)
|
||||
{
|
||||
acc_regs[acc_reg].count += delta;
|
||||
|
||||
#ifdef USE_ACYCS
|
||||
if ((acc_reg == ACCREG_cycles) && (delta != 0)) {
|
||||
if (delta == -1) {
|
||||
/* -delta = 1 */
|
||||
addbyte(0xff); /*inc dword ptr[&acycs]*/
|
||||
addbyte(0x05);
|
||||
addlong((uint32_t) (uintptr_t) & (acycs));
|
||||
} else if (delta == 1) {
|
||||
/* -delta = -1 */
|
||||
addbyte(0xff); /*dec dword ptr[&acycs]*/
|
||||
addbyte(0x0d);
|
||||
addlong((uint32_t) (uintptr_t) & (acycs));
|
||||
} else {
|
||||
addbyte(0x81); /*ADD $acc_regs[c].count,acc_regs[c].dest*/
|
||||
addbyte(0x05);
|
||||
addlong((uint32_t) (uintptr_t) & (acycs));
|
||||
addlong((uintptr_t) -delta);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
codegen_accumulate_flush(void)
|
||||
{
|
||||
if (acc_regs[0].count) {
|
||||
/* To reduce the size of the generated code, we take advantage of
|
||||
the fact that the target offset points to _cycles within cpu_state,
|
||||
so we can just use our existing infrastracture for variables
|
||||
relative to cpu_state. */
|
||||
addbyte(0x81); /*MOVL $acc_regs[0].count,(_cycles)*/
|
||||
addbyte(0x45);
|
||||
addbyte((uint8_t) cpu_state_offset(_cycles));
|
||||
addlong(acc_regs[0].count);
|
||||
}
|
||||
|
||||
acc_regs[0].count = 0;
|
||||
}
|
||||
|
||||
void
|
||||
codegen_accumulate_reset(void)
|
||||
{
|
||||
acc_regs[0].count = 0;
|
||||
}
|
||||
@@ -18,13 +18,8 @@
|
||||
#include "cpu.h"
|
||||
#include "codegen.h"
|
||||
#include "codegen_ops.h"
|
||||
|
||||
#if defined __amd64__ || defined _M_X64
|
||||
# include "codegen_ops_x86-64.h"
|
||||
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
# include "codegen_ops_x86.h"
|
||||
#endif
|
||||
|
||||
// Old dynarec now x86-64 only
|
||||
#include "codegen_ops_x86-64.h"
|
||||
#include "codegen_ops_arith.h"
|
||||
#include "codegen_ops_fpu.h"
|
||||
#include "codegen_ops_jump.h"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,45 +0,0 @@
|
||||
#define BLOCK_SIZE 0x4000
|
||||
#define BLOCK_MASK 0x3fff
|
||||
#define BLOCK_START 0
|
||||
|
||||
#define HASH_SIZE 0x20000
|
||||
#define HASH_MASK 0x1ffff
|
||||
|
||||
#define HASH(l) ((l) &0x1ffff)
|
||||
|
||||
#define BLOCK_EXIT_OFFSET 0x7f0
|
||||
#ifdef OLD_GPF
|
||||
# define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 20)
|
||||
#else
|
||||
# define BLOCK_GPF_OFFSET (BLOCK_EXIT_OFFSET - 14)
|
||||
#endif
|
||||
|
||||
#define BLOCK_MAX 1720
|
||||
|
||||
enum {
|
||||
OP_RET = 0xc3
|
||||
};
|
||||
|
||||
#define NR_HOST_REGS 4
|
||||
extern int host_reg_mapping[NR_HOST_REGS];
|
||||
#define NR_HOST_XMM_REGS 8
|
||||
extern int host_reg_xmm_mapping[NR_HOST_XMM_REGS];
|
||||
|
||||
extern uint32_t mem_load_addr_ea_b;
|
||||
extern uint32_t mem_load_addr_ea_w;
|
||||
extern uint32_t mem_load_addr_ea_l;
|
||||
extern uint32_t mem_load_addr_ea_q;
|
||||
extern uint32_t mem_store_addr_ea_b;
|
||||
extern uint32_t mem_store_addr_ea_w;
|
||||
extern uint32_t mem_store_addr_ea_l;
|
||||
extern uint32_t mem_store_addr_ea_q;
|
||||
|
||||
extern uint32_t mem_load_addr_ea_b_no_abrt;
|
||||
extern uint32_t mem_store_addr_ea_b_no_abrt;
|
||||
extern uint32_t mem_load_addr_ea_w_no_abrt;
|
||||
extern uint32_t mem_store_addr_ea_w_no_abrt;
|
||||
extern uint32_t mem_load_addr_ea_l_no_abrt;
|
||||
extern uint32_t mem_store_addr_ea_l_no_abrt;
|
||||
extern uint32_t mem_check_write;
|
||||
extern uint32_t mem_check_write_w;
|
||||
extern uint32_t mem_check_write_l;
|
||||
@@ -46,15 +46,7 @@ if(DYNAREC)
|
||||
codegen_reg.c
|
||||
)
|
||||
|
||||
if(ARCH STREQUAL "i386")
|
||||
target_sources(dynarec PRIVATE
|
||||
codegen_backend_x86.c
|
||||
codegen_backend_x86_ops.c
|
||||
codegen_backend_x86_ops_fpu.c
|
||||
codegen_backend_x86_ops_sse.c
|
||||
codegen_backend_x86_uops.c
|
||||
)
|
||||
elseif(ARCH STREQUAL "x86_64")
|
||||
if(ARCH STREQUAL "x86_64")
|
||||
target_sources(dynarec PRIVATE
|
||||
codegen_backend_x86-64.c
|
||||
codegen_backend_x86-64_ops.c
|
||||
@@ -68,12 +60,6 @@ if(DYNAREC)
|
||||
codegen_backend_arm64_uops.c
|
||||
codegen_backend_arm64_imm.c
|
||||
)
|
||||
elseif(ARCH STREQUAL "arm")
|
||||
target_sources(dynarec PRIVATE
|
||||
codegen_backend_arm.c
|
||||
codegen_backend_arm_ops.c
|
||||
codegen_backend_arm_uops.c
|
||||
)
|
||||
else()
|
||||
message(SEND_ERROR
|
||||
"Dynarec is incompatible with target platform ${ARCH}")
|
||||
|
||||
@@ -108,7 +108,7 @@ codeblock_allocator_get_ptr(mem_block_t *block)
|
||||
void
|
||||
codegen_allocator_clean_blocks(UNUSED(struct mem_block_t *block))
|
||||
{
|
||||
#if defined __ARM_EABI__ || defined _ARM_ || defined __aarch64__ || defined _M_ARM || defined _M_ARM64
|
||||
#if defined __ARM_EABI__ || defined __aarch64__ || defined _M_ARM64
|
||||
while (1) {
|
||||
# ifndef _MSC_VER
|
||||
__clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]);
|
||||
|
||||
@@ -11,13 +11,11 @@
|
||||
are chained together by jump instructions.
|
||||
|
||||
Due to the chaining, the total memory size is limited by the range of a jump
|
||||
instruction. ARMv7 is restricted to +/- 32 MB, ARMv8 to +/- 128 MB, x86 to
|
||||
+/- 2GB. As a result, total memory size is limited to 32 MB on ARMv7*/
|
||||
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
|
||||
# define MEM_BLOCK_NR 32768
|
||||
#else
|
||||
# define MEM_BLOCK_NR 131072
|
||||
#endif
|
||||
instruction. ARMv8 is limited to +/- 128 MB, x86 to
|
||||
+/- 2GB. It was 32 MB on ARMv7 before we removed it*/
|
||||
|
||||
#define MEM_BLOCK_NR 131072
|
||||
|
||||
|
||||
#define MEM_BLOCK_MASK (MEM_BLOCK_NR - 1)
|
||||
#define MEM_BLOCK_SIZE 0x3c0
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
|
||||
#if defined __amd64__ || defined _M_X64
|
||||
# include "codegen_backend_x86-64.h"
|
||||
#elif defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
# include "codegen_backend_x86.h"
|
||||
#elif defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
|
||||
# include "codegen_backend_arm.h"
|
||||
#elif defined __aarch64__ || defined _M_ARM64
|
||||
# include "codegen_backend_arm64.h"
|
||||
#else
|
||||
# error Dynamic recompiler not implemented on your platform
|
||||
# error New dynamic recompiler not implemented on your platform
|
||||
#endif
|
||||
|
||||
void codegen_backend_init(void);
|
||||
|
||||
@@ -1,373 +0,0 @@
|
||||
#if defined __ARM_EABI__ || defined _ARM_ || defined _M_ARM
|
||||
|
||||
# include <stdint.h>
|
||||
# include <stdlib.h>
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
# include "codegen_backend.h"
|
||||
# include "codegen_backend_arm_defs.h"
|
||||
# include "codegen_backend_arm_ops.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
# include "x87_sf.h"
|
||||
# include "x87.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
# include <windows.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
|
||||
void *codegen_mem_load_byte;
|
||||
void *codegen_mem_load_word;
|
||||
void *codegen_mem_load_long;
|
||||
void *codegen_mem_load_quad;
|
||||
void *codegen_mem_load_single;
|
||||
void *codegen_mem_load_double;
|
||||
|
||||
void *codegen_mem_store_byte;
|
||||
void *codegen_mem_store_word;
|
||||
void *codegen_mem_store_long;
|
||||
void *codegen_mem_store_quad;
|
||||
void *codegen_mem_store_single;
|
||||
void *codegen_mem_store_double;
|
||||
|
||||
void *codegen_fp_round;
|
||||
|
||||
void *codegen_gpf_rout;
|
||||
void *codegen_exit_rout;
|
||||
|
||||
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
{ REG_R4, 0},
|
||||
{ REG_R5, 0},
|
||||
{ REG_R6, 0},
|
||||
{ REG_R7, 0},
|
||||
{ REG_R8, 0},
|
||||
{ REG_R9, 0},
|
||||
{ REG_R11, 0}
|
||||
};
|
||||
|
||||
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
|
||||
{ REG_D8, 0},
|
||||
{ REG_D9, 0},
|
||||
{ REG_D10, 0},
|
||||
{ REG_D11, 0},
|
||||
{ REG_D12, 0},
|
||||
{ REG_D13, 0},
|
||||
{ REG_D14, 0},
|
||||
{ REG_D15, 0}
|
||||
};
|
||||
|
||||
static void
|
||||
build_load_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint32_t *branch_offset;
|
||||
uint32_t *misaligned_offset;
|
||||
|
||||
/*In - R0 = address
|
||||
Out - R0 = data, R1 = abrt*/
|
||||
/*MOV R1, R0, LSR #12
|
||||
MOV R2, #readlookup2
|
||||
LDR R1, [R2, R1, LSL #2]
|
||||
CMP R1, #-1
|
||||
BNE +
|
||||
LDRB R0, [R1, R0]
|
||||
MOV R1, #0
|
||||
MOV PC, LR
|
||||
* STR LR, [SP, -4]!
|
||||
BL readmembl
|
||||
LDRB R1, cpu_state.abrt
|
||||
LDR PC, [SP], #4
|
||||
*/
|
||||
codegen_alloc(block, 80);
|
||||
host_arm_MOV_REG_LSR(block, REG_R1, REG_R0, 12);
|
||||
host_arm_MOV_IMM(block, REG_R2, (uint32_t) readlookup2);
|
||||
host_arm_LDR_REG_LSL(block, REG_R1, REG_R2, REG_R1, 2);
|
||||
if (size != 1) {
|
||||
host_arm_TST_IMM(block, REG_R0, size - 1);
|
||||
misaligned_offset = host_arm_BNE_(block);
|
||||
}
|
||||
host_arm_CMP_IMM(block, REG_R1, -1);
|
||||
branch_offset = host_arm_BEQ_(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_arm_LDRB_REG(block, REG_R0, REG_R1, REG_R0);
|
||||
else if (size == 2 && !is_float)
|
||||
host_arm_LDRH_REG(block, REG_R0, REG_R1, REG_R0);
|
||||
else if (size == 4 && !is_float)
|
||||
host_arm_LDR_REG(block, REG_R0, REG_R1, REG_R0);
|
||||
else if (size == 4 && is_float) {
|
||||
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R1);
|
||||
host_arm_VLDR_S(block, REG_D_TEMP, REG_R0, 0);
|
||||
} else if (size == 8) {
|
||||
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R1);
|
||||
host_arm_VLDR_D(block, REG_D_TEMP, REG_R0, 0);
|
||||
}
|
||||
host_arm_MOV_IMM(block, REG_R1, 0);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
|
||||
*branch_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 8) & 0x3fffffc) >> 2;
|
||||
if (size != 1)
|
||||
*misaligned_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 8) & 0x3fffffc) >> 2;
|
||||
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
|
||||
if (size == 1)
|
||||
host_arm_BL(block, (uintptr_t) readmembl);
|
||||
else if (size == 2)
|
||||
host_arm_BL(block, (uintptr_t) readmemwl);
|
||||
else if (size == 4)
|
||||
host_arm_BL(block, (uintptr_t) readmemll);
|
||||
else if (size == 8)
|
||||
host_arm_BL(block, (uintptr_t) readmemql);
|
||||
else
|
||||
fatal("build_load_routine - unknown size %i\n", size);
|
||||
if (size == 4 && is_float)
|
||||
host_arm_VMOV_S_32(block, REG_D_TEMP, REG_R0);
|
||||
else if (size == 8)
|
||||
host_arm_VMOV_D_64(block, REG_D_TEMP, REG_R0, REG_R1);
|
||||
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
|
||||
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
build_store_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint32_t *branch_offset;
|
||||
uint32_t *misaligned_offset;
|
||||
|
||||
/*In - R0 = address
|
||||
Out - R0 = data, R1 = abrt*/
|
||||
/*MOV R1, R0, LSR #12
|
||||
MOV R2, #readlookup2
|
||||
LDR R1, [R2, R1, LSL #2]
|
||||
CMP R1, #-1
|
||||
BNE +
|
||||
LDRB R0, [R1, R0]
|
||||
MOV R1, #0
|
||||
MOV PC, LR
|
||||
* STR LR, [SP, -4]!
|
||||
BL readmembl
|
||||
LDRB R1, cpu_state.abrt
|
||||
LDR PC, [SP], #4
|
||||
*/
|
||||
codegen_alloc(block, 80);
|
||||
host_arm_MOV_REG_LSR(block, REG_R2, REG_R0, 12);
|
||||
host_arm_MOV_IMM(block, REG_R3, (uint32_t) writelookup2);
|
||||
host_arm_LDR_REG_LSL(block, REG_R2, REG_R3, REG_R2, 2);
|
||||
if (size != 1) {
|
||||
host_arm_TST_IMM(block, REG_R0, size - 1);
|
||||
misaligned_offset = host_arm_BNE_(block);
|
||||
}
|
||||
host_arm_CMP_IMM(block, REG_R2, -1);
|
||||
branch_offset = host_arm_BEQ_(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_arm_STRB_REG(block, REG_R1, REG_R2, REG_R0);
|
||||
else if (size == 2 && !is_float)
|
||||
host_arm_STRH_REG(block, REG_R1, REG_R2, REG_R0);
|
||||
else if (size == 4 && !is_float)
|
||||
host_arm_STR_REG(block, REG_R1, REG_R2, REG_R0);
|
||||
else if (size == 4 && is_float) {
|
||||
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R2);
|
||||
host_arm_VSTR_S(block, REG_D_TEMP, REG_R0, 0);
|
||||
} else if (size == 8) {
|
||||
host_arm_ADD_REG(block, REG_R0, REG_R0, REG_R2);
|
||||
host_arm_VSTR_D(block, REG_D_TEMP, REG_R0, 0);
|
||||
}
|
||||
host_arm_MOV_IMM(block, REG_R1, 0);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
|
||||
*branch_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 8) & 0x3fffffc) >> 2;
|
||||
if (size != 1)
|
||||
*misaligned_offset |= ((((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 8) & 0x3fffffc) >> 2;
|
||||
host_arm_STR_IMM_WB(block, REG_LR, REG_HOST_SP, -4);
|
||||
if (size == 4 && is_float)
|
||||
host_arm_VMOV_32_S(block, REG_R1, REG_D_TEMP);
|
||||
else if (size == 8)
|
||||
host_arm_VMOV_64_D(block, REG_R2, REG_R3, REG_D_TEMP);
|
||||
if (size == 1)
|
||||
host_arm_BL(block, (uintptr_t) writemembl);
|
||||
else if (size == 2)
|
||||
host_arm_BL(block, (uintptr_t) writememwl);
|
||||
else if (size == 4)
|
||||
host_arm_BL(block, (uintptr_t) writememll);
|
||||
else if (size == 8)
|
||||
host_arm_BL_r1(block, (uintptr_t) writememql);
|
||||
else
|
||||
fatal("build_store_routine - unknown size %i\n", size);
|
||||
host_arm_LDRB_ABS(block, REG_R1, &cpu_state.abrt);
|
||||
host_arm_LDR_IMM_POST(block, REG_PC, REG_HOST_SP, 4);
|
||||
}
|
||||
|
||||
static void
|
||||
build_loadstore_routines(codeblock_t *block)
|
||||
{
|
||||
codegen_mem_load_byte = &block_write_data[block_pos];
|
||||
build_load_routine(block, 1, 0);
|
||||
codegen_mem_load_word = &block_write_data[block_pos];
|
||||
build_load_routine(block, 2, 0);
|
||||
codegen_mem_load_long = &block_write_data[block_pos];
|
||||
build_load_routine(block, 4, 0);
|
||||
codegen_mem_load_quad = &block_write_data[block_pos];
|
||||
build_load_routine(block, 8, 0);
|
||||
codegen_mem_load_single = &block_write_data[block_pos];
|
||||
build_load_routine(block, 4, 1);
|
||||
codegen_mem_load_double = &block_write_data[block_pos];
|
||||
build_load_routine(block, 8, 1);
|
||||
|
||||
codegen_mem_store_byte = &block_write_data[block_pos];
|
||||
build_store_routine(block, 1, 0);
|
||||
codegen_mem_store_word = &block_write_data[block_pos];
|
||||
build_store_routine(block, 2, 0);
|
||||
codegen_mem_store_long = &block_write_data[block_pos];
|
||||
build_store_routine(block, 4, 0);
|
||||
codegen_mem_store_quad = &block_write_data[block_pos];
|
||||
build_store_routine(block, 8, 0);
|
||||
codegen_mem_store_single = &block_write_data[block_pos];
|
||||
build_store_routine(block, 4, 1);
|
||||
codegen_mem_store_double = &block_write_data[block_pos];
|
||||
build_store_routine(block, 8, 1);
|
||||
}
|
||||
|
||||
/*VFP has a specific round-to-zero instruction, and the default rounding mode
|
||||
is nearest. For round up/down, temporarily change the rounding mode in FPCSR*/
|
||||
# define FPCSR_ROUNDING_MASK (3 << 22)
|
||||
# define FPCSR_ROUNDING_UP (1 << 22)
|
||||
# define FPCSR_ROUNDING_DOWN (2 << 22)
|
||||
|
||||
static void
|
||||
build_fp_round_routine(codeblock_t *block)
|
||||
{
|
||||
uint32_t *jump_table;
|
||||
|
||||
codegen_alloc(block, 80);
|
||||
|
||||
host_arm_MOV_REG(block, REG_TEMP2, REG_LR);
|
||||
host_arm_MOV_REG(block, REG_LR, REG_TEMP2);
|
||||
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.new_fp_control - (uintptr_t) &cpu_state);
|
||||
host_arm_LDR_REG(block, REG_PC, REG_PC, REG_TEMP);
|
||||
host_arm_NOP(block);
|
||||
|
||||
jump_table = (uint32_t *) &block_write_data[block_pos];
|
||||
host_arm_NOP(block);
|
||||
host_arm_NOP(block);
|
||||
host_arm_NOP(block);
|
||||
host_arm_NOP(block);
|
||||
|
||||
jump_table[X87_ROUNDING_NEAREST] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // tie even
|
||||
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
|
||||
jump_table[X87_ROUNDING_UP] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // pos inf
|
||||
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.old_fp_control - (uintptr_t) &cpu_state);
|
||||
host_arm_BIC_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_MASK);
|
||||
host_arm_ORR_IMM(block, REG_TEMP2, REG_TEMP2, FPCSR_ROUNDING_UP);
|
||||
host_arm_VMSR_FPSCR(block, REG_TEMP2);
|
||||
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
|
||||
host_arm_VMSR_FPSCR(block, REG_TEMP);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
|
||||
jump_table[X87_ROUNDING_DOWN] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // neg inf
|
||||
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.old_fp_control - (uintptr_t) &cpu_state);
|
||||
host_arm_BIC_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_MASK);
|
||||
host_arm_ORR_IMM(block, REG_TEMP2, REG_TEMP, FPCSR_ROUNDING_DOWN);
|
||||
host_arm_VMSR_FPSCR(block, REG_TEMP2);
|
||||
host_arm_VCVTR_IS_D(block, REG_D_TEMP, REG_D_TEMP);
|
||||
host_arm_VMSR_FPSCR(block, REG_TEMP);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
|
||||
jump_table[X87_ROUNDING_CHOP] = (uint64_t) (uintptr_t) &block_write_data[block_pos]; // zero
|
||||
host_arm_VCVT_IS_D(block, REG_D_TEMP, REG_D_TEMP);
|
||||
host_arm_MOV_REG(block, REG_PC, REG_LR);
|
||||
}
|
||||
|
||||
void
|
||||
codegen_backend_init(void)
|
||||
{
|
||||
codeblock_t *block;
|
||||
|
||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (int c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].pc = BLOCK_PC_INVALID;
|
||||
|
||||
block_current = 0;
|
||||
block_pos = 0;
|
||||
block = &codeblock[block_current];
|
||||
block->head_mem_block = codegen_allocator_allocate(NULL, block_current);
|
||||
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
|
||||
block_write_data = block->data;
|
||||
build_loadstore_routines(&codeblock[block_current]);
|
||||
# if 0
|
||||
pclog("block_pos=%i\n", block_pos);
|
||||
# endif
|
||||
|
||||
codegen_fp_round = &block_write_data[block_pos];
|
||||
build_fp_round_routine(&codeblock[block_current]);
|
||||
|
||||
codegen_alloc(block, 80);
|
||||
codegen_gpf_rout = &block_write_data[block_pos];
|
||||
host_arm_MOV_IMM(block, REG_R0, 0);
|
||||
host_arm_MOV_IMM(block, REG_R1, 0);
|
||||
host_arm_call(block, x86gpf);
|
||||
|
||||
codegen_exit_rout = &block_write_data[block_pos];
|
||||
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
|
||||
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
|
||||
|
||||
block_write_data = NULL;
|
||||
# if 0
|
||||
fatal("block_pos=%i\n", block_pos);
|
||||
# endif
|
||||
asm("vmrs %0, fpscr\n"
|
||||
: "=r"(cpu_state.old_fp_control));
|
||||
if ((cpu_state.old_fp_control >> 22) & 3)
|
||||
fatal("VFP not in nearest rounding mode\n");
|
||||
}
|
||||
|
||||
void
|
||||
codegen_set_rounding_mode(int mode)
|
||||
{
|
||||
if (mode < 0 || mode > 3)
|
||||
fatal("codegen_set_rounding_mode - invalid mode\n");
|
||||
cpu_state.new_fp_control = mode << 2;
|
||||
}
|
||||
|
||||
/*R10 - cpu_state*/
|
||||
void
|
||||
codegen_backend_prologue(codeblock_t *block)
|
||||
{
|
||||
block_pos = BLOCK_START;
|
||||
|
||||
/*Entry code*/
|
||||
|
||||
host_arm_STMDB_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_LR);
|
||||
host_arm_SUB_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
|
||||
host_arm_MOV_IMM(block, REG_CPUSTATE, (uint32_t) &cpu_state);
|
||||
if (block->flags & CODEBLOCK_HAS_FPU) {
|
||||
host_arm_LDR_IMM(block, REG_TEMP, REG_CPUSTATE, (uintptr_t) &cpu_state.TOP - (uintptr_t) &cpu_state);
|
||||
host_arm_SUB_IMM(block, REG_TEMP, REG_TEMP, block->TOP);
|
||||
host_arm_STR_IMM(block, REG_TEMP, REG_HOST_SP, IREG_TOP_diff_stack_offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
codegen_backend_epilogue(codeblock_t *block)
|
||||
{
|
||||
host_arm_ADD_IMM(block, REG_HOST_SP, REG_HOST_SP, 0x40);
|
||||
host_arm_LDMIA_WB(block, REG_HOST_SP, REG_MASK_LOCAL | REG_MASK_PC);
|
||||
|
||||
codegen_allocator_clean_blocks(block->head_mem_block);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
#include "codegen_backend_arm_defs.h"
|
||||
|
||||
#define BLOCK_SIZE 0x4000
|
||||
#define BLOCK_MASK 0x3fff
|
||||
#define BLOCK_START 0
|
||||
|
||||
#define HASH_SIZE 0x20000
|
||||
#define HASH_MASK 0x1ffff
|
||||
|
||||
#define HASH(l) ((l) &0x1ffff)
|
||||
|
||||
#define BLOCK_MAX 0x3c0
|
||||
|
||||
void host_arm_ADD_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_LDMIA_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
|
||||
void host_arm_LDR_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
|
||||
void host_arm_MOV_IMM(codeblock_t *block, int dst_reg, uint32_t imm);
|
||||
void host_arm_STMDB_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
|
||||
void host_arm_SUB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
|
||||
void host_arm_call(codeblock_t *block, void *dst_addr);
|
||||
void host_arm_nop(codeblock_t *block);
|
||||
|
||||
void codegen_alloc(codeblock_t *block, int size);
|
||||
@@ -1,88 +0,0 @@
|
||||
#define REG_R0 0
|
||||
#define REG_R1 1
|
||||
#define REG_R2 2
|
||||
#define REG_R3 3
|
||||
#define REG_R4 4
|
||||
#define REG_R5 5
|
||||
#define REG_R6 6
|
||||
#define REG_R7 7
|
||||
#define REG_R8 8
|
||||
#define REG_R9 9
|
||||
#define REG_R10 10
|
||||
#define REG_R11 11
|
||||
#define REG_R12 12
|
||||
#define REG_HOST_SP 13
|
||||
#define REG_LR 14
|
||||
#define REG_PC 15
|
||||
|
||||
#define REG_ARG0 REG_R0
|
||||
#define REG_ARG1 REG_R1
|
||||
#define REG_ARG2 REG_R2
|
||||
#define REG_ARG3 REG_R3
|
||||
|
||||
#define REG_CPUSTATE REG_R10
|
||||
|
||||
#define REG_TEMP REG_R3
|
||||
#define REG_TEMP2 REG_R2
|
||||
|
||||
#define REG_D0 0
|
||||
#define REG_D1 1
|
||||
#define REG_D2 2
|
||||
#define REG_D3 3
|
||||
#define REG_D4 4
|
||||
#define REG_D5 5
|
||||
#define REG_D6 6
|
||||
#define REG_D7 7
|
||||
#define REG_D8 8
|
||||
#define REG_D9 9
|
||||
#define REG_D10 10
|
||||
#define REG_D11 11
|
||||
#define REG_D12 12
|
||||
#define REG_D13 13
|
||||
#define REG_D14 14
|
||||
#define REG_D15 15
|
||||
|
||||
#define REG_D_TEMP REG_D0
|
||||
#define REG_Q_TEMP REG_D0
|
||||
#define REG_Q_TEMP_2 REG_D2
|
||||
|
||||
#define REG_MASK_R0 (1 << REG_R0)
|
||||
#define REG_MASK_R1 (1 << REG_R1)
|
||||
#define REG_MASK_R2 (1 << REG_R2)
|
||||
#define REG_MASK_R3 (1 << REG_R3)
|
||||
#define REG_MASK_R4 (1 << REG_R4)
|
||||
#define REG_MASK_R5 (1 << REG_R5)
|
||||
#define REG_MASK_R6 (1 << REG_R6)
|
||||
#define REG_MASK_R7 (1 << REG_R7)
|
||||
#define REG_MASK_R8 (1 << REG_R8)
|
||||
#define REG_MASK_R9 (1 << REG_R9)
|
||||
#define REG_MASK_R10 (1 << REG_R10)
|
||||
#define REG_MASK_R11 (1 << REG_R11)
|
||||
#define REG_MASK_R12 (1 << REG_R12)
|
||||
#define REG_MASK_SP (1 << REG_HOST_SP)
|
||||
#define REG_MASK_LR (1 << REG_LR)
|
||||
#define REG_MASK_PC (1 << REG_PC)
|
||||
|
||||
#define REG_MASK_LOCAL (REG_MASK_R4 | REG_MASK_R5 | REG_MASK_R6 | REG_MASK_R7 | REG_MASK_R8 | REG_MASK_R9 | REG_MASK_R10 | REG_MASK_R11)
|
||||
|
||||
#define CODEGEN_HOST_REGS 7
|
||||
#define CODEGEN_HOST_FP_REGS 8
|
||||
|
||||
extern void *codegen_mem_load_byte;
|
||||
extern void *codegen_mem_load_word;
|
||||
extern void *codegen_mem_load_long;
|
||||
extern void *codegen_mem_load_quad;
|
||||
extern void *codegen_mem_load_single;
|
||||
extern void *codegen_mem_load_double;
|
||||
|
||||
extern void *codegen_mem_store_byte;
|
||||
extern void *codegen_mem_store_word;
|
||||
extern void *codegen_mem_store_long;
|
||||
extern void *codegen_mem_store_quad;
|
||||
extern void *codegen_mem_store_single;
|
||||
extern void *codegen_mem_store_double;
|
||||
|
||||
extern void *codegen_fp_round;
|
||||
|
||||
extern void *codegen_gpf_rout;
|
||||
extern void *codegen_exit_rout;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,252 +0,0 @@
|
||||
#define COND_SHIFT 28
|
||||
#define COND_EQ (0x0 << COND_SHIFT)
|
||||
#define COND_NE (0x1 << COND_SHIFT)
|
||||
#define COND_CS (0x2 << COND_SHIFT)
|
||||
#define COND_CC (0x3 << COND_SHIFT)
|
||||
#define COND_MI (0x4 << COND_SHIFT)
|
||||
#define COND_PL (0x5 << COND_SHIFT)
|
||||
#define COND_VS (0x6 << COND_SHIFT)
|
||||
#define COND_VC (0x7 << COND_SHIFT)
|
||||
#define COND_HI (0x8 << COND_SHIFT)
|
||||
#define COND_LS (0x9 << COND_SHIFT)
|
||||
#define COND_GE (0xa << COND_SHIFT)
|
||||
#define COND_LT (0xb << COND_SHIFT)
|
||||
#define COND_GT (0xc << COND_SHIFT)
|
||||
#define COND_LE (0xd << COND_SHIFT)
|
||||
#define COND_AL (0xe << COND_SHIFT)
|
||||
|
||||
void host_arm_ADD_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
#define host_arm_ADD_REG(block, dst_reg, src_reg_n, src_reg_m) host_arm_ADD_REG_LSL(block, dst_reg, src_reg_n, src_reg_m, 0)
|
||||
void host_arm_ADD_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_ADD_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_AND_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_AND_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_AND_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_B(codeblock_t *block, uintptr_t dest_addr);
|
||||
|
||||
void host_arm_BFI(codeblock_t *block, int dst_reg, int src_reg, int lsb, int width);
|
||||
|
||||
void host_arm_BIC_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_BIC_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_BIC_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_BL(codeblock_t *block, uintptr_t dest_addr);
|
||||
void host_arm_BL_r1(codeblock_t *block, uintptr_t dest_addr);
|
||||
void host_arm_BLX(codeblock_t *block, int addr_reg);
|
||||
|
||||
uint32_t *host_arm_BCC_(codeblock_t *block);
|
||||
uint32_t *host_arm_BCS_(codeblock_t *block);
|
||||
uint32_t *host_arm_BEQ_(codeblock_t *block);
|
||||
uint32_t *host_arm_BGE_(codeblock_t *block);
|
||||
uint32_t *host_arm_BGT_(codeblock_t *block);
|
||||
uint32_t *host_arm_BHI_(codeblock_t *block);
|
||||
uint32_t *host_arm_BLE_(codeblock_t *block);
|
||||
uint32_t *host_arm_BLS_(codeblock_t *block);
|
||||
uint32_t *host_arm_BLT_(codeblock_t *block);
|
||||
uint32_t *host_arm_BMI_(codeblock_t *block);
|
||||
uint32_t *host_arm_BNE_(codeblock_t *block);
|
||||
uint32_t *host_arm_BPL_(codeblock_t *block);
|
||||
uint32_t *host_arm_BVC_(codeblock_t *block);
|
||||
uint32_t *host_arm_BVS_(codeblock_t *block);
|
||||
|
||||
void host_arm_BEQ(codeblock_t *block, uintptr_t dest_addr);
|
||||
void host_arm_BNE(codeblock_t *block, uintptr_t dest_addr);
|
||||
|
||||
void host_arm_BX(codeblock_t *block, int addr_reg);
|
||||
|
||||
void host_arm_CMN_IMM(codeblock_t *block, int src_reg, uint32_t imm);
|
||||
void host_arm_CMN_REG_LSL(codeblock_t *block, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_CMP_IMM(codeblock_t *block, int src_reg, uint32_t imm);
|
||||
#define host_arm_CMP_REG(block, src_reg_n, src_reg_m) host_arm_CMP_REG_LSL(block, src_reg_n, src_reg_m, 0)
|
||||
void host_arm_CMP_REG_LSL(codeblock_t *block, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_EOR_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_EOR_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_LDMIA_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
|
||||
|
||||
void host_arm_LDR_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
|
||||
void host_arm_LDR_IMM_POST(codeblock_t *block, int dst_reg, int addr_reg, int offset);
|
||||
#define host_arm_LDR_REG(block, dst_reg, addr_reg, offset_reg) host_arm_LDR_REG_LSL(block, dst_reg, addr_reg, offset_reg, 0)
|
||||
void host_arm_LDR_REG_LSL(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg, int shift);
|
||||
|
||||
void host_arm_LDRB_ABS(codeblock_t *block, int dst, void *p);
|
||||
void host_arm_LDRB_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
|
||||
#define host_arm_LDRB_REG(block, dst_reg, addr_reg, offset_reg) host_arm_LDRB_REG_LSL(block, dst_reg, addr_reg, offset_reg, 0)
|
||||
void host_arm_LDRB_REG_LSL(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg, int shift);
|
||||
|
||||
void host_arm_LDRH_IMM(codeblock_t *block, int dst_reg, int addr_reg, int offset);
|
||||
void host_arm_LDRH_REG(codeblock_t *block, int dst_reg, int addr_reg, int offset_reg);
|
||||
|
||||
void host_arm_MOV_IMM(codeblock_t *block, int dst_reg, uint32_t imm);
|
||||
#define host_arm_MOV_REG(block, dst_reg, src_reg) host_arm_MOV_REG_LSL(block, dst_reg, src_reg, 0)
|
||||
void host_arm_MOV_REG_ASR(codeblock_t *block, int dst_reg, int src_reg, int shift);
|
||||
void host_arm_MOV_REG_ASR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
|
||||
void host_arm_MOV_REG_LSL(codeblock_t *block, int dst_reg, int src_reg, int shift);
|
||||
void host_arm_MOV_REG_LSL_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
|
||||
void host_arm_MOV_REG_LSR(codeblock_t *block, int dst_reg, int src_reg, int shift);
|
||||
void host_arm_MOV_REG_LSR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
|
||||
void host_arm_MOV_REG_ROR(codeblock_t *block, int dst_reg, int src_reg, int shift);
|
||||
void host_arm_MOV_REG_ROR_REG(codeblock_t *block, int dst_reg, int src_reg, int shift_reg);
|
||||
void host_arm_MOVT_IMM(codeblock_t *block, int dst_reg, uint16_t imm);
|
||||
void host_arm_MOVW_IMM(codeblock_t *block, int dst_reg, uint16_t imm);
|
||||
|
||||
void host_arm_MVN_REG_LSL(codeblock_t *block, int dst_reg, int src_reg, int shift);
|
||||
|
||||
#define host_arm_NOP(block) host_arm_MOV_REG(block, REG_R0, REG_R0)
|
||||
|
||||
void host_arm_ORR_IMM_cond(codeblock_t *block, uint32_t cond, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_ORR_REG_LSL_cond(codeblock_t *block, uint32_t cond, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
#define host_arm_ORR_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_AL, dst_reg, src_reg, imm)
|
||||
#define host_arm_ORR_REG_LSL(block, dst_reg, src_reg_a, src_reg_b, shift) host_arm_ORR_REG_LSL_cond(block, COND_AL, dst_reg, src_reg_a, src_reg_b, shift)
|
||||
|
||||
#define host_arm_ORRCC_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_CC, dst_reg, src_reg, imm)
|
||||
#define host_arm_ORREQ_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_EQ, dst_reg, src_reg, imm)
|
||||
#define host_arm_ORRVS_IMM(block, dst_reg, src_reg, imm) host_arm_ORR_IMM_cond(block, COND_VS, dst_reg, src_reg, imm)
|
||||
|
||||
void host_arm_RSB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_RSB_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_RSB_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_STMDB_WB(codeblock_t *block, int addr_reg, uint32_t reg_mask);
|
||||
|
||||
void host_arm_STR_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
|
||||
void host_arm_STR_IMM_WB(codeblock_t *block, int src_reg, int addr_reg, int offset);
|
||||
#define host_arm_STR_REG(block, src_reg, addr_reg, offset_reg) host_arm_STR_REG_LSL(block, src_reg, addr_reg, offset_reg, 0)
|
||||
void host_arm_STR_REG_LSL(codeblock_t *block, int src_reg, int addr_reg, int offset_reg, int shift);
|
||||
|
||||
void host_arm_STRB_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
|
||||
#define host_arm_STRB_REG(block, src_reg, addr_reg, offset_reg) host_arm_STRB_REG_LSL(block, src_reg, addr_reg, offset_reg, 0)
|
||||
void host_arm_STRB_REG_LSL(codeblock_t *block, int src_reg, int addr_reg, int offset_reg, int shift);
|
||||
|
||||
void host_arm_STRH_IMM(codeblock_t *block, int src_reg, int addr_reg, int offset);
|
||||
void host_arm_STRH_REG(codeblock_t *block, int src_reg, int addr_reg, int offset_reg);
|
||||
|
||||
void host_arm_SUB_IMM(codeblock_t *block, int dst_reg, int src_reg, uint32_t imm);
|
||||
void host_arm_SUB_REG_LSL(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
void host_arm_SUB_REG_LSR(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m, int shift);
|
||||
|
||||
void host_arm_SXTB(codeblock_t *block, int dst_reg, int src_reg, int rotate);
|
||||
void host_arm_SXTH(codeblock_t *block, int dst_reg, int src_reg, int rotate);
|
||||
|
||||
void host_arm_TST_IMM(codeblock_t *block, int src_reg1, uint32_t imm);
|
||||
void host_arm_TST_REG(codeblock_t *block, int src_reg1, int src_reg2);
|
||||
|
||||
void host_arm_UADD8(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
|
||||
void host_arm_UADD16(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
|
||||
|
||||
void host_arm_USUB8(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
|
||||
void host_arm_USUB16(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
|
||||
|
||||
void host_arm_UXTB(codeblock_t *block, int dst_reg, int src_reg, int rotate);
|
||||
void host_arm_UXTH(codeblock_t *block, int dst_reg, int src_reg, int rotate);
|
||||
|
||||
void host_arm_VABS_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
|
||||
void host_arm_VADD_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VADD_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VADD_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VADD_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VADD_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VAND_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VBIC_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCMP_D(codeblock_t *block, int src_reg_d, int src_reg_m);
|
||||
|
||||
void host_arm_VCEQ_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCEQ_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCEQ_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCEQ_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCGE_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCGT_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCGT_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCGT_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VCGT_S32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VCHS_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
|
||||
void host_arm_VCVT_D_IS(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVT_D_S(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVT_F32_S32(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVT_IS_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVT_S32_F32(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVT_S_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VCVTR_IS_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VDIV_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VDIV_S(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VDUP_32(codeblock_t *block, int dst_reg, int src_reg_m, int imm);
|
||||
void host_arm_VEOR_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VLDR_D(codeblock_t *block, int dest_reg, int base_reg, int offset);
|
||||
void host_arm_VLDR_S(codeblock_t *block, int dest_reg, int base_reg, int offset);
|
||||
|
||||
void host_arm_VMOV_32_S(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VMOV_64_D(codeblock_t *block, int dest_reg_low, int dest_reg_high, int src_reg);
|
||||
void host_arm_VMOV_D_64(codeblock_t *block, int dest_reg, int src_reg_low, int src_reg_high);
|
||||
void host_arm_VMOV_S_32(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VMOV_D_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VMOVN_I32(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VMOVN_I64(codeblock_t *block, int dest_reg, int src_reg);
|
||||
|
||||
void host_arm_VMRS_APSR(codeblock_t *block);
|
||||
void host_arm_VMSR_FPSCR(codeblock_t *block, int src_reg);
|
||||
|
||||
void host_arm_VMAX_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VMIN_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VMOV_F32_ONE(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_arm_VMUL_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VMUL_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VMUL_S16(codeblock_t *block, int dest_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VMULL_S16(codeblock_t *block, int dest_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VNEG_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
|
||||
void host_arm_VORR_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VPADDL_S16(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_arm_VPADDL_S32(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_arm_VPADDL_Q_S32(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_arm_VQADD_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQADD_U8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQADD_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQADD_U16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQSUB_S8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQSUB_U8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQSUB_S16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VQSUB_U16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VQMOVN_S16(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_arm_VQMOVN_S32(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_arm_VQMOVN_U16(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_arm_VSHL_D_IMM_16(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHL_D_IMM_32(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHL_D_IMM_64(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_S16(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_S32(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_S64(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_U16(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_U32(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHR_D_U64(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
void host_arm_VSHRN_32(codeblock_t *block, int dest_reg, int src_reg, int shift);
|
||||
|
||||
void host_arm_VSQRT_D(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_arm_VSQRT_S(codeblock_t *block, int dest_reg, int src_reg);
|
||||
|
||||
void host_arm_VSTR_D(codeblock_t *block, int src_reg, int base_reg, int offset);
|
||||
void host_arm_VSTR_S(codeblock_t *block, int src_reg, int base_reg, int offset);
|
||||
void host_arm_VSUB_D(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VSUB_F32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VSUB_S(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VSUB_I8(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VSUB_I16(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
void host_arm_VSUB_I32(codeblock_t *block, int dst_reg, int src_reg_n, int src_reg_m);
|
||||
|
||||
void host_arm_VZIP_D8(codeblock_t *block, int d_reg, int m_reg);
|
||||
void host_arm_VZIP_D16(codeblock_t *block, int d_reg, int m_reg);
|
||||
void host_arm_VZIP_D32(codeblock_t *block, int d_reg, int m_reg);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,345 +0,0 @@
|
||||
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
|
||||
# include <stddef.h>
|
||||
# include <stdint.h>
|
||||
# include <stdlib.h>
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
# include "codegen_backend.h"
|
||||
# include "codegen_backend_x86_defs.h"
|
||||
# include "codegen_backend_x86_ops.h"
|
||||
# include "codegen_backend_x86_ops_sse.h"
|
||||
# include "codegen_reg.h"
|
||||
# include "x86.h"
|
||||
# include "x86seg_common.h"
|
||||
# include "x86seg.h"
|
||||
|
||||
# if defined(__linux__) || defined(__APPLE__)
|
||||
# include <sys/mman.h>
|
||||
# include <unistd.h>
|
||||
# endif
|
||||
# if defined WIN32 || defined _WIN32 || defined _WIN32
|
||||
# include <windows.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
|
||||
void *codegen_mem_load_byte;
|
||||
void *codegen_mem_load_word;
|
||||
void *codegen_mem_load_long;
|
||||
void *codegen_mem_load_quad;
|
||||
void *codegen_mem_load_single;
|
||||
void *codegen_mem_load_double;
|
||||
|
||||
void *codegen_mem_store_byte;
|
||||
void *codegen_mem_store_word;
|
||||
void *codegen_mem_store_long;
|
||||
void *codegen_mem_store_quad;
|
||||
void *codegen_mem_store_single;
|
||||
void *codegen_mem_store_double;
|
||||
|
||||
void *codegen_gpf_rout;
|
||||
void *codegen_exit_rout;
|
||||
|
||||
host_reg_def_t codegen_host_reg_list[CODEGEN_HOST_REGS] = {
|
||||
/*Note: while EAX and EDX are normally volatile registers under x86
|
||||
calling conventions, the recompiler will explicitly save and restore
|
||||
them across funcion calls*/
|
||||
{REG_EAX, 0},
|
||||
{ REG_EBX, 0},
|
||||
{ REG_EDX, 0}
|
||||
};
|
||||
|
||||
host_reg_def_t codegen_host_fp_reg_list[CODEGEN_HOST_FP_REGS] = {
|
||||
{REG_XMM0, HOST_REG_FLAG_VOLATILE},
|
||||
{ REG_XMM1, HOST_REG_FLAG_VOLATILE},
|
||||
{ REG_XMM2, HOST_REG_FLAG_VOLATILE},
|
||||
{ REG_XMM3, HOST_REG_FLAG_VOLATILE},
|
||||
{ REG_XMM4, HOST_REG_FLAG_VOLATILE},
|
||||
{ REG_XMM5, HOST_REG_FLAG_VOLATILE}
|
||||
};
|
||||
|
||||
static void
|
||||
build_load_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint8_t *branch_offset;
|
||||
uint8_t *misaligned_offset = NULL;
|
||||
|
||||
/*In - ESI = address
|
||||
Out - ECX = data, ESI = abrt*/
|
||||
/*MOV ECX, ESI
|
||||
SHR ESI, 12
|
||||
MOV ESI, [readlookup2+ESI*4]
|
||||
CMP ESI, -1
|
||||
JNZ +
|
||||
MOVZX ECX, B[ESI+ECX]
|
||||
XOR ESI,ESI
|
||||
RET
|
||||
* PUSH EAX
|
||||
PUSH EDX
|
||||
PUSH ECX
|
||||
CALL readmembl
|
||||
POP ECX
|
||||
POP EDX
|
||||
POP EAX
|
||||
MOVZX ECX, AL
|
||||
RET
|
||||
*/
|
||||
host_x86_MOV32_REG_REG(block, REG_ECX, REG_ESI);
|
||||
host_x86_SHR32_IMM(block, REG_ESI, 12);
|
||||
host_x86_MOV32_REG_ABS_INDEX_SHIFT(block, REG_ESI, readlookup2, REG_ESI, 2);
|
||||
if (size != 1) {
|
||||
host_x86_TEST32_REG_IMM(block, REG_ECX, size - 1);
|
||||
misaligned_offset = host_x86_JNZ_short(block);
|
||||
}
|
||||
host_x86_CMP32_REG_IMM(block, REG_ESI, (uint32_t) -1);
|
||||
branch_offset = host_x86_JZ_short(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_x86_MOVZX_BASE_INDEX_32_8(block, REG_ECX, REG_ESI, REG_ECX);
|
||||
else if (size == 2 && !is_float)
|
||||
host_x86_MOVZX_BASE_INDEX_32_16(block, REG_ECX, REG_ESI, REG_ECX);
|
||||
else if (size == 4 && !is_float)
|
||||
host_x86_MOV32_REG_BASE_INDEX(block, REG_ECX, REG_ESI, REG_ECX);
|
||||
else if (size == 4 && is_float)
|
||||
host_x86_CVTSS2SD_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_ESI, REG_ECX);
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_XREG_BASE_INDEX(block, REG_XMM_TEMP, REG_ESI, REG_ECX);
|
||||
else
|
||||
fatal("build_load_routine: size=%i\n", size);
|
||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||
host_x86_RET(block);
|
||||
|
||||
*branch_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 1;
|
||||
if (size != 1)
|
||||
*misaligned_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 1;
|
||||
host_x86_PUSH(block, REG_EAX);
|
||||
host_x86_PUSH(block, REG_EDX);
|
||||
host_x86_PUSH(block, REG_ECX);
|
||||
if (size == 1)
|
||||
host_x86_CALL(block, (void *) readmembl);
|
||||
else if (size == 2)
|
||||
host_x86_CALL(block, (void *) readmemwl);
|
||||
else if (size == 4)
|
||||
host_x86_CALL(block, (void *) readmemll);
|
||||
else if (size == 8)
|
||||
host_x86_CALL(block, (void *) readmemql);
|
||||
host_x86_POP(block, REG_ECX);
|
||||
if (size == 1 && !is_float)
|
||||
host_x86_MOVZX_REG_32_8(block, REG_ECX, REG_EAX);
|
||||
else if (size == 2 && !is_float)
|
||||
host_x86_MOVZX_REG_32_16(block, REG_ECX, REG_EAX);
|
||||
else if (size == 4 && !is_float)
|
||||
host_x86_MOV32_REG_REG(block, REG_ECX, REG_EAX);
|
||||
else if (size == 4 && is_float) {
|
||||
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP, REG_EAX);
|
||||
host_x86_CVTSS2SD_XREG_XREG(block, REG_XMM_TEMP, REG_XMM_TEMP);
|
||||
} else if (size == 8) {
|
||||
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP, REG_EAX);
|
||||
host_x86_MOVD_XREG_REG(block, REG_XMM_TEMP2, REG_EDX);
|
||||
host_x86_UNPCKLPS_XREG_XREG(block, REG_XMM_TEMP, REG_XMM_TEMP2);
|
||||
}
|
||||
host_x86_POP(block, REG_EDX);
|
||||
host_x86_POP(block, REG_EAX);
|
||||
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
|
||||
host_x86_RET(block);
|
||||
block_pos = (block_pos + 63) & ~63;
|
||||
}
|
||||
|
||||
static void
|
||||
build_store_routine(codeblock_t *block, int size, int is_float)
|
||||
{
|
||||
uint8_t *branch_offset;
|
||||
uint8_t *misaligned_offset = NULL;
|
||||
|
||||
/*In - ECX = data, ESI = address
|
||||
Out - ESI = abrt
|
||||
Corrupts EDI*/
|
||||
/*MOV EDI, ESI
|
||||
SHR ESI, 12
|
||||
MOV ESI, [writelookup2+ESI*4]
|
||||
CMP ESI, -1
|
||||
JNZ +
|
||||
MOV [ESI+EDI], ECX
|
||||
XOR ESI,ESI
|
||||
RET
|
||||
* PUSH EAX
|
||||
PUSH EDX
|
||||
PUSH ECX
|
||||
CALL writemembl
|
||||
POP ECX
|
||||
POP EDX
|
||||
POP EAX
|
||||
MOVZX ECX, AL
|
||||
RET
|
||||
*/
|
||||
host_x86_MOV32_REG_REG(block, REG_EDI, REG_ESI);
|
||||
host_x86_SHR32_IMM(block, REG_ESI, 12);
|
||||
host_x86_MOV32_REG_ABS_INDEX_SHIFT(block, REG_ESI, writelookup2, REG_ESI, 2);
|
||||
if (size != 1) {
|
||||
host_x86_TEST32_REG_IMM(block, REG_EDI, size - 1);
|
||||
misaligned_offset = host_x86_JNZ_short(block);
|
||||
}
|
||||
host_x86_CMP32_REG_IMM(block, REG_ESI, (uint32_t) -1);
|
||||
branch_offset = host_x86_JZ_short(block);
|
||||
if (size == 1 && !is_float)
|
||||
host_x86_MOV8_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
|
||||
else if (size == 2 && !is_float)
|
||||
host_x86_MOV16_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
|
||||
else if (size == 4 && !is_float)
|
||||
host_x86_MOV32_BASE_INDEX_REG(block, REG_ESI, REG_EDI, REG_ECX);
|
||||
else if (size == 4 && is_float)
|
||||
host_x86_MOVD_BASE_INDEX_XREG(block, REG_ESI, REG_EDI, REG_XMM_TEMP);
|
||||
else if (size == 8)
|
||||
host_x86_MOVQ_BASE_INDEX_XREG(block, REG_ESI, REG_EDI, REG_XMM_TEMP);
|
||||
else
|
||||
fatal("build_store_routine: size=%i is_float=%i\n", size, is_float);
|
||||
host_x86_XOR32_REG_REG(block, REG_ESI, REG_ESI);
|
||||
host_x86_RET(block);
|
||||
|
||||
*branch_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) branch_offset) - 1;
|
||||
if (size != 1)
|
||||
*misaligned_offset = (uint8_t) ((uintptr_t) &block_write_data[block_pos] - (uintptr_t) misaligned_offset) - 1;
|
||||
if (size == 4 && is_float)
|
||||
host_x86_MOVD_REG_XREG(block, REG_ECX, REG_XMM_TEMP);
|
||||
host_x86_PUSH(block, REG_EAX);
|
||||
host_x86_PUSH(block, REG_EDX);
|
||||
host_x86_PUSH(block, REG_ECX);
|
||||
if (size == 8) {
|
||||
host_x86_MOVQ_STACK_OFFSET_XREG(block, -8, REG_XMM_TEMP);
|
||||
host_x86_SUB32_REG_IMM(block, REG_ESP, 8);
|
||||
}
|
||||
host_x86_PUSH(block, REG_EDI);
|
||||
if (size == 1)
|
||||
host_x86_CALL(block, (void *) writemembl);
|
||||
else if (size == 2)
|
||||
host_x86_CALL(block, (void *) writememwl);
|
||||
else if (size == 4)
|
||||
host_x86_CALL(block, (void *) writememll);
|
||||
else if (size == 8)
|
||||
host_x86_CALL(block, (void *) writememql);
|
||||
host_x86_POP(block, REG_EDI);
|
||||
if (size == 8)
|
||||
host_x86_ADD32_REG_IMM(block, REG_ESP, 8);
|
||||
host_x86_POP(block, REG_ECX);
|
||||
host_x86_POP(block, REG_EDX);
|
||||
host_x86_POP(block, REG_EAX);
|
||||
host_x86_MOVZX_REG_ABS_32_8(block, REG_ESI, &cpu_state.abrt);
|
||||
host_x86_RET(block);
|
||||
block_pos = (block_pos + 63) & ~63;
|
||||
}
|
||||
|
||||
static void
|
||||
build_loadstore_routines(codeblock_t *block)
|
||||
{
|
||||
codegen_mem_load_byte = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 1, 0);
|
||||
codegen_mem_load_word = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 2, 0);
|
||||
codegen_mem_load_long = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 4, 0);
|
||||
codegen_mem_load_quad = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 8, 0);
|
||||
codegen_mem_load_single = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 4, 1);
|
||||
codegen_mem_load_double = &codeblock[block_current].data[block_pos];
|
||||
build_load_routine(block, 8, 1);
|
||||
|
||||
codegen_mem_store_byte = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 1, 0);
|
||||
codegen_mem_store_word = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 2, 0);
|
||||
codegen_mem_store_long = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 4, 0);
|
||||
codegen_mem_store_quad = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 8, 0);
|
||||
codegen_mem_store_single = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 4, 1);
|
||||
codegen_mem_store_double = &codeblock[block_current].data[block_pos];
|
||||
build_store_routine(block, 8, 1);
|
||||
}
|
||||
|
||||
void
|
||||
codegen_backend_init(void)
|
||||
{
|
||||
codeblock_t *block;
|
||||
|
||||
codeblock = malloc(BLOCK_SIZE * sizeof(codeblock_t));
|
||||
codeblock_hash = malloc(HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
memset(codeblock, 0, BLOCK_SIZE * sizeof(codeblock_t));
|
||||
memset(codeblock_hash, 0, HASH_SIZE * sizeof(codeblock_t *));
|
||||
|
||||
for (uint32_t c = 0; c < BLOCK_SIZE; c++)
|
||||
codeblock[c].pc = BLOCK_PC_INVALID;
|
||||
|
||||
block_current = 0;
|
||||
block_pos = 0;
|
||||
block = &codeblock[block_current];
|
||||
block->head_mem_block = codegen_allocator_allocate(NULL, block_current);
|
||||
block->data = codeblock_allocator_get_ptr(block->head_mem_block);
|
||||
block_write_data = block->data;
|
||||
build_loadstore_routines(block);
|
||||
|
||||
codegen_gpf_rout = &codeblock[block_current].data[block_pos];
|
||||
host_x86_MOV32_STACK_IMM(block, STACK_ARG0, 0);
|
||||
host_x86_MOV32_STACK_IMM(block, STACK_ARG1, 0);
|
||||
host_x86_CALL(block, (void *) x86gpf);
|
||||
codegen_exit_rout = &codeblock[block_current].data[block_pos];
|
||||
host_x86_ADD32_REG_IMM(block, REG_ESP, 64);
|
||||
host_x86_POP(block, REG_EDI);
|
||||
host_x86_POP(block, REG_ESI);
|
||||
host_x86_POP(block, REG_EBP);
|
||||
host_x86_POP(block, REG_EDX);
|
||||
host_x86_RET(block);
|
||||
block_write_data = NULL;
|
||||
|
||||
cpu_state.old_fp_control = 0;
|
||||
asm(
|
||||
"fstcw %0\n"
|
||||
"stmxcsr %1\n"
|
||||
: "=m"(cpu_state.old_fp_control2),
|
||||
"=m"(cpu_state.old_fp_control));
|
||||
cpu_state.trunc_fp_control = cpu_state.old_fp_control | 0x6000;
|
||||
}
|
||||
|
||||
void
|
||||
codegen_set_rounding_mode(int mode)
|
||||
{
|
||||
/*SSE*/
|
||||
cpu_state.new_fp_control = (cpu_state.old_fp_control & ~0x6000) | (mode << 13);
|
||||
/*x87 - used for double -> i64 conversions*/
|
||||
cpu_state.new_fp_control2 = (cpu_state.old_fp_control2 & ~0x0c00) | (mode << 10);
|
||||
}
|
||||
|
||||
void
|
||||
codegen_backend_prologue(codeblock_t *block)
|
||||
{
|
||||
block_pos = BLOCK_START; /*Entry code*/
|
||||
host_x86_PUSH(block, REG_EBX);
|
||||
host_x86_PUSH(block, REG_EBP);
|
||||
host_x86_PUSH(block, REG_ESI);
|
||||
host_x86_PUSH(block, REG_EDI);
|
||||
host_x86_SUB32_REG_IMM(block, REG_ESP, 64);
|
||||
host_x86_MOV32_REG_IMM(block, REG_EBP, ((uintptr_t) &cpu_state) + 128);
|
||||
if (block->flags & CODEBLOCK_HAS_FPU) {
|
||||
host_x86_MOV32_REG_ABS(block, REG_EAX, &cpu_state.TOP);
|
||||
host_x86_SUB32_REG_IMM(block, REG_EAX, block->TOP);
|
||||
host_x86_MOV32_BASE_OFFSET_REG(block, REG_ESP, IREG_TOP_diff_stack_offset, REG_EAX);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
codegen_backend_epilogue(codeblock_t *block)
|
||||
{
|
||||
host_x86_ADD32_REG_IMM(block, REG_ESP, 64);
|
||||
host_x86_POP(block, REG_EDI);
|
||||
host_x86_POP(block, REG_ESI);
|
||||
host_x86_POP(block, REG_EBP);
|
||||
host_x86_POP(block, REG_EDX);
|
||||
host_x86_RET(block);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#include "codegen_backend_x86_defs.h"
|
||||
|
||||
#define BLOCK_SIZE 0x10000
|
||||
#define BLOCK_MASK 0xffff
|
||||
#define BLOCK_START 0
|
||||
|
||||
#define HASH_SIZE 0x20000
|
||||
#define HASH_MASK 0x1ffff
|
||||
|
||||
#define HASH(l) ((l) &0x1ffff)
|
||||
|
||||
#define BLOCK_MAX 0x3c0
|
||||
|
||||
#define CODEGEN_BACKEND_HAS_MOV_IMM
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef _CODEGEN_BACKEND_X86_DEFS_H_
|
||||
#define _CODEGEN_BACKEND_X86_DEFS_H_
|
||||
|
||||
#define REG_EAX 0
|
||||
#define REG_ECX 1
|
||||
#define REG_EDX 2
|
||||
#define REG_EBX 3
|
||||
#define REG_ESP 4
|
||||
#define REG_EBP 5
|
||||
#define REG_ESI 6
|
||||
#define REG_EDI 7
|
||||
|
||||
#define REG_XMM0 0
|
||||
#define REG_XMM1 1
|
||||
#define REG_XMM2 2
|
||||
#define REG_XMM3 3
|
||||
#define REG_XMM4 4
|
||||
#define REG_XMM5 5
|
||||
#define REG_XMM6 6
|
||||
#define REG_XMM7 7
|
||||
|
||||
#define REG_XMM_TEMP REG_XMM7
|
||||
#define REG_XMM_TEMP2 REG_XMM6
|
||||
|
||||
#define CODEGEN_HOST_REGS 3
|
||||
#define CODEGEN_HOST_FP_REGS 6
|
||||
|
||||
extern void *codegen_mem_load_byte;
|
||||
extern void *codegen_mem_load_word;
|
||||
extern void *codegen_mem_load_long;
|
||||
extern void *codegen_mem_load_quad;
|
||||
extern void *codegen_mem_load_single;
|
||||
extern void *codegen_mem_load_double;
|
||||
|
||||
extern void *codegen_mem_store_byte;
|
||||
extern void *codegen_mem_store_word;
|
||||
extern void *codegen_mem_store_long;
|
||||
extern void *codegen_mem_store_quad;
|
||||
extern void *codegen_mem_store_single;
|
||||
extern void *codegen_mem_store_double;
|
||||
|
||||
extern void *codegen_gpf_rout;
|
||||
extern void *codegen_exit_rout;
|
||||
|
||||
#define STACK_ARG0 (0)
|
||||
#define STACK_ARG1 (4)
|
||||
#define STACK_ARG2 (8)
|
||||
#define STACK_ARG3 (12)
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,195 +0,0 @@
|
||||
void host_x86_ADD32_REG_ABS(codeblock_t *block, int dst_reg, void *p);
|
||||
|
||||
void host_x86_ADD8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_ADD16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_ADD32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_ADD8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_ADD16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_ADD32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_AND8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_AND16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_AND32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_AND8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_AND16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_AND32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_CALL(codeblock_t *block, void *p);
|
||||
|
||||
void host_x86_CMP16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_CMP32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_CMP8_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
|
||||
void host_x86_CMP16_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
|
||||
void host_x86_CMP32_REG_REG(codeblock_t *block, int src_reg_a, int src_reg_b);
|
||||
|
||||
void host_x86_INC32_ABS(codeblock_t *block, void *p);
|
||||
|
||||
void host_x86_JMP(codeblock_t *block, void *p);
|
||||
uint32_t *host_x86_JMP_short(codeblock_t *block);
|
||||
uint32_t *host_x86_JMP_long(codeblock_t *block);
|
||||
|
||||
void host_x86_JNZ(codeblock_t *block, void *p);
|
||||
void host_x86_JZ(codeblock_t *block, void *p);
|
||||
|
||||
uint8_t *host_x86_JNZ_short(codeblock_t *block);
|
||||
uint8_t *host_x86_JS_short(codeblock_t *block);
|
||||
uint8_t *host_x86_JZ_short(codeblock_t *block);
|
||||
|
||||
uint32_t *host_x86_JNB_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNBE_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNL_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNLE_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNO_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNS_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JNZ_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JB_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JBE_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JL_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JLE_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JO_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JS_long(codeblock_t *block);
|
||||
uint32_t *host_x86_JZ_long(codeblock_t *block);
|
||||
|
||||
void host_x86_LAHF(codeblock_t *block);
|
||||
|
||||
void host_x86_LEA_REG_IMM(codeblock_t *block, int dst_reg, int src_reg_a, uint32_t offset);
|
||||
void host_x86_LEA_REG_REG(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b);
|
||||
void host_x86_LEA_REG_REG_SHIFT(codeblock_t *block, int dst_reg, int src_reg_a, int src_reg_b, int shift);
|
||||
|
||||
void host_x86_MOV8_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data);
|
||||
void host_x86_MOV16_ABS_IMM(codeblock_t *block, void *p, uint16_t imm_data);
|
||||
void host_x86_MOV32_ABS_IMM(codeblock_t *block, void *p, uint32_t imm_data);
|
||||
|
||||
void host_x86_MOV8_ABS_REG(codeblock_t *block, void *p, int src_reg);
|
||||
void host_x86_MOV16_ABS_REG(codeblock_t *block, void *p, int src_reg);
|
||||
void host_x86_MOV32_ABS_REG(codeblock_t *block, void *p, int src_reg);
|
||||
|
||||
void host_x86_MOV8_ABS_REG_REG_SHIFT_REG(codeblock_t *block, uint32_t addr, int base_reg, int idx_reg, int shift, int src_reg);
|
||||
|
||||
void host_x86_MOV8_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
|
||||
void host_x86_MOV16_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
|
||||
void host_x86_MOV32_BASE_INDEX_REG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
|
||||
|
||||
void host_x86_MOV16_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg);
|
||||
void host_x86_MOV32_BASE_OFFSET_REG(codeblock_t *block, int base_reg, int offset, int dst_reg);
|
||||
|
||||
void host_x86_MOV32_BASE_OFFSET_IMM(codeblock_t *block, int base_reg, int offset, uint32_t imm_data);
|
||||
|
||||
void host_x86_MOV8_REG_ABS(codeblock_t *block, int dst_reg, void *p);
|
||||
void host_x86_MOV16_REG_ABS(codeblock_t *block, int dst_reg, void *p);
|
||||
void host_x86_MOV32_REG_ABS(codeblock_t *block, int dst_reg, void *p);
|
||||
|
||||
void host_x86_MOV32_REG_ABS_INDEX_SHIFT(codeblock_t *block, int dst_reg, void *p, int idx_reg, int shift);
|
||||
|
||||
void host_x86_MOV8_REG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_addr, uint32_t addr, int base_reg, int idx_reg, int shift);
|
||||
|
||||
void host_x86_MOV32_REG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
|
||||
void host_x86_MOV16_REG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
|
||||
void host_x86_MOV32_REG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
|
||||
|
||||
void host_x86_MOV8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_MOV16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_MOV32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_MOV8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOV16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOV32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
#define host_x86_MOV16_STACK_REG(block, offset, src_reg) host_x86_MOV16_BASE_OFFSET_REG(block, REG_ESP, offset, src_reg)
|
||||
|
||||
void host_x86_MOV32_STACK_IMM(codeblock_t *block, int32_t offset, uint32_t imm_data);
|
||||
|
||||
void host_x86_MOVSX_REG_16_8(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOVSX_REG_32_8(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOVSX_REG_32_16(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MOVZX_REG_16_8(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOVZX_REG_32_8(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOVZX_REG_32_16(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MOVZX_REG_ABS_16_8(codeblock_t *block, int dst_reg, void *p);
|
||||
void host_x86_MOVZX_REG_ABS_32_8(codeblock_t *block, int dst_reg, void *p);
|
||||
void host_x86_MOVZX_REG_ABS_32_16(codeblock_t *block, int dst_reg, void *p);
|
||||
|
||||
void host_x86_MOVZX_BASE_INDEX_32_8(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
void host_x86_MOVZX_BASE_INDEX_32_16(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
|
||||
void host_x86_OR8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_OR16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_OR32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_OR8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_OR16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_OR32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_POP(codeblock_t *block, int src_reg);
|
||||
|
||||
void host_x86_PUSH(codeblock_t *block, int src_reg);
|
||||
|
||||
void host_x86_RET(codeblock_t *block);
|
||||
|
||||
void host_x86_ROL8_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_ROL16_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_ROL32_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_ROL8_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_ROL16_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_ROL32_CL(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_x86_ROR8_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_ROR16_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_ROR32_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_ROR8_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_ROR16_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_ROR32_CL(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_x86_SAR8_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SAR16_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SAR32_CL(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_x86_SAR8_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SAR16_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SAR32_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_SHL8_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SHL16_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SHL32_CL(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_x86_SHL8_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SHL16_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SHL32_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_SHR8_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SHR16_CL(codeblock_t *block, int dst_reg);
|
||||
void host_x86_SHR32_CL(codeblock_t *block, int dst_reg);
|
||||
|
||||
void host_x86_SHR8_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SHR16_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_SHR32_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_SUB8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_SUB16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_SUB32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_SUB8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_SUB16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_SUB32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_TEST8_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
|
||||
void host_x86_TEST16_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
|
||||
void host_x86_TEST32_REG(codeblock_t *block, int src_host_reg, int dst_host_reg);
|
||||
|
||||
void host_x86_TEST32_REG_IMM(codeblock_t *block, int src_host_reg, uint32_t imm_data);
|
||||
|
||||
void host_x86_XOR8_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_XOR16_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_XOR32_REG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_XOR8_REG_IMM(codeblock_t *block, int dst_reg, uint8_t imm_data);
|
||||
void host_x86_XOR16_REG_IMM(codeblock_t *block, int dst_reg, uint16_t imm_data);
|
||||
void host_x86_XOR32_REG_IMM(codeblock_t *block, int dst_reg, uint32_t imm_data);
|
||||
@@ -1,75 +0,0 @@
|
||||
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
|
||||
# include <stdint.h>
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
# include "codegen_backend.h"
|
||||
# include "codegen_backend_x86_defs.h"
|
||||
# include "codegen_backend_x86_ops_fpu.h"
|
||||
# include "codegen_backend_x86_ops_helpers.h"
|
||||
|
||||
void
|
||||
host_x87_FILDq_BASE(codeblock_t *block, int base_reg)
|
||||
{
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0xdf, 0x2c, 0x24); /*FILDq [ESP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 2);
|
||||
codegen_addbyte2(block, 0xdf, 0x28 | base_reg); /*FILDq [base_reg]*/
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x87_FISTPq_BASE(codeblock_t *block, int base_reg)
|
||||
{
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0xdf, 0x3c, 0x24); /*FISTPq [ESP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 2);
|
||||
codegen_addbyte2(block, 0xdf, 0x38 | base_reg); /*FISTPq [base_reg]*/
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x87_FLDCW(codeblock_t *block, void *p)
|
||||
{
|
||||
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
|
||||
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0xd9, 0x68 | REG_EBP, offset); /*FLDCW offset[EBP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte2(block, 0xd9, 0x2d); /*FLDCW [p]*/
|
||||
codegen_addlong(block, (uint32_t) p);
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x87_FLDd_BASE(codeblock_t *block, int base_reg)
|
||||
{
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0xdd, 0x04, 0x24); /*FILDq [ESP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 2);
|
||||
codegen_addbyte2(block, 0xdd, 0x08 | base_reg); /*FILDq [base_reg]*/
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x87_FSTPd_BASE(codeblock_t *block, int base_reg)
|
||||
{
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0xdd, 0x1c, 0x24); /*FILDq [ESP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 2);
|
||||
codegen_addbyte2(block, 0xdd, 0x18 | base_reg); /*FILDq [base_reg]*/
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +0,0 @@
|
||||
void host_x87_FILDq_BASE(codeblock_t *block, int base_reg);
|
||||
void host_x87_FISTPq_BASE(codeblock_t *block, int base_reg);
|
||||
void host_x87_FLDCW(codeblock_t *block, void *p);
|
||||
void host_x87_FLDd_BASE(codeblock_t *block, int base_reg);
|
||||
void host_x87_FSTPd_BASE(codeblock_t *block, int base_reg);
|
||||
@@ -1,94 +0,0 @@
|
||||
#define JMP_LEN_BYTES 5
|
||||
|
||||
static inline void
|
||||
codegen_addbyte(UNUSED(codeblock_t *block), uint8_t val)
|
||||
{
|
||||
if (block_pos >= BLOCK_MAX)
|
||||
fatal("codegen_addbyte over! %i\n", block_pos);
|
||||
block_write_data[block_pos++] = val;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte2(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2))
|
||||
fatal("codegen_addbyte2 over! %i\n", block_pos);
|
||||
block_write_data[block_pos++] = vala;
|
||||
block_write_data[block_pos++] = valb;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte3(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 3))
|
||||
fatal("codegen_addbyte3 over! %i\n", block_pos);
|
||||
block_write_data[block_pos++] = vala;
|
||||
block_write_data[block_pos++] = valb;
|
||||
block_write_data[block_pos++] = valc;
|
||||
}
|
||||
static inline void
|
||||
codegen_addbyte4(UNUSED(codeblock_t *block), uint8_t vala, uint8_t valb, uint8_t valc, uint8_t vald)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4))
|
||||
fatal("codegen_addbyte4 over! %i\n", block_pos);
|
||||
block_write_data[block_pos++] = vala;
|
||||
block_write_data[block_pos++] = valb;
|
||||
block_write_data[block_pos++] = valc;
|
||||
block_write_data[block_pos++] = vald;
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addword(UNUSED(codeblock_t *block), uint16_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 2))
|
||||
fatal("codegen_addword over! %i\n", block_pos);
|
||||
*(uint16_t *) &block_write_data[block_pos] = val;
|
||||
block_pos += 2;
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addlong(UNUSED(codeblock_t *block), uint32_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 4))
|
||||
fatal("codegen_addlong over! %i\n", block_pos);
|
||||
*(uint32_t *) &block_write_data[block_pos] = val;
|
||||
block_pos += 4;
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_addquad(UNUSED(codeblock_t *block), uint64_t val)
|
||||
{
|
||||
if (block_pos > (BLOCK_MAX - 8))
|
||||
fatal("codegen_addquad over! %i\n", block_pos);
|
||||
*(uint64_t *) &block_write_data[block_pos] = val;
|
||||
block_pos += 8;
|
||||
}
|
||||
|
||||
static void
|
||||
codegen_allocate_new_block(codeblock_t *block)
|
||||
{
|
||||
/*Current block is full. Allocate a new block*/
|
||||
struct mem_block_t *new_block = codegen_allocator_allocate(block->head_mem_block, get_block_nr(block));
|
||||
uint8_t *new_ptr = codeblock_allocator_get_ptr(new_block);
|
||||
|
||||
/*Add a jump instruction to the new block*/
|
||||
codegen_addbyte(block, 0xe9); /*JMP*/
|
||||
codegen_addlong(block, (uintptr_t) new_ptr - (uintptr_t) &block_write_data[block_pos + 4]);
|
||||
|
||||
/*Set write address to start of new block*/
|
||||
block_pos = 0;
|
||||
block_write_data = new_ptr;
|
||||
}
|
||||
|
||||
static inline void
|
||||
codegen_alloc_bytes(codeblock_t *block, int size)
|
||||
{
|
||||
if (block_pos > ((BLOCK_MAX - size) - JMP_LEN_BYTES))
|
||||
codegen_allocate_new_block(block);
|
||||
}
|
||||
|
||||
static inline int
|
||||
is_imm8(uint32_t imm_data)
|
||||
{
|
||||
if (imm_data <= 0x7f || imm_data >= 0xffffff80)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,630 +0,0 @@
|
||||
#if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
|
||||
# include <stdint.h>
|
||||
# include <86box/86box.h>
|
||||
# include "cpu.h"
|
||||
# include <86box/mem.h>
|
||||
# include <86box/plat_unused.h>
|
||||
|
||||
# include "codegen.h"
|
||||
# include "codegen_allocator.h"
|
||||
# include "codegen_backend.h"
|
||||
# include "codegen_backend_x86_defs.h"
|
||||
# include "codegen_backend_x86_ops_sse.h"
|
||||
# include "codegen_backend_x86_ops_helpers.h"
|
||||
|
||||
void
|
||||
host_x86_ADDPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x58, 0xc0 | src_reg | (dst_reg << 3)); /*ADDPS dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_ADDSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x58, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_CMPPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg, int type)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x0f, 0xc2, 0xc0 | src_reg | (dst_reg << 3), type); /*CMPPS dst_reg, src_reg, type*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_COMISD_XREG_XREG(codeblock_t *block, int src_reg_a, int src_reg_b)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x2e, 0xc0 | src_reg_b | (src_reg_a << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_CVTDQ2PS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x5b, 0xc0 | src_reg | (dst_reg << 3)); /*CVTDQ2PS dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_CVTPS2DQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x5b, 0xc0 | src_reg | (dst_reg << 3)); /*CVTPS2DQ dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_CVTSD2SI_REG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x2d, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSD2SI dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_CVTSD2SS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x5a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSD2SS dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_CVTSI2SD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x2a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSI2SD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_CVTSI2SS_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x2a, 0xc0 | src_reg | (dst_reg << 3)); /*CVTSI2SD dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_CVTSS2SD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x5a, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_CVTSS2SD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x5a, 0x04 | (dst_reg << 3)); /*CVTSS2SD XMMx, [base_reg + idx_reg]*/
|
||||
codegen_addbyte(block, base_reg | (idx_reg << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_DIVSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x5e, 0xc0 | src_reg | (dst_reg << 3)); /*DIVSD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_DIVSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x5e, 0xc0 | src_reg | (dst_reg << 3)); /*DIVSS dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_LDMXCSR(codeblock_t *block, void *p)
|
||||
{
|
||||
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
|
||||
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x0f, 0xae, 0x50 | REG_EBP, offset); /*LDMXCSR offset[EBP]*/
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 7);
|
||||
codegen_addbyte3(block, 0x0f, 0xae, 0x15); /*LDMXCSR [p]*/
|
||||
codegen_addlong(block, (uint32_t) p);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MAXSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x5f, 0xc0 | src_reg | (dst_reg << 3)); /*MAXSD dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MOVD_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x7e, 0x04 | (src_reg << 3)); /*MOVD XMMx, [base_reg + idx_reg]*/
|
||||
codegen_addbyte(block, base_reg | (idx_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_MOVD_REG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x7e, 0xc0 | dst_reg | (src_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_MOVD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x6e, 0x04 | (dst_reg << 3)); /*MOVD XMMx, [base_reg + idx_reg]*/
|
||||
codegen_addbyte(block, base_reg | (idx_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_MOVD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x6e, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MOVQ_ABS_XREG(codeblock_t *block, void *p, int src_reg)
|
||||
{
|
||||
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
|
||||
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x45 | (src_reg << 3)); /*MOVQ offset[EBP], src_reg*/
|
||||
codegen_addbyte(block, offset);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 8);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x05 | (src_reg << 3)); /*MOVQ [p], src_reg*/
|
||||
codegen_addlong(block, (uint32_t) p);
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_ABS_REG_REG_SHIFT_XREG(codeblock_t *block, uint32_t addr, int src_reg_a, int src_reg_b, int shift, int src_reg)
|
||||
{
|
||||
if (addr < 0x80 || addr >= 0xffffff80) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte3(block, 0x66, 0x0f, 0xd6); /*MOVQ addr[src_reg_a + src_reg_b << shift], XMMx*/
|
||||
codegen_addbyte3(block, 0x44 | (src_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6), addr & 0xff);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte3(block, 0x66, 0x0f, 0xd6); /*MOVQ addr[src_reg_a + src_reg_b << shift], XMMx*/
|
||||
codegen_addbyte2(block, 0x84 | (src_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6));
|
||||
codegen_addlong(block, addr);
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x04 | (src_reg << 3)); /*MOVQ XMMx, [base_reg + idx_reg]*/
|
||||
codegen_addbyte(block, base_reg | (idx_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_BASE_OFFSET_XREG(codeblock_t *block, int base_reg, int offset, int src_reg)
|
||||
{
|
||||
if (offset >= -128 && offset < 127) {
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x44 | (src_reg << 3)); /*MOVQ [ESP + offset], XMMx*/
|
||||
codegen_addbyte2(block, 0x24, offset);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x40 | base_reg | (src_reg << 3)); /*MOVQ [base_reg + offset], XMMx*/
|
||||
codegen_addbyte(block, offset);
|
||||
}
|
||||
} else
|
||||
fatal("MOVQ_BASE_OFFSET_XREG - offset %i\n", offset);
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_STACK_OFFSET_XREG(codeblock_t *block, int offset, int src_reg)
|
||||
{
|
||||
if (!offset) {
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x04 | (src_reg << 3)); /*MOVQ [ESP], src_reg*/
|
||||
codegen_addbyte(block, 0x24);
|
||||
} else if (offset >= -0x80 && offset < 0x80) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x44 | (src_reg << 3)); /*MOVQ offset[ESP], src_reg*/
|
||||
codegen_addbyte2(block, 0x24, offset & 0xff);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd6, 0x84 | (src_reg << 3)); /*MOVQ offset[ESP], src_reg*/
|
||||
codegen_addbyte(block, 0x24);
|
||||
codegen_addlong(block, offset);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MOVQ_XREG_ABS(codeblock_t *block, int dst_reg, void *p)
|
||||
{
|
||||
int offset = (uintptr_t) p - (((uintptr_t) &cpu_state) + 128);
|
||||
|
||||
if (offset >= -128 && offset < 127) {
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x45 | (dst_reg << 3)); /*MOVQ offset[EBP], src_reg*/
|
||||
codegen_addbyte(block, offset);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 8);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x05 | (dst_reg << 3)); /*MOVQ [p], src_reg*/
|
||||
codegen_addlong(block, (uint32_t) p);
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_XREG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_reg, uint32_t addr, int src_reg_a, int src_reg_b, int shift)
|
||||
{
|
||||
if (addr < 0x80 || addr >= 0xffffff80) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte3(block, 0xf3, 0x0f, 0x7e); /*MOVQ XMMx, addr[src_reg_a + src_reg_b << shift]*/
|
||||
codegen_addbyte3(block, 0x44 | (dst_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6), addr & 0xff);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte3(block, 0xf3, 0x0f, 0x7e); /*MOVQ XMMx, addr[src_reg_a + src_reg_b << shift]*/
|
||||
codegen_addbyte2(block, 0x84 | (dst_reg << 3), src_reg_a | (src_reg_b << 3) | (shift << 6));
|
||||
codegen_addlong(block, addr);
|
||||
}
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x04 | (dst_reg << 3)); /*MOVQ XMMx, [base_reg + idx_reg]*/
|
||||
codegen_addbyte(block, base_reg | (idx_reg << 3));
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_XREG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset)
|
||||
{
|
||||
if (offset >= -128 && offset < 127) {
|
||||
if (base_reg == REG_ESP) {
|
||||
codegen_alloc_bytes(block, 6);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x44 | (dst_reg << 3)); /*MOVQ XMMx, [ESP + offset]*/
|
||||
codegen_addbyte2(block, 0x24, offset);
|
||||
} else {
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0x40 | base_reg | (dst_reg << 3)); /*MOVQ XMMx, [base_reg + offset]*/
|
||||
codegen_addbyte(block, offset);
|
||||
}
|
||||
} else
|
||||
fatal("MOVQ_REG_BASE_OFFSET - offset %i\n", offset);
|
||||
}
|
||||
void
|
||||
host_x86_MOVQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x7e, 0xc0 | src_reg | (dst_reg << 3)); /*MOVQ dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MAXPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x5f, 0xc0 | src_reg | (dst_reg << 3)); /*MAXPS dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_MINPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x5d, 0xc0 | src_reg | (dst_reg << 3)); /*MINPS dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_MULPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x59, 0xc0 | src_reg | (dst_reg << 3)); /*MULPS dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_MULSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x59, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PACKSSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x63, 0xc0 | src_reg | (dst_reg << 3)); /*PACKSSWB dst_reg, src_reg*/
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
|
||||
codegen_addbyte(block, 0x88);
|
||||
}
|
||||
void
|
||||
host_x86_PACKSSDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x6b, 0xc0 | src_reg | (dst_reg << 3)); /*PACKSSDW dst_reg, src_reg*/
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
|
||||
codegen_addbyte(block, 0x88);
|
||||
}
|
||||
void
|
||||
host_x86_PACKUSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 9);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x67, 0xc0 | src_reg | (dst_reg << 3)); /*PACKUSWB dst_reg, src_reg*/
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | dst_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0x88 (move bits 64-95 to 32-63)*/
|
||||
codegen_addbyte(block, 0x88);
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PADDB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xfc, 0xc0 | src_reg | (dst_reg << 3)); /*PADDB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xfd, 0xc0 | src_reg | (dst_reg << 3)); /*PADDW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xfe, 0xc0 | src_reg | (dst_reg << 3)); /*PADDD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xec, 0xc0 | src_reg | (dst_reg << 3)); /*PADDSB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xed, 0xc0 | src_reg | (dst_reg << 3)); /*PADDSW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xdc, 0xc0 | src_reg | (dst_reg << 3)); /*PADDUSB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PADDUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xdd, 0xc0 | src_reg | (dst_reg << 3)); /*PADDUSW dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PAND_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xdb, 0xc0 | src_reg | (dst_reg << 3)); /*PAND dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PANDN_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xdf, 0xc0 | src_reg | (dst_reg << 3)); /*PANDN dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_POR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xeb, 0xc0 | src_reg | (dst_reg << 3)); /*POR dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PXOR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xef, 0xc0 | src_reg | (dst_reg << 3)); /*PXOR dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PCMPEQB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x74, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PCMPEQW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x75, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PCMPEQD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x76, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPEQD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PCMPGTB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x64, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PCMPGTW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x65, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PCMPGTD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x66, 0xc0 | src_reg | (dst_reg << 3)); /*PCMPGTD dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PMADDWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xf5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PMULHW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xe5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PMULLW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd5, 0xc0 | src_reg | (dst_reg << 3)); /*PMULLW dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PSHUFD_XREG_XREG_IMM(codeblock_t *block, int dst_reg, int src_reg, uint8_t shuffle)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x70, 0xc0 | src_reg | (dst_reg << 3)); /*PSHUFD dst_reg, dst_reg, 0xee (move top 64-bits to low 64-bits)*/
|
||||
codegen_addbyte(block, shuffle);
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PSLLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x30 | dst_reg); /*PSLLW dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSLLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x30 | dst_reg); /*PSLLD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSLLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x30 | dst_reg); /*PSLLD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRAW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x20 | dst_reg); /*PSRAW dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRAD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x20 | dst_reg); /*PSRAD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRAQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x20 | dst_reg); /*PSRAD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x71, 0xc0 | 0x10 | dst_reg); /*PSRLW dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x72, 0xc0 | 0x10 | dst_reg); /*PSRLD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
void
|
||||
host_x86_PSRLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift)
|
||||
{
|
||||
codegen_alloc_bytes(block, 5);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x73, 0xc0 | 0x10 | dst_reg); /*PSRLD dst_reg, imm*/
|
||||
codegen_addbyte(block, shift);
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PSUBB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xf8, 0xc0 | src_reg | (dst_reg << 3)); /*PADDB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xf9, 0xc0 | src_reg | (dst_reg << 3)); /*PADDW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xfa, 0xc0 | src_reg | (dst_reg << 3)); /*PADDD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xe8, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBSB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xe9, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBSW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd8, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBUSB dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PSUBUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0xd9, 0xc0 | src_reg | (dst_reg << 3)); /*PSUBUSW dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_PUNPCKLBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x60, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLBW dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PUNPCKLWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x61, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLWD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_PUNPCKLDQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0x66, 0x0f, 0x62, 0xc0 | src_reg | (dst_reg << 3)); /*PUNPCKLDQ dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_SQRTSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x51, 0xc0 | src_reg | (dst_reg << 3)); /*SQRTSD dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_SQRTSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf3, 0x0f, 0x51, 0xc0 | src_reg | (dst_reg << 3)); /*SQRTSS dst_reg, src_reg*/
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_SUBPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x5c, 0xc0 | src_reg | (dst_reg << 3)); /*SUBPS dst_reg, src_reg*/
|
||||
}
|
||||
void
|
||||
host_x86_SUBSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 4);
|
||||
codegen_addbyte4(block, 0xf2, 0x0f, 0x5c, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
|
||||
void
|
||||
host_x86_UNPCKLPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg)
|
||||
{
|
||||
codegen_alloc_bytes(block, 3);
|
||||
codegen_addbyte3(block, 0x0f, 0x14, 0xc0 | src_reg | (dst_reg << 3));
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,111 +0,0 @@
|
||||
void host_x86_ADDPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_ADDSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
#define CMPPS_EQ 0
|
||||
#define CMPPS_NLT 5
|
||||
#define CMPPS_NLE 6
|
||||
void host_x86_CMPPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg, int type);
|
||||
|
||||
void host_x86_COMISD_XREG_XREG(codeblock_t *block, int src_reg_a, int src_reg_b);
|
||||
|
||||
void host_x86_CVTDQ2PS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_CVTPS2DQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_CVTSD2SI_REG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_CVTSD2SS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_CVTSI2SD_XREG_REG(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_x86_CVTSI2SS_XREG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_CVTSS2SD_XREG_XREG(codeblock_t *block, int dest_reg, int src_reg);
|
||||
void host_x86_CVTSS2SD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
|
||||
void host_x86_DIVSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_DIVSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_LDMXCSR(codeblock_t *block, void *p);
|
||||
|
||||
void host_x86_MAXSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MOVD_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
|
||||
void host_x86_MOVD_REG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MOVD_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
void host_x86_MOVD_XREG_REG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MOVQ_ABS_XREG(codeblock_t *block, void *p, int src_reg);
|
||||
void host_x86_MOVQ_ABS_REG_REG_SHIFT_XREG(codeblock_t *block, uint32_t addr, int src_reg_a, int src_reg_b, int shift, int src_reg);
|
||||
void host_x86_MOVQ_BASE_INDEX_XREG(codeblock_t *block, int base_reg, int idx_reg, int src_reg);
|
||||
void host_x86_MOVQ_BASE_OFFSET_XREG(codeblock_t *block, int base_reg, int offset, int src_reg);
|
||||
void host_x86_MOVQ_STACK_OFFSET_XREG(codeblock_t *block, int offset, int src_reg);
|
||||
|
||||
void host_x86_MOVQ_XREG_ABS(codeblock_t *block, int dst_reg, void *p);
|
||||
void host_x86_MOVQ_XREG_ABS_REG_REG_SHIFT(codeblock_t *block, int dst_reg, uint32_t addr, int src_reg_a, int src_reg_b, int shift);
|
||||
void host_x86_MOVQ_XREG_BASE_INDEX(codeblock_t *block, int dst_reg, int base_reg, int idx_reg);
|
||||
void host_x86_MOVQ_XREG_BASE_OFFSET(codeblock_t *block, int dst_reg, int base_reg, int offset);
|
||||
void host_x86_MOVQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MAXPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MINPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_MULPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_MULSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PACKSSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PACKSSDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PACKUSWB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PADDB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PADDUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PAND_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PANDN_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_POR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PXOR_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PCMPEQB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PCMPEQW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PCMPEQD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PCMPGTB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PCMPGTW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PCMPGTD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PMADDWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PMULHW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PMULLW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PSLLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSLLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSLLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRAW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRAD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRAQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRLW_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRLD_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
void host_x86_PSRLQ_XREG_IMM(codeblock_t *block, int dst_reg, int shift);
|
||||
|
||||
void host_x86_PSHUFD_XREG_XREG_IMM(codeblock_t *block, int dst_reg, int src_reg, uint8_t shuffle);
|
||||
|
||||
void host_x86_PSUBB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBUSB_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PSUBUSW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_PUNPCKLBW_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PUNPCKLWD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_PUNPCKLDQ_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_SQRTSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_SQRTSS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_SUBPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
void host_x86_SUBSD_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
|
||||
void host_x86_UNPCKLPS_XREG_XREG(codeblock_t *block, int dst_reg, int src_reg);
|
||||
File diff suppressed because it is too large
Load Diff
@@ -388,11 +388,11 @@ typedef struct {
|
||||
uint32_t old_fp_control;
|
||||
uint32_t new_fp_control;
|
||||
# endif
|
||||
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
# if defined _M_IX86
|
||||
uint16_t old_fp_control2;
|
||||
uint16_t new_fp_control2;
|
||||
# endif
|
||||
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64
|
||||
# if defined __amd64__ || defined _M_X64
|
||||
uint32_t trunc_fp_control;
|
||||
# endif
|
||||
#else
|
||||
|
||||
@@ -106,7 +106,7 @@ typedef struct mouse_wacom_t {
|
||||
int last_abs_y; /* Suppressed/Increment Mode. */
|
||||
union {
|
||||
uint32_t settings; /* Settings DWORD */
|
||||
/* We don't target any architectures except x86/x64/ARM32/ARM64.
|
||||
/* We don't target any architectures except x64/ARM64.
|
||||
(The ABIs for those are explicit in little-endian bit ordering) */
|
||||
struct settings_bits {
|
||||
uint8_t remote_mode : 1;
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
* Unconditionally aligning does not cost very much, so do it if unsure
|
||||
*/
|
||||
#ifndef STRICT_ALIGN
|
||||
# define STRICT_ALIGN !(defined(__i386) || defined (__amd64))
|
||||
# define STRICT_ALIGN !(defined (__amd64))
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef VIDEO_VOODOO_RENDER_H
|
||||
#define VIDEO_VOODOO_RENDER_H
|
||||
|
||||
#if !(defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined __amd64__ || defined _M_X64)
|
||||
#if !(defined __amd64__ || defined _M_X64)
|
||||
# define NO_CODEGEN
|
||||
#endif
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ Collection of ROMs for use with 86Box.
|
||||
%autosetup -p1 -a1
|
||||
|
||||
%build
|
||||
%ifarch i386 x86_64
|
||||
%ifarch x86_64
|
||||
%cmake -DRELEASE=on
|
||||
%else
|
||||
%ifarch arm aarch64
|
||||
|
||||
@@ -1038,12 +1038,8 @@ monitor_thread(UNUSED(void *param))
|
||||
# define EMU_GIT_HASH "0000000"
|
||||
# endif
|
||||
|
||||
# if defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
# define ARCH_STR "arm"
|
||||
# elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
# if defined(__aarch64__) || defined(_M_ARM64)
|
||||
# define ARCH_STR "arm64"
|
||||
# elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
# define ARCH_STR "i386"
|
||||
# elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
|
||||
# define ARCH_STR "x86_64"
|
||||
# else
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <86box/random.h>
|
||||
|
||||
#if !(defined(__i386__) || defined(__x86_64__))
|
||||
#if !defined(__x86_64__)
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
|
||||
@@ -655,9 +655,7 @@ voodoo_tmu_fetch_and_blend(voodoo_t *voodoo, voodoo_params_t *params, voodoo_sta
|
||||
state->tex_a[0] ^= 0xff;
|
||||
}
|
||||
|
||||
#if (defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86) && !(defined __amd64__ || defined _M_X64)
|
||||
# include <86box/vid_voodoo_codegen_x86.h>
|
||||
#elif (defined __amd64__ || defined _M_X64)
|
||||
#if (defined __amd64__ || defined _M_X64)
|
||||
# include <86box/vid_voodoo_codegen_x86-64.h>
|
||||
#else
|
||||
int voodoo_recomp = 0;
|
||||
|
||||
Reference in New Issue
Block a user