mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 09:58:19 -07:00
Merge branch 'master' into tandy-shake
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']
|
||||
]
|
||||
|
||||
15
.ci/build.sh
15
.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
|
||||
@@ -600,8 +598,8 @@ then
|
||||
cmake_flags_extra="$cmake_flags_extra -D MOLTENVK=ON -D \"MOLTENVK_INCLUDE_DIR=$macports\""
|
||||
fi
|
||||
|
||||
# Enable Libserialport
|
||||
cmake_flags_extra="$cmake_flags_extra -D \"LIBSERIALPORT_ROOT=$macports\""
|
||||
# Enable libserialport.
|
||||
cmake_flags_extra="$cmake_flags_extra -D \"LIBSERIALPORT_ROOT=$macports\""
|
||||
|
||||
# Install dependencies only if we're in a new build and/or MacPorts prefix.
|
||||
if check_buildtag "$(basename "$macports")"
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@ if(MUNT_EXTERNAL)
|
||||
endif()
|
||||
|
||||
project(86Box
|
||||
VERSION 5.1
|
||||
VERSION 5.2
|
||||
DESCRIPTION "Emulator of x86-based systems"
|
||||
HOMEPAGE_URL "https://86box.net"
|
||||
LANGUAGES C CXX)
|
||||
@@ -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?
|
||||
4
debian/changelog
vendored
4
debian/changelog
vendored
@@ -1,5 +1,5 @@
|
||||
86box (5.1) UNRELEASED; urgency=medium
|
||||
86box (5.2) UNRELEASED; urgency=medium
|
||||
|
||||
* Bump release.
|
||||
|
||||
-- Jasmine Iwanek <jriwanek@gmail.com> Wed, 27 Aug 2025 19:39:16 +0200
|
||||
-- Jasmine Iwanek <jriwanek@gmail.com> Thu, 18 Sep 2025 04:25:57 +0200
|
||||
|
||||
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
|
||||
|
||||
16
debian/rules
vendored
16
debian/rules
vendored
@@ -5,20 +5,12 @@
|
||||
|
||||
ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
|
||||
|
||||
ifeq ($(ARCH), $(filter $(ARCH), amd64 i386))
|
||||
NDR=off
|
||||
ifeq ($(ARCH),amd64)
|
||||
TOOLCHAIN=cmake/flags-gcc-x86_64.cmake
|
||||
else
|
||||
TOOLCHAIN=cmake/flags-gcc-i686.cmake
|
||||
endif
|
||||
ifeq ($(ARCH), $(filter $(ARCH), amd64))
|
||||
NDR=off
|
||||
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
|
||||
|
||||
%:
|
||||
|
||||
13
src/86box.c
13
src/86box.c
@@ -230,6 +230,7 @@ int other_scsi_present = 0; /* SCSI contro
|
||||
int is_pcjr = 0; /* The current machine is PCjr. */
|
||||
int portable_mode = 0; /* We are running in portable mode
|
||||
(global dirs = exe path) */
|
||||
int global_cfg_overridden = 0; /* Global config file was overriden on command line */
|
||||
|
||||
int monitor_edid = 0; /* (C) Which EDID to use. 0=default, 1=custom. */
|
||||
char monitor_edid_path[1024] = { 0 }; /* (C) Path to custom EDID */
|
||||
@@ -852,6 +853,7 @@ usage:
|
||||
if ((c + 1) == argc || plat_dir_check(argv[c + 1]))
|
||||
goto usage;
|
||||
|
||||
global_cfg_overridden = 1;
|
||||
global = argv[++c];
|
||||
} else if (!strcasecmp(argv[c], "--image") || !strcasecmp(argv[c], "-I")) {
|
||||
if ((c + 1) == argc)
|
||||
@@ -1151,11 +1153,13 @@ usage:
|
||||
start_vmm = 1;
|
||||
} else {
|
||||
strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path) - 1);
|
||||
vmm_path[sizeof(vmm_path) - 1] = '\0';
|
||||
}
|
||||
|
||||
if (start_vmm) {
|
||||
pclog("# VM Manager enabled. Path: %s\n", vmm_path);
|
||||
strncpy(usr_path, vmm_path, sizeof(usr_path) - 1);
|
||||
usr_path[sizeof(usr_path) - 1] = '\0';
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -1801,9 +1805,6 @@ pc_close(UNUSED(thread_t *ptr))
|
||||
|
||||
gdbstub_close();
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
mem_free();
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
@@ -1864,6 +1865,12 @@ pc_run(void)
|
||||
|
||||
if (title_update) {
|
||||
mouse_msg_idx = ((mouse_type == MOUSE_TYPE_NONE) || (mouse_input_mode >= 1)) ? 2 : !!mouse_capture;
|
||||
#ifdef SCREENSHOT_MODE
|
||||
if (force_10ms)
|
||||
fps = ((fps + 2) / 5) * 5;
|
||||
else
|
||||
fps = ((fps + 20) / 50) * 50;
|
||||
#endif
|
||||
swprintf(temp, sizeof_w(temp), mouse_msg[mouse_msg_idx], fps / (force_10ms ? 1 : 10), force_10ms ? 0 : (fps % 10));
|
||||
#ifdef __APPLE__
|
||||
/* Needed due to modifying the UI on the non-main thread is a big no-no. */
|
||||
|
||||
@@ -84,6 +84,10 @@ if(DEBUGREGS486)
|
||||
add_compile_definitions(USE_DEBUG_REGS_486)
|
||||
endif()
|
||||
|
||||
if(SCREENSHOT_MODE)
|
||||
add_compile_definitions(SCREENSHOT_MODE)
|
||||
endif()
|
||||
|
||||
if(VNC)
|
||||
find_package(LibVNCServer)
|
||||
if(LibVNCServer_FOUND)
|
||||
@@ -103,21 +107,34 @@ if(INSTRUMENT)
|
||||
add_compile_definitions(USE_INSTRUMENT)
|
||||
endif()
|
||||
|
||||
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom rdisk mo hdd
|
||||
net print scsi sio snd utils vid voodoo plat ui)
|
||||
target_link_libraries(86Box
|
||||
cpu
|
||||
chipset
|
||||
mch
|
||||
dev
|
||||
mem
|
||||
fdd
|
||||
game
|
||||
cdrom
|
||||
rdisk
|
||||
mo
|
||||
hdd
|
||||
net
|
||||
print
|
||||
scsi
|
||||
sio
|
||||
snd
|
||||
utils
|
||||
vid
|
||||
voodoo
|
||||
plat
|
||||
ui
|
||||
)
|
||||
|
||||
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")
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <86box/i2c.h>
|
||||
#include <86box/video.h>
|
||||
#include <86box/smbus.h>
|
||||
#include <86box/hdc.h>
|
||||
#include <86box/hdc_ide.h>
|
||||
#include <86box/hdc_ide_sff8038i.h>
|
||||
#include <86box/sis_55xx.h>
|
||||
@@ -1219,8 +1220,11 @@ acpi_reg_write_intel(int size, uint16_t addr, uint8_t val, void *priv)
|
||||
case 0x36:
|
||||
case 0x37:
|
||||
/* GPOREG - General Purpose Output Register (IO) */
|
||||
if (size == 1)
|
||||
if (size == 1) {
|
||||
dev->regs.gporeg[addr & 3] = val;
|
||||
if ((addr == 0x34) && !strcmp(machine_get_internal_name(), "cubx"))
|
||||
hdc_onboard_enabled = (val & 0x01);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
acpi_reg_write_common_regs(size, addr, val, priv);
|
||||
|
||||
@@ -15,12 +15,8 @@
|
||||
* Copyright 2020-2021 David Hrdlička.
|
||||
*/
|
||||
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM)
|
||||
# error ARCH arm
|
||||
#elif defined(__aarch64__) || defined(_M_ARM64)
|
||||
#if 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
|
||||
|
||||
@@ -714,11 +714,6 @@ compaq_386_init(UNUSED(const device_t *info))
|
||||
mem_mapping_disable(&ram_low_mapping);
|
||||
mem_mapping_disable(&ram_mid_mapping);
|
||||
mem_mapping_disable(&ram_high_mapping);
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
/* Should never be the case, but you never know what a user may set. */
|
||||
if (mem_size > 1048576)
|
||||
mem_mapping_disable(&ram_2gb_mapping);
|
||||
#endif
|
||||
|
||||
/* Initialize in reverse order for memory mapping precedence
|
||||
reasons. */
|
||||
|
||||
@@ -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
11
src/config.c
11
src/config.c
@@ -211,6 +211,8 @@ load_general(void)
|
||||
rctrl_is_lalt = ini_section_get_int(cat, "rctrl_is_lalt", 0);
|
||||
update_icons = ini_section_get_int(cat, "update_icons", 1);
|
||||
|
||||
start_in_fullscreen |= ini_section_get_int(cat, "start_in_fullscreen", 0);
|
||||
|
||||
window_remember = ini_section_get_int(cat, "window_remember", 0);
|
||||
|
||||
if (!window_remember && !(vid_resize & 2))
|
||||
@@ -1032,7 +1034,7 @@ load_storage_controllers(void)
|
||||
if (!hdc_current[j]) {
|
||||
if (!legacy_cards[i]) {
|
||||
if (!p) {
|
||||
hdc_current[j] = hdc_get_from_internal_name("internal");
|
||||
hdc_current[j] = hdc_get_from_internal_name((j == 0) ? "internal" : "none");
|
||||
} else if (!strcmp(p, "xtide_plus")) {
|
||||
hdc_current[j] = hdc_get_from_internal_name("xtide");
|
||||
sprintf(temp, "PC/XT XTIDE #%i", j + 1);
|
||||
@@ -2410,6 +2412,11 @@ save_general(void)
|
||||
else
|
||||
ini_section_delete_var(cat, "window_remember");
|
||||
|
||||
if (video_fullscreen)
|
||||
ini_section_set_int(cat, "start_in_fullscreen", video_fullscreen);
|
||||
else
|
||||
ini_section_delete_var(cat, "start_in_fullscreen");
|
||||
|
||||
if (vid_resize & 2) {
|
||||
sprintf(temp, "%ix%i", fixed_size_x, fixed_size_y);
|
||||
ini_section_set_string(cat, "window_fixed_res", temp);
|
||||
@@ -3056,7 +3063,7 @@ save_storage_controllers(void)
|
||||
else
|
||||
def_hdc = "none";
|
||||
|
||||
if (!strcmp(hdc_get_internal_name(hdc_current[c]), def_hdc))
|
||||
if (!strcmp(hdc_get_internal_name(hdc_current[c]), def_hdc) || ((c > 0) && (hdc_current[c] == 1)))
|
||||
ini_section_delete_var(cat, temp);
|
||||
else
|
||||
ini_section_set_string(cat, temp,
|
||||
|
||||
@@ -357,22 +357,17 @@ fastreadb(uint32_t a)
|
||||
mem_debug_check_addr(a, read_type);
|
||||
read_type = 4;
|
||||
# endif
|
||||
|
||||
if ((a >> 12) == pccache)
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
return *((uint8_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint8_t *) &pccache2[a]);
|
||||
# endif
|
||||
|
||||
t = getpccache(a);
|
||||
if (cpu_state.abrt)
|
||||
return 0;
|
||||
pccache = a >> 12;
|
||||
pccache2 = t;
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
|
||||
return *((uint8_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint8_t *) &pccache2[a]);
|
||||
# endif
|
||||
}
|
||||
|
||||
static __inline uint16_t
|
||||
@@ -392,22 +387,16 @@ fastreadw(uint32_t a)
|
||||
return val;
|
||||
}
|
||||
if ((a >> 12) == pccache)
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
return *((uint16_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint16_t *) &pccache2[a]);
|
||||
# endif
|
||||
|
||||
t = getpccache(a);
|
||||
if (cpu_state.abrt)
|
||||
return 0;
|
||||
|
||||
pccache = a >> 12;
|
||||
pccache2 = t;
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
|
||||
return *((uint16_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint16_t *) &pccache2[a]);
|
||||
# endif
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
@@ -431,11 +420,8 @@ fastreadl(uint32_t a)
|
||||
pccache2 = t;
|
||||
pccache = a >> 12;
|
||||
}
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
|
||||
return *((uint32_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint32_t *) &pccache2[a]);
|
||||
# endif
|
||||
}
|
||||
val = fastreadw(a);
|
||||
val |= (fastreadw(a + 2) << 16);
|
||||
@@ -447,18 +433,10 @@ static __inline void *
|
||||
get_ram_ptr(uint32_t a)
|
||||
{
|
||||
if ((a >> 12) == pccache)
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
return (void *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL));
|
||||
#else
|
||||
return &pccache2[a];
|
||||
#endif
|
||||
else {
|
||||
uint8_t *t = getpccache(a);
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
return (void *) (((uintptr_t) &t[a] & 0x00000000ffffffffULL) | ((uintptr_t) &t[0] & 0xffffffff00000000ULL));
|
||||
#else
|
||||
return &t[a];
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -528,22 +506,16 @@ fastreadw_fetch(uint32_t a)
|
||||
return val;
|
||||
}
|
||||
if ((a >> 12) == pccache)
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
return *((uint16_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint16_t *) &pccache2[a]);
|
||||
# endif
|
||||
t = getpccache(a);
|
||||
if (cpu_state.abrt)
|
||||
return 0;
|
||||
|
||||
pccache = a >> 12;
|
||||
pccache2 = t;
|
||||
# if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
|
||||
return *((uint16_t *) (((uintptr_t) &pccache2[a] & 0x00000000ffffffffULL) | ((uintptr_t) &pccache2[0] & 0xffffffff00000000ULL)));
|
||||
# else
|
||||
return *((uint16_t *) &pccache2[a]);
|
||||
# endif
|
||||
|
||||
}
|
||||
|
||||
static __inline uint32_t
|
||||
|
||||
@@ -1080,6 +1080,9 @@ cpu_set(void)
|
||||
timing_jmp_rm = 12;
|
||||
timing_jmp_pm = 27;
|
||||
timing_jmp_pm_gate = 45;
|
||||
|
||||
if (cpu_s->cpu_type == CPU_386DX)
|
||||
cpu_cache_ext_enabled = 1;
|
||||
break;
|
||||
|
||||
case CPU_486SLC:
|
||||
@@ -1161,6 +1164,8 @@ cpu_set(void)
|
||||
timing_jmp_pm_gate = 37;
|
||||
|
||||
timing_misaligned = 3;
|
||||
|
||||
cpu_cache_ext_enabled = 1;
|
||||
break;
|
||||
|
||||
case CPU_i486SX_SLENH:
|
||||
@@ -4473,13 +4478,6 @@ cpu_update_waitstates(void)
|
||||
if (cpu_cache_int_enabled) {
|
||||
/* Disable prefetch emulation */
|
||||
cpu_prefetch_cycles = 0;
|
||||
} else if (cpu_waitstates && (cpu_s->cpu_type >= CPU_286 && cpu_s->cpu_type <= CPU_386DX)) {
|
||||
/* Waitstates override */
|
||||
cpu_prefetch_cycles = cpu_waitstates + 1;
|
||||
cpu_cycles_read = cpu_waitstates + 1;
|
||||
cpu_cycles_read_l = (cpu_16bitbus ? 2 : 1) * (cpu_waitstates + 1);
|
||||
cpu_cycles_write = cpu_waitstates + 1;
|
||||
cpu_cycles_write_l = (cpu_16bitbus ? 2 : 1) * (cpu_waitstates + 1);
|
||||
} else if (cpu_cache_ext_enabled) {
|
||||
/* Use cache timings */
|
||||
cpu_prefetch_cycles = cpu_s->cache_read_cycles;
|
||||
@@ -4487,6 +4485,13 @@ cpu_update_waitstates(void)
|
||||
cpu_cycles_read_l = (cpu_16bitbus ? 2 : 1) * cpu_s->cache_read_cycles;
|
||||
cpu_cycles_write = cpu_s->cache_write_cycles;
|
||||
cpu_cycles_write_l = (cpu_16bitbus ? 2 : 1) * cpu_s->cache_write_cycles;
|
||||
} else if (cpu_waitstates && (cpu_s->cpu_type >= CPU_286 && cpu_s->cpu_type <= CPU_386DX)) {
|
||||
/* Waitstates override */
|
||||
cpu_prefetch_cycles = cpu_waitstates + 1;
|
||||
cpu_cycles_read = cpu_waitstates + 1;
|
||||
cpu_cycles_read_l = (cpu_16bitbus ? 2 : 1) * (cpu_waitstates + 1);
|
||||
cpu_cycles_write = cpu_waitstates + 1;
|
||||
cpu_cycles_write_l = (cpu_16bitbus ? 2 : 1) * (cpu_waitstates + 1);
|
||||
} else {
|
||||
/* Use memory timings */
|
||||
cpu_prefetch_cycles = cpu_s->mem_read_cycles;
|
||||
|
||||
@@ -388,11 +388,7 @@ 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
|
||||
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
|
||||
|
||||
@@ -1367,8 +1367,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 3,
|
||||
.mem_write_cycles = 3,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 2
|
||||
},
|
||||
{
|
||||
@@ -1384,8 +1384,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{
|
||||
@@ -1401,8 +1401,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{
|
||||
@@ -1418,8 +1418,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 6,
|
||||
.mem_write_cycles = 6,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 4
|
||||
},
|
||||
{
|
||||
@@ -1435,8 +1435,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 7,
|
||||
.mem_write_cycles = 7,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 5
|
||||
},
|
||||
{ .name = "", 0 }
|
||||
@@ -1461,8 +1461,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 3,
|
||||
.mem_write_cycles = 3,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 2
|
||||
},
|
||||
{
|
||||
@@ -1478,8 +1478,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{
|
||||
@@ -1495,8 +1495,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{ .name = "", 0 }
|
||||
@@ -1521,8 +1521,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = CPU_SUPPORTS_DYNAREC,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{
|
||||
@@ -1538,8 +1538,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = CPU_SUPPORTS_DYNAREC,
|
||||
.mem_read_cycles = 6,
|
||||
.mem_write_cycles = 6,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 4
|
||||
},
|
||||
{
|
||||
@@ -1555,8 +1555,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = CPU_SUPPORTS_DYNAREC,
|
||||
.mem_read_cycles = 7,
|
||||
.mem_write_cycles = 7,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 5
|
||||
},
|
||||
{ .name = "", 0 }
|
||||
@@ -1581,8 +1581,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 3
|
||||
},
|
||||
{
|
||||
@@ -1598,8 +1598,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 6,
|
||||
.mem_write_cycles = 6,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 4
|
||||
},
|
||||
{
|
||||
@@ -1615,8 +1615,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 7,
|
||||
.mem_write_cycles = 7,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 5
|
||||
},
|
||||
{ .name = "", 0 }
|
||||
@@ -2096,7 +2096,7 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 4,
|
||||
.mem_write_cycles = 4,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 3,
|
||||
.atclk_div = 3
|
||||
},
|
||||
@@ -2113,8 +2113,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 6,
|
||||
.mem_write_cycles = 6,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 4
|
||||
},
|
||||
{
|
||||
@@ -2130,8 +2130,8 @@ const cpu_family_t cpu_families[] = {
|
||||
.cpu_flags = 0,
|
||||
.mem_read_cycles = 7,
|
||||
.mem_write_cycles = 7,
|
||||
.cache_read_cycles = 3,
|
||||
.cache_write_cycles = 3,
|
||||
.cache_read_cycles = 2,
|
||||
.cache_write_cycles = 2,
|
||||
.atclk_div = 5
|
||||
},
|
||||
{ .name = "", 0 }
|
||||
|
||||
@@ -22,16 +22,12 @@
|
||||
*/
|
||||
#include <math.h>
|
||||
#include <fenv.h>
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86
|
||||
|
||||
#if defined _M_X64 || defined __amd64__
|
||||
# define X87_INLINE_ASM
|
||||
# endif
|
||||
#else
|
||||
# if defined i386 || defined __i386 || defined __i386__ || defined _X86_ || defined _M_IX86 || defined _M_X64 || defined __amd64__
|
||||
# define X87_INLINE_ASM
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef X87_INLINE_ASM
|
||||
#include <immintrin.h>
|
||||
#endif
|
||||
|
||||
@@ -92,8 +92,8 @@ cart_image_close(int drive)
|
||||
static void
|
||||
cart_image_load(int drive, char *fn)
|
||||
{
|
||||
FILE *fp;
|
||||
uint32_t size;
|
||||
FILE *fp = NULL;
|
||||
uint32_t size = 0;
|
||||
uint32_t base = 0x00000000;
|
||||
|
||||
cart_image_close(drive);
|
||||
@@ -137,7 +137,7 @@ cart_image_load(int drive, char *fn)
|
||||
static void
|
||||
cart_load_common(int drive, char *fn, uint8_t hard_reset)
|
||||
{
|
||||
FILE *fp;
|
||||
FILE *fp = NULL;
|
||||
|
||||
cartridge_log("Cartridge: loading drive %d with '%s'\n", drive, fn);
|
||||
|
||||
|
||||
@@ -975,7 +975,7 @@ write_cmd_data_ami(void *priv, uint8_t val)
|
||||
return 0;
|
||||
|
||||
case 0xc1:
|
||||
kbc_at_log("ATkbc: AMI MegaKey - write %02X to P1\n", val);
|
||||
kbc_at_log("ATkbc: AMI - write %02X to P1\n", val);
|
||||
dev->p1 = val;
|
||||
return 0;
|
||||
|
||||
@@ -1160,11 +1160,14 @@ write_cmd_ami(void *priv, uint8_t val)
|
||||
|
||||
case 0xaf: /* set extended controller RAM */
|
||||
if ((kbc_ven != KBC_VEN_SIEMENS) && (kbc_ven != KBC_VEN_ALI)) {
|
||||
kbc_at_log("ATkbc: set extended controller RAM\n");
|
||||
dev->wantdata = 1;
|
||||
dev->state = STATE_KBC_PARAM;
|
||||
dev->command_phase = 1;
|
||||
ret = 0;
|
||||
if (((kbc_ami_revision >= 'H') && (kbc_ami_revision < 'X')) ||
|
||||
(kbc_ami_revision = '5')) {
|
||||
kbc_at_log("ATkbc: set extended controller RAM\n");
|
||||
dev->wantdata = 1;
|
||||
dev->state = STATE_KBC_PARAM;
|
||||
dev->command_phase = 1;
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1214,27 +1217,33 @@ write_cmd_ami(void *priv, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0xc1: /* write P1 */
|
||||
kbc_at_log("ATkbc: AMI MegaKey - write P1\n");
|
||||
kbc_at_log("ATkbc: AMI - write P1\n");
|
||||
dev->wantdata = 1;
|
||||
dev->state = STATE_KBC_PARAM;
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
case 0xc4:
|
||||
/* set KBC line P14 low */
|
||||
kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) low\n");
|
||||
dev->p1 &= 0xef;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) ||
|
||||
(kbc_ami_revision = '5')) {
|
||||
/* set KBC line P14 low */
|
||||
kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) low\n");
|
||||
dev->p1 &= 0xef;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 0xc5:
|
||||
/* set KBC line P15 low */
|
||||
kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) low\n");
|
||||
dev->p1 &= 0xdf;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) ||
|
||||
(kbc_ami_revision = '5')) {
|
||||
/* set KBC line P15 low */
|
||||
kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) low\n");
|
||||
dev->p1 &= 0xdf;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xc8:
|
||||
@@ -1271,20 +1280,26 @@ write_cmd_ami(void *priv, uint8_t val)
|
||||
break;
|
||||
|
||||
case 0xcc:
|
||||
/* set KBC line P14 high */
|
||||
kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) high\n");
|
||||
dev->p1 |= 0x10;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) ||
|
||||
(kbc_ami_revision = '5')) {
|
||||
/* set KBC line P14 high */
|
||||
kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) high\n");
|
||||
dev->p1 |= 0x10;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
case 0xcd:
|
||||
/* set KBC line P15 high */
|
||||
kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) high\n");
|
||||
dev->p1 |= 0x20;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) ||
|
||||
(kbc_ami_revision = '5')) {
|
||||
kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) high\n");
|
||||
dev->p1 |= 0x20;
|
||||
kbc_delay_to_ob(dev, dev->ob, 0, 0x00);
|
||||
dev->pending++;
|
||||
ret = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xef: /* ??? - sent by AMI486 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
int hdc_current[HDC_MAX] = { 0, 0 };
|
||||
|
||||
int hdc_onboard_enabled = 1;
|
||||
|
||||
#ifdef ENABLE_HDC_LOG
|
||||
int hdc_do_log = ENABLE_HDC_LOG;
|
||||
|
||||
@@ -114,6 +116,8 @@ hdc_init(void)
|
||||
void
|
||||
hdc_reset(void)
|
||||
{
|
||||
hdc_onboard_enabled = 1;
|
||||
|
||||
for (int i = 0; i < HDC_MAX; i++) {
|
||||
hdc_log("HDC %i: reset(current=%d, internal=%d)\n", i,
|
||||
hdc_current[i], hdc_current[i] == HDC_INTERNAL);
|
||||
|
||||
@@ -812,7 +812,7 @@ ide_set_signature(ide_t *ide)
|
||||
ide->tf->sector = 1;
|
||||
ide->tf->head = 0;
|
||||
ide->tf->secount = 1;
|
||||
ide->tf->cylinder = ide_signatures[ide->type & ~IDE_SHADOW];
|
||||
ide->tf->cylinder = (ide->type == IDE_ATAPI_SHADOW) ? 0x0000 : ide_signatures[ide->type & ~IDE_SHADOW];
|
||||
|
||||
if (ide->type == IDE_HDD)
|
||||
ide->drive = 0;
|
||||
@@ -1581,7 +1581,7 @@ ide_reset_registers(ide_t *ide)
|
||||
ide->tf->atastat = DRDY_STAT | DSC_STAT;
|
||||
ide->tf->error = 1;
|
||||
ide->tf->secount = 1;
|
||||
ide->tf->cylinder = ide_signatures[ide->type & ~IDE_SHADOW];
|
||||
ide->tf->cylinder = (ide->type == IDE_ATAPI_SHADOW) ? 0x0000 : ide_signatures[ide->type & ~IDE_SHADOW];
|
||||
ide->tf->sector = 1;
|
||||
ide->tf->head = 0;
|
||||
|
||||
|
||||
@@ -145,6 +145,7 @@ cmd646_ide_handlers(cmd646_t *dev)
|
||||
int first = 0;
|
||||
int reg09 = dev->regs[0x09];
|
||||
int reg50 = dev->regs[0x50];
|
||||
int dev_enabled = (hdc_onboard_enabled || !(dev->local & CMD64X_ONBOARD));
|
||||
|
||||
if ((dev->local & CMD_TYPE_648) && (dev->local & CMD648_RAID)) {
|
||||
reg09 = 0xff;
|
||||
@@ -180,7 +181,7 @@ cmd646_ide_handlers(cmd646_t *dev)
|
||||
if (dev->local & CMD_TYPE_648)
|
||||
pri_enabled = pri_enabled && (dev->regs[0x51] & 0x04);
|
||||
|
||||
if (pri_enabled)
|
||||
if (dev_enabled && pri_enabled)
|
||||
ide_handlers(first, 1);
|
||||
|
||||
if (dev->single_channel)
|
||||
@@ -205,7 +206,7 @@ cmd646_ide_handlers(cmd646_t *dev)
|
||||
sff_set_irq_mode(dev->bm[1], irq_mode[1]);
|
||||
cmd646_log("IDE %i: %04X, %04X, %i\n", first + 1, main, side, irq_mode[1]);
|
||||
|
||||
if ((dev->regs[0x04] & 0x01) && (dev->regs[0x51] & 0x08))
|
||||
if (dev_enabled && (dev->regs[0x04] & 0x01) && (dev->regs[0x51] & 0x08))
|
||||
ide_handlers(first + 1, 1);
|
||||
}
|
||||
|
||||
@@ -213,9 +214,10 @@ static void
|
||||
cmd646_ide_bm_handlers(cmd646_t *dev)
|
||||
{
|
||||
uint16_t base = (dev->regs[0x20] & 0xf0) | (dev->regs[0x21] << 8);
|
||||
int dev_enabled = (hdc_onboard_enabled || !(dev->local & CMD64X_ONBOARD));
|
||||
|
||||
sff_bus_master_handler(dev->bm[0], (dev->regs[0x04] & 1), base);
|
||||
sff_bus_master_handler(dev->bm[1], (dev->regs[0x04] & 1), base + 8);
|
||||
sff_bus_master_handler(dev->bm[0], dev_enabled && (dev->regs[0x04] & 1), base);
|
||||
sff_bus_master_handler(dev->bm[1], dev_enabled && (dev->regs[0x04] & 1), base + 8);
|
||||
}
|
||||
|
||||
uint8_t
|
||||
@@ -296,15 +298,16 @@ cmd646_bios_handler(cmd646_t *dev)
|
||||
static void
|
||||
cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
{
|
||||
cmd646_t *dev = (cmd646_t *) priv;
|
||||
int reg50 = dev->regs[0x50];
|
||||
cmd646_t *dev = (cmd646_t *) priv;
|
||||
int reg50 = dev->regs[0x50];
|
||||
int dev_enabled = (hdc_onboard_enabled || !(dev->local & CMD64X_ONBOARD));
|
||||
|
||||
if ((dev->local & CMD_TYPE_648) && (dev->regs[0x0a] == 0x04) && (dev->regs[0x0b] == 0x01))
|
||||
reg50 |= 0x40;
|
||||
|
||||
cmd646_log("[%04X:%08X] (%08X) cmd646_pci_write(%i, %02X, %02X)\n", CS, cpu_state.pc, ESI, func, addr, val);
|
||||
|
||||
if (func == 0x00)
|
||||
if (dev_enabled && (func == 0x00))
|
||||
switch (addr) {
|
||||
case 0x04:
|
||||
if (dev->has_bios)
|
||||
@@ -480,10 +483,11 @@ cmd646_pci_write(int func, int addr, uint8_t val, void *priv)
|
||||
static uint8_t
|
||||
cmd646_pci_read(int func, int addr, void *priv)
|
||||
{
|
||||
cmd646_t *dev = (cmd646_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
cmd646_t *dev = (cmd646_t *) priv;
|
||||
uint8_t ret = 0xff;
|
||||
int dev_enabled = (hdc_onboard_enabled || !(dev->local & CMD64X_ONBOARD));
|
||||
|
||||
if (func == 0x00) {
|
||||
if (dev_enabled && (func == 0x00)) {
|
||||
ret = dev->regs[addr];
|
||||
|
||||
if ((addr == 0x09) && (dev->local & CMD_TYPE_648) && (dev->regs[0x0a] == 0x04))
|
||||
|
||||
@@ -664,8 +664,17 @@ static void
|
||||
mo_buf_alloc(mo_t *dev, uint32_t len)
|
||||
{
|
||||
mo_log(dev->log, "Allocated buffer length: %i\n", len);
|
||||
if (dev->buffer == NULL)
|
||||
|
||||
if (dev->buffer == NULL) {
|
||||
dev->buffer = (uint8_t *) malloc(len);
|
||||
dev->buffer_sz = len;
|
||||
}
|
||||
|
||||
if (len > dev->buffer_sz) {
|
||||
uint8_t *buf = (uint8_t *) realloc(dev->buffer, len);
|
||||
dev->buffer = buf;
|
||||
dev->buffer_sz = len;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -747,8 +747,17 @@ static void
|
||||
rdisk_buf_alloc(rdisk_t *dev, const uint32_t len)
|
||||
{
|
||||
rdisk_log(dev->log, "Allocated buffer length: %i\n", len);
|
||||
if (dev->buffer == NULL)
|
||||
|
||||
if (dev->buffer == NULL) {
|
||||
dev->buffer = (uint8_t *) malloc(len);
|
||||
dev->buffer_sz = len;
|
||||
}
|
||||
|
||||
if (len > dev->buffer_sz) {
|
||||
uint8_t *buf = (uint8_t *) realloc(dev->buffer, len);
|
||||
dev->buffer = buf;
|
||||
dev->buffer_sz = len;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -105,39 +105,39 @@ static const struct
|
||||
void (*close)(int drive);
|
||||
int size;
|
||||
} loaders[] = {
|
||||
{ "001", img_load, img_close, -1},
|
||||
{ "002", img_load, img_close, -1},
|
||||
{ "003", img_load, img_close, -1},
|
||||
{ "004", img_load, img_close, -1},
|
||||
{ "005", img_load, img_close, -1},
|
||||
{ "006", img_load, img_close, -1},
|
||||
{ "007", img_load, img_close, -1},
|
||||
{ "008", img_load, img_close, -1},
|
||||
{ "009", img_load, img_close, -1},
|
||||
{ "010", img_load, img_close, -1},
|
||||
{ "12", img_load, img_close, -1},
|
||||
{ "144", img_load, img_close, -1},
|
||||
{ "360", img_load, img_close, -1},
|
||||
{ "720", img_load, img_close, -1},
|
||||
{ "86F", d86f_load, d86f_close, -1},
|
||||
{ "BIN", img_load, img_close, -1},
|
||||
{ "CQ", img_load, img_close, -1},
|
||||
{ "CQM", img_load, img_close, -1},
|
||||
{ "DDI", img_load, img_close, -1},
|
||||
{ "DSK", img_load, img_close, -1},
|
||||
{ "FDI", fdi_load, fdi_close, -1},
|
||||
{ "FDF", img_load, img_close, -1},
|
||||
{ "FLP", img_load, img_close, -1},
|
||||
{ "HDM", img_load, img_close, -1},
|
||||
{ "IMA", img_load, img_close, -1},
|
||||
{ "IMD", imd_load, imd_close, -1},
|
||||
{ "IMG", img_load, img_close, -1},
|
||||
{ "JSON", pcjs_load, pcjs_close, -1},
|
||||
{ "MFM", mfm_load, mfm_close, -1},
|
||||
{ "TD0", td0_load, td0_close, -1},
|
||||
{ "VFD", img_load, img_close, -1},
|
||||
{ "XDF", img_load, img_close, -1},
|
||||
{ 0, 0, 0, 0 }
|
||||
{ "001", img_load, img_close, -1 },
|
||||
{ "002", img_load, img_close, -1 },
|
||||
{ "003", img_load, img_close, -1 },
|
||||
{ "004", img_load, img_close, -1 },
|
||||
{ "005", img_load, img_close, -1 },
|
||||
{ "006", img_load, img_close, -1 },
|
||||
{ "007", img_load, img_close, -1 },
|
||||
{ "008", img_load, img_close, -1 },
|
||||
{ "009", img_load, img_close, -1 },
|
||||
{ "010", img_load, img_close, -1 },
|
||||
{ "12", img_load, img_close, -1 },
|
||||
{ "144", img_load, img_close, -1 },
|
||||
{ "360", img_load, img_close, -1 },
|
||||
{ "720", img_load, img_close, -1 },
|
||||
{ "86F", d86f_load, d86f_close, -1 },
|
||||
{ "BIN", img_load, img_close, -1 },
|
||||
{ "CQ", img_load, img_close, -1 },
|
||||
{ "CQM", img_load, img_close, -1 },
|
||||
{ "DDI", img_load, img_close, -1 },
|
||||
{ "DSK", img_load, img_close, -1 },
|
||||
{ "FDI", fdi_load, fdi_close, -1 },
|
||||
{ "FDF", img_load, img_close, -1 },
|
||||
{ "FLP", img_load, img_close, -1 },
|
||||
{ "HDM", img_load, img_close, -1 },
|
||||
{ "IMA", img_load, img_close, -1 },
|
||||
{ "IMD", imd_load, imd_close, -1 },
|
||||
{ "IMG", img_load, img_close, -1 },
|
||||
{ "JSON", pcjs_load, pcjs_close, -1 },
|
||||
{ "MFM", mfm_load, mfm_close, -1 },
|
||||
{ "TD0", td0_load, td0_close, -1 },
|
||||
{ "VFD", img_load, img_close, -1 },
|
||||
{ "XDF", img_load, img_close, -1 },
|
||||
{ 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
static const struct {
|
||||
@@ -211,7 +211,7 @@ fdd_get_internal_name(int type)
|
||||
int
|
||||
fdd_get_from_internal_name(char *s)
|
||||
{
|
||||
int c = 0;
|
||||
int c = 0;
|
||||
|
||||
while (strlen(drive_types[c].internal_name)) {
|
||||
if (!strcmp((char *) drive_types[c].internal_name, s))
|
||||
@@ -466,7 +466,7 @@ fdd_load(int drive, char *fn)
|
||||
if (!fn)
|
||||
return;
|
||||
if (strstr(fn, "wp://") == fn) {
|
||||
offs = 5;
|
||||
offs = 5;
|
||||
ui_writeprot[drive] = 1;
|
||||
}
|
||||
fn += offs;
|
||||
|
||||
@@ -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
|
||||
|
||||
/*
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
#if USE_REP_MOVSB /* small win on amd, big loss on intel */
|
||||
#if (__i386 || __amd64) && __GNUC__ >= 3
|
||||
#if (__amd64) && __GNUC__ >= 3
|
||||
# define lzf_movsb(dst, src, len) \
|
||||
asm ("rep movsb" \
|
||||
: "=D" (dst), "=S" (src), "=c" (len) \
|
||||
|
||||
@@ -202,6 +202,7 @@ extern char vmm_path[1024]; /* VM Manager path to scan */
|
||||
extern int start_vmm; /* the current execution will start the manager */
|
||||
extern int portable_mode; /* we are running in portable mode
|
||||
(global dirs = exe path) */
|
||||
extern int global_cfg_overridden; /* global config file was overriden on command line */
|
||||
|
||||
extern int monitor_edid; /* (C) Which EDID to use. 0=default, 1=custom. */
|
||||
extern char monitor_edid_path[1024]; /* (C) Path to custom EDID */
|
||||
|
||||
@@ -163,7 +163,7 @@ CPU_CONVERT(le, 64, uint64_t)
|
||||
|
||||
/* unaligned versions (optimized for frequent unaligned accesses)*/
|
||||
|
||||
#if defined(__i386__) || defined(__powerpc__)
|
||||
#if defined(__powerpc__)
|
||||
# define cpu_to_le16wu(p, v) cpu_to_le16w(p, v)
|
||||
# define cpu_to_le32wu(p, v) cpu_to_le32w(p, v)
|
||||
# define le16_to_cpupu(p) le16_to_cpup(p)
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define HDC_MAX 4
|
||||
|
||||
extern int hdc_current[HDC_MAX];
|
||||
extern int hdc_onboard_enabled;
|
||||
|
||||
extern const device_t st506_xt_xebec_device; /* st506_xt_xebec */
|
||||
extern const device_t st506_xt_wdxt_gen_device; /* st506_xt_wdxt_gen */
|
||||
|
||||
@@ -174,11 +174,7 @@
|
||||
#define CPU_BLOCK_NONE 0
|
||||
|
||||
/* Make sure it's always an invalid value to avoid misdetections. */
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
# define MACHINE_AVAILABLE 0xffffffffffffffffULL
|
||||
#else
|
||||
# define MACHINE_AVAILABLE 0xffffffff
|
||||
#endif
|
||||
#define MACHINE_AVAILABLE 0xffffffffffffffffULL
|
||||
|
||||
enum {
|
||||
MACHINE_TYPE_NONE = 0,
|
||||
@@ -498,6 +494,7 @@ extern int machine_at_cmdpc_init(const machine_t *);
|
||||
extern int machine_at_portableii_init(const machine_t *);
|
||||
extern int machine_at_portableiii_init(const machine_t *);
|
||||
extern int machine_at_grid1520_init(const machine_t *);
|
||||
extern int machine_at_pc900_init(const machine_t *);
|
||||
extern int machine_at_mr286_init(const machine_t *);
|
||||
extern int machine_at_pc8_init(const machine_t *);
|
||||
extern int machine_at_m290_init(const machine_t *);
|
||||
@@ -515,19 +512,19 @@ extern int machine_at_dells200_init(const machine_t *);
|
||||
extern int machine_at_super286c_init(const machine_t *);
|
||||
extern int machine_at_at122_init(const machine_t *);
|
||||
extern int machine_at_tuliptc7_init(const machine_t *);
|
||||
/* Wells American A*Star with custom award BIOS. */
|
||||
extern int machine_at_wellamerastar_init(const machine_t *);
|
||||
|
||||
/* GC103 */
|
||||
extern int machine_at_quadt286_init(const machine_t *);
|
||||
extern void machine_at_headland_common_init(const machine_t *model, int type);
|
||||
extern int machine_at_tg286m_init(const machine_t *);
|
||||
/* Wells American A*Star with custom award BIOS. */
|
||||
extern int machine_at_wellamerastar_init(const machine_t *);
|
||||
|
||||
/* NEAT */
|
||||
extern int machine_at_px286_init(const machine_t *);
|
||||
extern int machine_at_ataripc4_init(const machine_t *);
|
||||
extern int machine_at_neat_ami_init(const machine_t *);
|
||||
extern int machine_at_3302_init(const machine_t *);
|
||||
extern int machine_at_px286_init(const machine_t *);
|
||||
|
||||
/* SCAMP */
|
||||
extern int machine_at_pc7286_init(const machine_t *);
|
||||
@@ -557,8 +554,8 @@ extern const device_t pbl300sx_device;
|
||||
extern int machine_at_pbl300sx_init(const machine_t *);
|
||||
|
||||
/* ALi M1217 */
|
||||
extern int machine_at_arb1374_init(const machine_t *);
|
||||
extern int machine_at_sbc350a_init(const machine_t *);
|
||||
extern int machine_at_arb1374_init(const machine_t *);
|
||||
extern int machine_at_flytech386_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t c325ax_device;
|
||||
@@ -608,6 +605,10 @@ extern int machine_at_wd76c10_init(const machine_t *);
|
||||
extern int machine_at_pja511m_init(const machine_t *);
|
||||
extern int machine_at_prox1332_init(const machine_t *);
|
||||
|
||||
/* m_at_486slc.c */
|
||||
/* OPTi 283 */
|
||||
extern int machine_at_rycleopardlx_init(const machine_t *);
|
||||
|
||||
/* m_at_386dx.c */
|
||||
/* ISA */
|
||||
#ifdef EMU_DEVICE_H
|
||||
@@ -639,10 +640,6 @@ extern int machine_at_opti495_init(const machine_t *);
|
||||
extern int machine_at_asus3863364k_init(const machine_t *);
|
||||
extern int machine_at_asus386_init(const machine_t *);
|
||||
|
||||
/* m_at_486slc.c */
|
||||
/* OPTi 283 */
|
||||
extern int machine_at_rycleopardlx_init(const machine_t *);
|
||||
|
||||
/* m_at_386dx_486.c */
|
||||
/* ALi M1429G */
|
||||
extern int machine_at_exp4349_init(const machine_t *);
|
||||
@@ -995,6 +992,9 @@ extern int machine_at_cu430hx_init(const machine_t *);
|
||||
extern const device_t tc430hx_device;
|
||||
#endif
|
||||
extern int machine_at_tc430hx_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t m7shi_device;
|
||||
#endif
|
||||
extern int machine_at_m7shi_init(const machine_t *);
|
||||
extern int machine_at_epc2102_init(const machine_t *);
|
||||
extern int machine_at_pcv90_init(const machine_t *);
|
||||
@@ -1127,12 +1127,18 @@ extern int machine_at_p6i440e2_init(const machine_t *);
|
||||
|
||||
/* i440BX */
|
||||
extern int machine_at_bf6_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t bx6_device;
|
||||
#endif
|
||||
extern int machine_at_bx6_init(const machine_t *);
|
||||
extern int machine_at_ax6bc_init(const machine_t *);
|
||||
extern int machine_at_p2bls_init(const machine_t *);
|
||||
extern int machine_at_p3bf_init(const machine_t *);
|
||||
extern int machine_at_686bx_init(const machine_t *);
|
||||
extern int machine_at_lgibmx7g_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t ms6119_device;
|
||||
#endif
|
||||
extern int machine_at_ms6119_init(const machine_t *);
|
||||
extern int machine_at_p6sba_init(const machine_t *);
|
||||
extern int machine_at_s1846_init(const machine_t *);
|
||||
|
||||
@@ -1319,7 +1325,11 @@ extern const device_t jukopc_device;
|
||||
extern int machine_xt_jukopc_init(const machine_t *);
|
||||
extern int machine_xt_kaypropc_init(const machine_t *);
|
||||
extern int machine_xt_micoms_xl7turbo_init(const machine_t *);
|
||||
#ifdef EMU_DEVICE_H
|
||||
extern const device_t pc500_device;
|
||||
#endif
|
||||
extern int machine_xt_pc500_init(const machine_t *);
|
||||
extern int machine_xt_pc500plus_init(const machine_t *);
|
||||
extern int machine_xt_pc700_init(const machine_t *);
|
||||
extern int machine_xt_pc4i_init(const machine_t *);
|
||||
extern int machine_xt_openxt_init(const machine_t *);
|
||||
|
||||
@@ -265,24 +265,17 @@ extern uint32_t biosmask;
|
||||
extern uint32_t biosaddr;
|
||||
|
||||
extern int readlookup[256];
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
extern uintptr_t *readlookup2;
|
||||
#endif
|
||||
extern uintptr_t old_rl2;
|
||||
extern uint8_t uncached;
|
||||
extern int readlnext;
|
||||
extern int writelookup[256];
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
extern uintptr_t *writelookup2;
|
||||
#endif
|
||||
|
||||
extern int writelnext;
|
||||
extern uint32_t ram_mapped_addr[64];
|
||||
extern uint8_t page_ff[4096];
|
||||
|
||||
extern mem_mapping_t ram_low_mapping;
|
||||
#if 1
|
||||
extern mem_mapping_t ram_mid_mapping;
|
||||
#endif
|
||||
extern mem_mapping_t ram_remapped_mapping;
|
||||
extern mem_mapping_t ram_high_mapping;
|
||||
extern mem_mapping_t ram_2gb_mapping;
|
||||
@@ -292,16 +285,11 @@ extern mem_mapping_t bios_high_mapping;
|
||||
extern uint32_t mem_logical_addr;
|
||||
|
||||
extern page_t *pages;
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
extern page_t **page_lookup;
|
||||
#endif
|
||||
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
/* The lookup tables. */
|
||||
extern page_t *page_lookup[1048576];
|
||||
extern uintptr_t readlookup2[1048576];
|
||||
extern uintptr_t writelookup2[1048576];
|
||||
#endif
|
||||
|
||||
extern uint32_t get_phys_virt;
|
||||
extern uint32_t get_phys_phys;
|
||||
@@ -470,9 +458,6 @@ extern void mem_a20_init(void);
|
||||
extern void mem_a20_recalc(void);
|
||||
|
||||
extern void mem_init(void);
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
extern void mem_free(void);
|
||||
#endif
|
||||
extern void mem_close(void);
|
||||
extern void mem_zero(void);
|
||||
extern void mem_reset(void);
|
||||
|
||||
@@ -140,6 +140,7 @@ typedef struct mo_t {
|
||||
void * log;
|
||||
|
||||
uint8_t *buffer;
|
||||
size_t buffer_sz;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
@@ -105,6 +105,7 @@ typedef struct netcard_conf_t {
|
||||
|
||||
extern netcard_conf_t net_cards_conf[NET_CARD_MAX];
|
||||
extern uint16_t net_card_current;
|
||||
extern int slirp_card_num;
|
||||
|
||||
typedef int (*NETRXCB)(void *, uint8_t *, int);
|
||||
typedef int (*NETSETLINKSTATE)(void *, uint32_t link_state);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
extern char *path_get_basename(const char *path);
|
||||
extern void path_get_dirname(char *dest, const char *path);
|
||||
extern char *path_get_filename(char *s);
|
||||
extern char *path_get_extension(char *s);
|
||||
@@ -5,4 +6,4 @@ extern void path_append_filename(char *dest, const char *s1, const char *s2);
|
||||
extern void path_slash(char *path);
|
||||
extern const char *path_get_slash(char *path);
|
||||
extern void path_normalize(char *path);
|
||||
extern int path_abs(char *path);
|
||||
extern int path_abs(char *path);
|
||||
|
||||
@@ -117,6 +117,7 @@ typedef struct rdisk_t {
|
||||
void *log;
|
||||
|
||||
uint8_t *buffer;
|
||||
size_t buffer_sz;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
@@ -36,6 +36,7 @@ typedef struct scsi_cdrom_t {
|
||||
void * log;
|
||||
|
||||
uint8_t * buffer;
|
||||
size_t buffer_sz;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
@@ -388,6 +388,7 @@ typedef struct scsi_common_s {
|
||||
void * log;
|
||||
|
||||
uint8_t * temp_buffer;
|
||||
size_t temp_buffer_sz;
|
||||
/*
|
||||
This is atapi_cdb in ATAPI-supporting devices,
|
||||
and pad in SCSI-only devices.
|
||||
|
||||
@@ -29,6 +29,7 @@ typedef struct scsi_disk_t {
|
||||
void * log;
|
||||
|
||||
uint8_t * temp_buffer;
|
||||
size_t temp_buffer_sz;
|
||||
uint8_t atapi_cdb[16];
|
||||
uint8_t current_cdb[16];
|
||||
uint8_t sense[256];
|
||||
|
||||
@@ -32,6 +32,14 @@ enum {
|
||||
AD1848_TYPE_CS4235 = 6
|
||||
};
|
||||
|
||||
enum {
|
||||
AD1848_AUX1 = 2,
|
||||
AD1848_AUX2 = 4,
|
||||
AD1848_OUT = 6,
|
||||
AD1848_LINE_IN = 18,
|
||||
AD1848_MONO = 26
|
||||
};
|
||||
|
||||
typedef struct ad1848_t {
|
||||
uint8_t type;
|
||||
uint8_t index;
|
||||
@@ -47,6 +55,7 @@ typedef struct ad1848_t {
|
||||
|
||||
int16_t out_l;
|
||||
int16_t out_r;
|
||||
int8_t cd_vol_reg;
|
||||
double cd_vol_l;
|
||||
double cd_vol_r;
|
||||
int fm_vol_l;
|
||||
@@ -69,6 +78,8 @@ typedef struct ad1848_t {
|
||||
pc_timer_t timer_count;
|
||||
uint64_t timer_latch;
|
||||
|
||||
pc_timer_t cs4231a_irq_timer;
|
||||
|
||||
int16_t buffer[SOUNDBUFLEN * 2];
|
||||
int pos;
|
||||
|
||||
@@ -86,8 +97,9 @@ extern void ad1848_write(uint16_t addr, uint8_t val, void *priv);
|
||||
|
||||
extern void ad1848_update(ad1848_t *ad1848);
|
||||
extern void ad1848_speed_changed(ad1848_t *ad1848);
|
||||
extern void ad1848_set_cd_audio_channel(void *priv, int channel);
|
||||
extern void ad1848_filter_cd_audio(int channel, double *buffer, void *priv);
|
||||
extern void ad1848_filter_aux2(void* priv, double* out_l, double* out_r);
|
||||
extern void ad1848_filter_channel(void* priv, int channel, double* out_l, double* out_r);
|
||||
|
||||
extern void ad1848_init(ad1848_t *ad1848, uint8_t type);
|
||||
|
||||
|
||||
@@ -199,8 +199,8 @@ typedef struct emu8k_voice_t {
|
||||
* something, similarly to targets and current, but... of what?
|
||||
* what is curious is that if they are already zero, they are not written to, so it really
|
||||
* looks like they are information about the status of the channel. (lfo position maybe?) */
|
||||
uint32_t unknown_data0_4;
|
||||
uint32_t unknown_data0_5;
|
||||
uint32_t z2;
|
||||
uint32_t z1;
|
||||
union {
|
||||
uint32_t psst;
|
||||
struct {
|
||||
@@ -229,7 +229,7 @@ typedef struct emu8k_voice_t {
|
||||
};
|
||||
#define CCCA_FILTQ_GET(ccca) (ccca >> 28)
|
||||
#define CCCA_FILTQ_SET(ccca, q) ccca = (ccca & 0x0FFFFFFF) | (q << 28)
|
||||
/* Bit 27 should always be zero */
|
||||
/* Bit 27 should always be zero on EMU8000 */
|
||||
#define CCCA_DMA_ACTIVE(ccca) (ccca & 0x04000000)
|
||||
#define CCCA_DMA_WRITE_MODE(ccca) (ccca & 0x02000000)
|
||||
#define CCCA_DMA_WRITE_RIGHT(ccca) (ccca & 0x01000000)
|
||||
@@ -316,7 +316,9 @@ typedef struct emu8k_voice_t {
|
||||
|
||||
int env_engine_on;
|
||||
|
||||
emu8k_mem_internal_t addr, loop_start, loop_end;
|
||||
emu8k_mem_internal_t addr;
|
||||
emu8k_mem_internal_t loop_start;
|
||||
emu8k_mem_internal_t loop_end;
|
||||
|
||||
int32_t initial_att;
|
||||
int32_t initial_filter;
|
||||
|
||||
@@ -203,9 +203,11 @@ extern const device_t es1373_onboard_device;
|
||||
extern const device_t ct5880_device;
|
||||
extern const device_t ct5880_onboard_device;
|
||||
|
||||
/* Gravis UltraSound and UltraSound Max */
|
||||
/* Gravis UltraSound family */
|
||||
extern const device_t gus_device;
|
||||
extern const device_t gus_v37_device;
|
||||
extern const device_t gus_max_device;
|
||||
extern const device_t gus_ace_device;
|
||||
|
||||
/* IBM PS/1 Audio Card */
|
||||
extern const device_t ps1snd_device;
|
||||
@@ -236,6 +238,9 @@ extern const device_t tndy_device;
|
||||
extern const device_t wss_device;
|
||||
extern const device_t ncr_business_audio_device;
|
||||
|
||||
/* Yamaha YMF-7xx */
|
||||
extern const device_t ymf701_device;
|
||||
|
||||
#ifdef USE_LIBSERIALPORT
|
||||
/* External Audio device OPL2Board (Host Connected hardware)*/
|
||||
extern const device_t opl2board_device;
|
||||
|
||||
38
src/include/86box/vid_clockgen_icd2061.h
Normal file
38
src/include/86box/vid_clockgen_icd2061.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* ICD2061 clock generator emulation.
|
||||
* Also emulates the ICS9161 which is the same as the ICD2016,
|
||||
* but without the need for tuning (which is irrelevant in
|
||||
* emulation anyway).
|
||||
*
|
||||
* Used by ET4000w32/p (Diamond Stealth 32) and the S3
|
||||
* Vision964 family.
|
||||
*
|
||||
*
|
||||
*
|
||||
* Authors: Miran Grca, <mgrca8@gmail.com>
|
||||
*
|
||||
* Copyright 2016-2018 Miran Grca.
|
||||
*/
|
||||
#ifndef VIDEO_CLOCKGEN_ICD2061_H
|
||||
#define VIDEO_CLOCKGEN_ICD2061_H
|
||||
|
||||
typedef struct icd2061_t {
|
||||
float freq[3];
|
||||
float ref_clock;
|
||||
|
||||
int count;
|
||||
int bit_count;
|
||||
int unlocked;
|
||||
int state;
|
||||
uint32_t data;
|
||||
uint32_t ctrl;
|
||||
} icd2061_t;
|
||||
|
||||
#endif // VIDEO_CLOCKGEN_ICD2061_H
|
||||
@@ -20,8 +20,9 @@
|
||||
#ifndef EMU_VID_DDC_H
|
||||
#define EMU_VID_DDC_H
|
||||
|
||||
extern void *ddc_init(void *i2c);
|
||||
extern void ddc_close(void *eeprom);
|
||||
extern void *ddc_create_default_edid(ssize_t* size_out);
|
||||
extern void *ddc_init(void *i2c);
|
||||
extern void ddc_close(void *eeprom);
|
||||
extern size_t ddc_create_default_edid(uint8_t **size_out);
|
||||
extern size_t ddc_load_edid(char *path, uint8_t *buf, size_t size);
|
||||
|
||||
#endif /*EMU_VID_DDC_H*/
|
||||
|
||||
@@ -141,6 +141,10 @@ typedef struct svga_t {
|
||||
int render_line_offset;
|
||||
int start_retrace_latch;
|
||||
int vga_mode;
|
||||
int half_pixel;
|
||||
int clock_multiplier;
|
||||
int true_color_bypass;
|
||||
int multiplexing_rate;
|
||||
|
||||
/*The three variables below allow us to implement memory maps like that seen on a 1MB Trio64 :
|
||||
0MB-1MB - VRAM
|
||||
@@ -449,6 +453,7 @@ extern void ibm_rgb528_ramdac_set_ref_clock(void *priv, svga_t *svga, float r
|
||||
|
||||
extern void icd2061_write(void *priv, int val);
|
||||
extern float icd2061_getclock(int clock, void *priv);
|
||||
extern void icd2061_set_ref_clock(void *priv, float ref_clock);
|
||||
|
||||
/* The code is the same, the #define's are so that the correct name can be used. */
|
||||
# define ics9161_write icd2061_write
|
||||
@@ -465,6 +470,8 @@ extern uint8_t sc1148x_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svg
|
||||
|
||||
extern void sc1502x_ramdac_out(uint16_t addr, uint8_t val, void *priv, svga_t *svga);
|
||||
extern uint8_t sc1502x_ramdac_in(uint16_t addr, void *priv, svga_t *svga);
|
||||
extern void sc1502x_rs2_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
|
||||
extern uint8_t sc1502x_rs2_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
|
||||
|
||||
extern void sdac_ramdac_out(uint16_t addr, int rs2, uint8_t val, void *priv, svga_t *svga);
|
||||
extern uint8_t sdac_ramdac_in(uint16_t addr, int rs2, void *priv, svga_t *svga);
|
||||
@@ -516,6 +523,7 @@ extern const device_t sc11487_ramdac_device;
|
||||
extern const device_t sc11486_ramdac_device;
|
||||
extern const device_t sc11484_nors2_ramdac_device;
|
||||
extern const device_t sc1502x_ramdac_device;
|
||||
extern const device_t sc1502x_rs2_ramdac_device;
|
||||
extern const device_t sdac_ramdac_device;
|
||||
extern const device_t stg_ramdac_device;
|
||||
extern const device_t tkd8001_ramdac_device;
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -412,7 +412,7 @@ extern const device_t cga_pravetz_device;
|
||||
/* Compaq CGA */
|
||||
extern const device_t compaq_cga_device;
|
||||
extern const device_t compaq_cga_2_device;
|
||||
extern const device_t compaq_plasma_device;
|
||||
extern const device_t compaq_plasma_device;
|
||||
|
||||
/* Olivetti OGC */
|
||||
extern const device_t ogc_device;
|
||||
@@ -513,8 +513,11 @@ extern const device_t realtek_rtg3106_device;
|
||||
extern const device_t s3_orchid_86c911_isa_device;
|
||||
extern const device_t s3_diamond_stealth_vram_isa_device;
|
||||
extern const device_t s3_ami_86c924_isa_device;
|
||||
extern const device_t s3_elsa_winner1000_86c928_vlb_device;
|
||||
extern const device_t s3_elsa_winner2000_86c928_isa_device;
|
||||
extern const device_t s3_metheus_86c928_isa_device;
|
||||
extern const device_t s3_metheus_86c928_vlb_device;
|
||||
extern const device_t s3_elsa_winner1000_86c928_pci_device;
|
||||
extern const device_t s3_spea_mercury_lite_86c928_pci_device;
|
||||
extern const device_t s3_spea_mirage_86c801_isa_device;
|
||||
extern const device_t s3_winner1000_805_isa_device;
|
||||
@@ -635,9 +638,9 @@ extern const device_t wy700_device;
|
||||
extern const device_t v6355d_device;
|
||||
|
||||
/* Tandy */
|
||||
extern const device_t tandy_1000_video_device;
|
||||
extern const device_t tandy_1000hx_video_device;
|
||||
extern const device_t tandy_1000sl_video_device;
|
||||
extern const device_t tandy_1000_video_device;
|
||||
extern const device_t tandy_1000hx_video_device;
|
||||
extern const device_t tandy_1000sl_video_device;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -305,7 +305,8 @@ machine_at_portableiii_init(const machine_t *model)
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_grid1520_init(const machine_t *model) {
|
||||
machine_at_grid1520_init(const machine_t *model)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = bios_load_linear("roms/machines/grid1520/grid1520_891025.rom",
|
||||
@@ -328,6 +329,28 @@ machine_at_grid1520_init(const machine_t *model) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_pc900_init(const machine_t *model)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret = bios_load_linear("roms/machines/pc900/mpf_pc900_v207a.bin",
|
||||
0x000f8000, 32768, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
|
||||
|
||||
mem_remap_top(384);
|
||||
|
||||
if (fdc_current[0] == FDC_INTERNAL)
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_mr286_init(const machine_t *model)
|
||||
{
|
||||
@@ -713,6 +736,28 @@ machine_at_tg286m_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_px286_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/px286/KENITEC.BIN",
|
||||
0x000f0000, 65536, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
|
||||
|
||||
if (fdc_current[0] == FDC_INTERNAL)
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
device_add(&neat_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Onboard Paradise PVGA1A-JK VGA Graphics
|
||||
// Data Technology Corporation DTC7187 RLL Controller (Optional)
|
||||
@@ -793,28 +838,6 @@ machine_at_3302_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_px286_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/px286/KENITEC.BIN",
|
||||
0x000f0000, 65536, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
|
||||
|
||||
if (fdc_current[0] == FDC_INTERNAL)
|
||||
device_add(&fdc_at_device);
|
||||
|
||||
device_add(&neat_device);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* SCAMP */
|
||||
int
|
||||
machine_at_pc7286_init(const machine_t *model)
|
||||
|
||||
@@ -68,9 +68,9 @@ static const device_config_t deskpro386_config[] = {
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "September 1986", .internal_name = "deskpro386", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "September 1986", .internal_name = "deskpro386_09_1986", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/deskpro386/1986-09-04-HI.json.bin", "" } },
|
||||
{ .name = "May 1988", .internal_name = "deskpro386_05_1988", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "May 1988", .internal_name = "deskpro386", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/deskpro386/1988-05-10.json.bin", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
|
||||
@@ -162,28 +162,6 @@ machine_at_pbl300sx_init(const machine_t *model)
|
||||
}
|
||||
|
||||
/* ALi M1217 */
|
||||
int
|
||||
machine_at_arb1374_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/arb1374/1374s.rom",
|
||||
0x000f0000, 65536, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
|
||||
device_add(&ali1217_device);
|
||||
device_add(&ide_isa_device);
|
||||
device_add_params(&w83877_device, (void *) (W83877F | W83877_3F0 | W83XX7_IDE_PRI));
|
||||
|
||||
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_sbc350a_init(const machine_t *model)
|
||||
{
|
||||
@@ -206,6 +184,28 @@ machine_at_sbc350a_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_arb1374_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/arb1374/1374s.rom",
|
||||
0x000f0000, 65536, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
machine_at_common_init(model);
|
||||
|
||||
device_add(&ali1217_device);
|
||||
device_add(&ide_isa_device);
|
||||
device_add_params(&w83877_device, (void *) (W83877F | W83877_3F0 | W83XX7_IDE_PRI));
|
||||
|
||||
device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_at_flytech386_init(const machine_t *model)
|
||||
{
|
||||
@@ -254,7 +254,7 @@ static const device_config_t c325ax_config[] = {
|
||||
};
|
||||
|
||||
const device_t c325ax_device = {
|
||||
.name = "Chaintech 325AX",
|
||||
.name = "Chaintech 3xxAX/AXB",
|
||||
.internal_name = "325ax_device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
|
||||
@@ -348,17 +348,57 @@ machine_at_bf6_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const device_config_t bx6_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "bios",
|
||||
.description = "BIOS Version",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "bx6",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision EG", .internal_name = "bx6_eg", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_EG.BIN", "" } },
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision QS", .internal_name = "bx6", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/bx6/BX6_QS.bin", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t bx6_device = {
|
||||
.name = "ABIT AB-BX6",
|
||||
.internal_name = "bx6_device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = bx6_config
|
||||
};
|
||||
|
||||
int
|
||||
machine_at_bx6_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
const char* fn;
|
||||
|
||||
ret = bios_load_linear("roms/machines/bx6/BX6_EG.BIN",
|
||||
0x000e0000, 131072, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
/* No ROMs available */
|
||||
if (!device_available(model->device))
|
||||
return ret;
|
||||
|
||||
device_context(model->device);
|
||||
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
|
||||
ret = bios_load_linear(fn, 0x000e0000, 131072, 0);
|
||||
device_context_restore();
|
||||
|
||||
machine_at_common_init_ex(model, 2);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
@@ -519,17 +559,61 @@ machine_at_686bx_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const device_config_t ms6119_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "bios",
|
||||
.description = "BIOS Version",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "ms6119",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "AMIBIOS 6 (071595) - Revision 1.90 (Packard Bell Tacoma)", .internal_name = "tacoma", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/A19P2190.ROM", "" } },
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 2.10", .internal_name = "ms6119", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/w6119ims.2a0", "" } },
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 2.12 (Viglen Vig69M)", .internal_name = "vig69m", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/vig69m.212", "" } },
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 3.30b1 (LG IBM Multinet i x7G)", .internal_name = "lgibmx7g", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/ms6119/ms6119.331", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t ms6119_device = {
|
||||
.name = "MSI MS-6119",
|
||||
.internal_name = "ms6119_device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = ms6119_config
|
||||
};
|
||||
|
||||
int
|
||||
machine_at_lgibmx7g_init(const machine_t *model)
|
||||
machine_at_ms6119_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
const char* fn;
|
||||
|
||||
ret = bios_load_linear("roms/machines/lgibmx7g/ms6119.331",
|
||||
0x000c0000, 262144, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
/* No ROMs available */
|
||||
if (!device_available(model->device))
|
||||
return ret;
|
||||
|
||||
device_context(model->device);
|
||||
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
|
||||
ret = bios_load_linear(fn, 0x000c0000, 262144, 0);
|
||||
device_context_restore();
|
||||
|
||||
machine_at_common_init_ex(model, 2);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
@@ -545,7 +629,7 @@ machine_at_lgibmx7g_init(const machine_t *model)
|
||||
device_add_params(&w83977_device, (void *) (W83977TF | W83977_AMI | W83977_NO_NVR));
|
||||
device_add(&winbond_flash_w29c020_device);
|
||||
spd_register(SPD_TYPE_SDRAM, 0x7, 256);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,11 +178,11 @@ static const device_config_t j403tg_config[] = {
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "Award Modular BIOS v4.50G", .internal_name = "403tg", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/403tg/403TG.BIN", "" } },
|
||||
{ .name = "AMI WinBIOS (121593)", .internal_name = "403tg_d", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "AMI WinBIOS (121593)", .internal_name = "403tg", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/403tg/J403TGRevD.BIN", "" } },
|
||||
{ .name = "MR BIOS V2.02", .internal_name = "403tg_d_mr", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "Award Modular BIOS v4.50G", .internal_name = "403tg_award", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/403tg/403TG.BIN", "" } },
|
||||
{ .name = "MR BIOS V2.02", .internal_name = "403tg_mr", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 65536, .files = { "roms/machines/403tg/MRBiosOPT895.bin", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
|
||||
@@ -151,10 +151,14 @@ static const device_config_t cu430hx_config[] = {
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.03.DK08 (Toshiba Equium 5200D)", .internal_name = "equium5200", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.03.DK08 (Toshiba Equium 5xx0D)", .internal_name = "equium5200", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1003DK08.BIO", "roms/machines/cu430hx/1003DK08.BI1",
|
||||
"roms/machines/cu430hx/1003DK08.BI2", "roms/machines/cu430hx/1003DK08.BI3",
|
||||
"roms/machines/cu430hx/1003DK08.RCV", "" } },
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.04.DK0K (NEC PowerMate V2xxx/P2xxx)", .internal_name = "powermatev2p2", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1004DK0K.BIO", "roms/machines/cu430hx/1004DK0K.BI1",
|
||||
"roms/machines/cu430hx/1004DK0K.BI2", "roms/machines/cu430hx/1004DK0K.BI3",
|
||||
"roms/machines/cu430hx/1004DK0K.RCV", "" } },
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.06.DK0", .internal_name = "cu430hx", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/cu430hx/1006DK0_.BIO", "roms/machines/cu430hx/1006DK0_.BI1",
|
||||
"roms/machines/cu430hx/1006DK0_.BI2", "roms/machines/cu430hx/1006DK0_.BI3",
|
||||
@@ -266,7 +270,7 @@ static const device_config_t tc430hx_config[] = {
|
||||
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/tc430hx/1007DH0_.BIO", "roms/machines/tc430hx/1007DH0_.BI1",
|
||||
"roms/machines/tc430hx/1007DH0_.BI2", "roms/machines/tc430hx/1007DH0_.BI3",
|
||||
"roms/machines/tc430hx/1007DH0_.RCV", "" } },
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.08.DH08 (Toshiba Infinia 7201)", .internal_name = "infinia7200", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "Intel AMIBIOS - Revision 1.00.08.DH08 (Toshiba Infinia 7xx1)", .internal_name = "infinia7200", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 5, .local = 0, .size = 262144, .files = { "roms/machines/tc430hx/1008DH08.BIO", "roms/machines/tc430hx/1008DH08.BI1",
|
||||
"roms/machines/tc430hx/1008DH08.BI2", "roms/machines/tc430hx/1008DH08.BI3",
|
||||
"roms/machines/tc430hx/1008DH08.RCV", "" } },
|
||||
@@ -316,6 +320,9 @@ machine_at_tc430hx_gpio_init(void)
|
||||
else if (cpu_busspeed > 60000000)
|
||||
gpio |= 0xffff00ff;
|
||||
|
||||
if (sound_card_current[0] == SOUND_INTERNAL)
|
||||
gpio |= 0xffff04ff;
|
||||
|
||||
machine_set_gpio_default(gpio);
|
||||
}
|
||||
|
||||
@@ -350,6 +357,9 @@ machine_at_tc430hx_init(const machine_t *model)
|
||||
if (gfxcard[0] == VID_INTERNAL)
|
||||
device_add(machine_get_vid_device(machine));
|
||||
|
||||
if (sound_card_current[0] == SOUND_INTERNAL)
|
||||
machine_snd = device_add(machine_get_snd_device(machine));
|
||||
|
||||
device_add(&i430hx_device);
|
||||
device_add(&piix3_device);
|
||||
device_add_params(&pc87306_device, (void *) PCX730X_AMI);
|
||||
@@ -358,17 +368,57 @@ machine_at_tc430hx_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const device_config_t m7shi_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "bios",
|
||||
.description = "BIOS Version",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "m7shi",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "PhoenixBIOS 4.0 Release 6.0 - Revision 05/20/97", .internal_name = "m7shi", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/m7shi/m7shi2n.rom", "" } },
|
||||
{ .name = "PhoenixBIOS 4.0 Release 6.0 - Revision 01/21/98", .internal_name = "m7shi_4", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 262144, .files = { "roms/machines/m7shi/M7ns04.rom", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t m7shi_device = {
|
||||
.name = "Micronics M7S-Hi",
|
||||
.internal_name = "m7shi_device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = m7shi_config
|
||||
};
|
||||
|
||||
int
|
||||
machine_at_m7shi_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
int ret = 0;
|
||||
const char* fn;
|
||||
|
||||
ret = bios_load_linear("roms/machines/m7shi/m7shi2n.rom",
|
||||
0x000c0000, 262144, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
/* No ROMs available */
|
||||
if (!device_available(model->device))
|
||||
return ret;
|
||||
|
||||
device_context(model->device);
|
||||
fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0);
|
||||
ret = bios_load_linear(fn, 0x000c0000, 262144, 0);
|
||||
device_context_restore();
|
||||
|
||||
machine_at_common_init_ex(model, 2);
|
||||
|
||||
pci_init(PCI_CONFIG_TYPE_1);
|
||||
@@ -452,6 +502,9 @@ machine_at_pcv90_init(const machine_t *model)
|
||||
device_add_params(&pc87306_device, (void *) PCX730X_AMI);
|
||||
device_add(&intel_flash_bxt_ami_device);
|
||||
|
||||
if (sound_card_current[0] == SOUND_INTERNAL)
|
||||
machine_snd = device_add(machine_get_snd_device(machine));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1753,9 +1806,9 @@ static const device_config_t m5ata_config[] = {
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 12/23/97", .internal_name = "m5ata", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 12/23/97", .internal_name = "m5ata_1223", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/m5ata/ATA1223.BIN", "" } },
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 05/27/98", .internal_name = "m5ata_0527b", .bios_type = BIOS_NORMAL,
|
||||
{ .name = "Award Modular BIOS v4.51PG - Revision 05/27/98", .internal_name = "m5ata", .bios_type = BIOS_NORMAL,
|
||||
.files_no = 1, .local = 0, .size = 131072, .files = { "roms/machines/m5ata/ATA0527B.BIN", "" } },
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
|
||||
@@ -111,7 +111,7 @@ static const device_config_t ficpo6000_config[] = {
|
||||
.name = "bios",
|
||||
.description = "BIOS Version",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "405F03C",
|
||||
.default_string = "405F05C",
|
||||
.default_int = 0,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 }, /*W1*/
|
||||
|
||||
@@ -774,14 +774,14 @@ pit_irq0_timer_pcjr(int new_out, int old_out, UNUSED(void *priv))
|
||||
static const device_config_t pcjr_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "display_type",
|
||||
.description = "Display type",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = "",
|
||||
.default_int = PCJR_RGB,
|
||||
.file_filter = "",
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
.name = "display_type",
|
||||
.description = "Display type",
|
||||
.type = CONFIG_SELECTION,
|
||||
.default_string = NULL,
|
||||
.default_int = PCJR_RGB,
|
||||
.file_filter = NULL,
|
||||
.spinner = { 0 },
|
||||
.selection = {
|
||||
{ .description = "RGB", .value = PCJR_RGB },
|
||||
{ .description = "Composite", .value = PCJR_COMPOSITE },
|
||||
{ .description = "RGB (no brown)", .value = PCJR_RGB_NO_BROWN },
|
||||
@@ -807,11 +807,11 @@ static const device_config_t pcjr_config[] = {
|
||||
.bios = { { 0 } }
|
||||
},
|
||||
{
|
||||
.name = "apply_hd",
|
||||
.description = "Apply overscan deltas",
|
||||
.type = CONFIG_BINARY,
|
||||
.default_string = "",
|
||||
.default_int = 1
|
||||
.name = "apply_hd",
|
||||
.description = "Apply overscan deltas",
|
||||
.type = CONFIG_BINARY,
|
||||
.default_string = NULL,
|
||||
.default_int = 1
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
|
||||
@@ -974,13 +974,88 @@ machine_xt_micoms_xl7turbo_init(const machine_t *model)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const device_config_t pc500_config[] = {
|
||||
// clang-format off
|
||||
{
|
||||
.name = "bios",
|
||||
.description = "BIOS Version",
|
||||
.type = CONFIG_BIOS,
|
||||
.default_string = "pc500_330",
|
||||
.default_int = 0,
|
||||
.file_filter = NULL,
|
||||
.spinner = { 0 },
|
||||
.bios = {
|
||||
{
|
||||
.name = "3.30",
|
||||
.internal_name = "pc500_330",
|
||||
.bios_type = BIOS_NORMAL,
|
||||
.files_no = 1,
|
||||
.local = 0,
|
||||
.size = 8192,
|
||||
.files = { "roms/machines/pc500/rom330.bin", "" }
|
||||
},
|
||||
{
|
||||
.name = "3.10",
|
||||
.internal_name = "pc500_310",
|
||||
.bios_type = BIOS_NORMAL,
|
||||
.files_no = 1,
|
||||
.local = 0,
|
||||
.size = 8192,
|
||||
.files = { "roms/machines/pc500/rom310.bin", "" }
|
||||
},
|
||||
{ .files_no = 0 }
|
||||
},
|
||||
},
|
||||
{ .name = "", .description = "", .type = CONFIG_END }
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
const device_t pc500_device = {
|
||||
.name = "Multitech PC-500",
|
||||
.internal_name = "pc500_device",
|
||||
.flags = 0,
|
||||
.local = 0,
|
||||
.init = NULL,
|
||||
.close = NULL,
|
||||
.reset = NULL,
|
||||
.available = NULL,
|
||||
.speed_changed = NULL,
|
||||
.force_redraw = NULL,
|
||||
.config = pc500_config
|
||||
};
|
||||
|
||||
int
|
||||
machine_xt_pc500_init(const machine_t *model)
|
||||
{
|
||||
int ret = 0;
|
||||
const char *fn;
|
||||
|
||||
/* No ROMs available. */
|
||||
if (!device_available(model->device))
|
||||
return ret;
|
||||
|
||||
device_context(model->device);
|
||||
fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0);
|
||||
ret = bios_load_linear(fn, 0x000fe000, 8192, 0);
|
||||
device_context_restore();
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
device_add(&kbc_pc_device);
|
||||
|
||||
machine_xt_common_init(model, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
machine_xt_pc500plus_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/pc500/rom404.bin",
|
||||
0x000f8000, 32768, 0);
|
||||
0x000fc000, 16384, 0);
|
||||
|
||||
if (bios_only || !ret)
|
||||
return ret;
|
||||
|
||||
@@ -2426,7 +2426,7 @@ machine_xt_m19_init(const machine_t *model)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = bios_load_linear("roms/machines/m19/BIOS.BIN",
|
||||
ret = bios_load_linear("roms/machines/m19/Olivetti M19 Resident Diagnostics Rev 3.71.BIN",
|
||||
0x000fc000, 16384, 0);
|
||||
ret &= rom_present("roms/machines/m19/MBM2764-30 8514 107 AB PCF3.BIN");
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -21,6 +21,7 @@ add_library(mem OBJECT
|
||||
intel_flash.c
|
||||
mem.c
|
||||
mmu_2386.c
|
||||
nmc93cxx.c
|
||||
rom.c
|
||||
row.c
|
||||
smram.c
|
||||
|
||||
177
src/mem/mem.c
177
src/mem/mem.c
@@ -67,9 +67,6 @@ mem_mapping_t bios_mapping;
|
||||
mem_mapping_t bios_high_mapping;
|
||||
|
||||
page_t *pages; /* RAM page table */
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
page_t **page_lookup; /* pagetable lookup */
|
||||
#endif
|
||||
uint32_t pages_sz; /* #pages in table */
|
||||
|
||||
uint8_t *ram; /* the virtual RAM */
|
||||
@@ -87,23 +84,16 @@ uint8_t *pccache2;
|
||||
|
||||
int readlnext;
|
||||
int readlookup[256];
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
uintptr_t *readlookup2;
|
||||
#endif
|
||||
uintptr_t old_rl2;
|
||||
uint8_t uncached = 0;
|
||||
int writelnext;
|
||||
int writelookup[256];
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
uintptr_t *writelookup2;
|
||||
#endif
|
||||
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
/* The lookup tables. */
|
||||
page_t *page_lookup[1048576] = { 0 };
|
||||
uintptr_t readlookup2[1048576] = { 0 };
|
||||
uintptr_t writelookup2[1048576] = { 0 };
|
||||
#endif
|
||||
|
||||
|
||||
uint32_t mem_logical_addr;
|
||||
|
||||
@@ -147,12 +137,7 @@ static uint8_t ff_pccache[4] = { 0xff, 0xff, 0xff, 0xff };
|
||||
static mem_state_t _mem_state[MEM_MAPPINGS_NO];
|
||||
static uint32_t remap_start_addr;
|
||||
static uint32_t remap_start_addr2;
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
static size_t ram_size = 0;
|
||||
static size_t ram2_size = 0;
|
||||
#else
|
||||
static size_t ram_size = 0;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MEM_LOG
|
||||
int mem_do_log = ENABLE_MEM_LOG;
|
||||
@@ -274,24 +259,10 @@ void
|
||||
mem_flush_write_page(uint32_t addr, uint32_t virt)
|
||||
{
|
||||
const page_t *page_target = &pages[addr >> 12];
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
uint32_t a;
|
||||
#endif
|
||||
|
||||
for (uint16_t c = 0; c < 256; c++) {
|
||||
if (writelookup[c] != (int) 0xffffffff) {
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
uintptr_t target = (uintptr_t) &ram[(uintptr_t) (addr & ~0xfff) - (virt & ~0xfff)];
|
||||
#else
|
||||
a = (uintptr_t) (addr & ~0xfff) - (virt & ~0xfff);
|
||||
uintptr_t target;
|
||||
|
||||
if ((addr & ~0xfff) >= (1 << 30))
|
||||
target = (uintptr_t) &ram2[a - (1 << 30)];
|
||||
else
|
||||
target = (uintptr_t) &ram[a];
|
||||
#endif
|
||||
|
||||
if (writelookup2[writelookup[c]] == target || page_lookup[writelookup[c]] == page_target) {
|
||||
writelookup2[writelookup[c]] = LOOKUP_INV;
|
||||
page_lookup[writelookup[c]] = NULL;
|
||||
@@ -599,10 +570,6 @@ mem_addr_translate(uint32_t addr, uint32_t chunk_start, uint32_t len)
|
||||
void
|
||||
addreadlookup(uint32_t virt, uint32_t phys)
|
||||
{
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
uint32_t a;
|
||||
#endif
|
||||
|
||||
if (virt == 0xffffffff)
|
||||
return;
|
||||
|
||||
@@ -615,16 +582,7 @@ addreadlookup(uint32_t virt, uint32_t phys)
|
||||
readlookup2[readlookup[readlnext]] = LOOKUP_INV;
|
||||
}
|
||||
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
readlookup2[virt >> 12] = (uintptr_t) &ram[(uintptr_t) (phys & ~0xFFF) - (uintptr_t) (virt & ~0xfff)];
|
||||
#else
|
||||
a = ((uint32_t) (phys & ~0xfff) - (uint32_t) (virt & ~0xfff));
|
||||
|
||||
if ((phys & ~0xfff) >= (1 << 30))
|
||||
readlookup2[virt >> 12] = (uintptr_t) &ram2[a - (1 << 30)];
|
||||
else
|
||||
readlookup2[virt >> 12] = (uintptr_t) &ram[a];
|
||||
#endif
|
||||
|
||||
readlookup[readlnext++] = virt >> 12;
|
||||
readlnext &= (cachesize - 1);
|
||||
@@ -635,10 +593,6 @@ addreadlookup(uint32_t virt, uint32_t phys)
|
||||
void
|
||||
addwritelookup(uint32_t virt, uint32_t phys)
|
||||
{
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
uint32_t a;
|
||||
#endif
|
||||
|
||||
if (virt == 0xffffffff)
|
||||
return;
|
||||
|
||||
@@ -665,16 +619,8 @@ addwritelookup(uint32_t virt, uint32_t phys)
|
||||
#endif
|
||||
page_lookup[virt >> 12] = &pages[phys >> 12];
|
||||
} else {
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
writelookup2[virt >> 12] = (uintptr_t) &ram[(uintptr_t) (phys & ~0xFFF) - (uintptr_t) (virt & ~0xfff)];
|
||||
#else
|
||||
a = ((uint32_t) (phys & ~0xfff) - (uint32_t) (virt & ~0xfff));
|
||||
|
||||
if ((phys & ~0xfff) >= (1 << 30))
|
||||
writelookup2[virt >> 12] = (uintptr_t) &ram2[a - (1 << 30)];
|
||||
else
|
||||
writelookup2[virt >> 12] = (uintptr_t) &ram[a];
|
||||
#endif
|
||||
writelookup2[virt >> 12] = (uintptr_t) &ram[(uintptr_t) (phys & ~0xFFF) - (uintptr_t) (virt & ~0xfff)];
|
||||
}
|
||||
|
||||
writelookup[writelnext++] = virt >> 12;
|
||||
@@ -687,9 +633,7 @@ uint8_t *
|
||||
getpccache(uint32_t a)
|
||||
{
|
||||
uint64_t a64 = (uint64_t) a;
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
uint8_t *p;
|
||||
#endif
|
||||
uint32_t a2;
|
||||
|
||||
a2 = a;
|
||||
@@ -710,12 +654,8 @@ getpccache(uint32_t a)
|
||||
cpu_prefetch_cycles = cpu_mem_prefetch_cycles;
|
||||
}
|
||||
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
p = &_mem_exec[a64 >> MEM_GRANULARITY_BITS][(uintptr_t) (a64 & MEM_GRANULARITY_PAGE) - (uintptr_t) (a2 & ~0xfff)];
|
||||
return (uint8_t *) (((uintptr_t) p & 0x00000000ffffffffULL) | ((uintptr_t) &_mem_exec[a64 >> MEM_GRANULARITY_BITS][0] & 0xffffffff00000000ULL));
|
||||
#else
|
||||
return &_mem_exec[a64 >> MEM_GRANULARITY_BITS][(uintptr_t) (a64 & MEM_GRANULARITY_PAGE) - (uintptr_t) (a2 & ~0xfff)];
|
||||
#endif
|
||||
}
|
||||
|
||||
mem_log("Bad getpccache %08X%08X\n", (uint32_t) (a64 >> 32), (uint32_t) (a64 & 0xffffffffULL));
|
||||
@@ -2771,11 +2711,6 @@ mem_init_ram_mapping(mem_mapping_t *mapping, uint32_t base, uint32_t size)
|
||||
void
|
||||
mem_zero(void)
|
||||
{
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576)
|
||||
memset(ram2, 0x00, ram2_size + 16);
|
||||
#endif
|
||||
|
||||
memset(ram, 0x00, ram_size + 16);
|
||||
}
|
||||
|
||||
@@ -2810,55 +2745,17 @@ mem_reset(void)
|
||||
ram = NULL;
|
||||
ram_size = 0;
|
||||
}
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (ram2 != NULL) {
|
||||
plat_munmap(ram2, ram2_size);
|
||||
ram2 = NULL;
|
||||
ram2_size = 0;
|
||||
}
|
||||
|
||||
if (mem_size > 2097152)
|
||||
mem_size = 2097152;
|
||||
#endif
|
||||
|
||||
m = 1024UL * (size_t) mem_size;
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576) {
|
||||
ram_size = 1 << 30;
|
||||
ram = (uint8_t *) plat_mmap(ram_size, 0); /* allocate and clear the RAM block of the first 1 GB */
|
||||
if (ram == NULL) {
|
||||
fatal("Failed to allocate primary RAM block. Make sure you have enough RAM available.\n");
|
||||
return;
|
||||
}
|
||||
memset(ram, 0x00, ram_size);
|
||||
ram2_size = m - (1 << 30);
|
||||
/* Allocate 16 extra bytes of RAM to mitigate some dynarec recompiler memory access quirks. */
|
||||
ram2 = (uint8_t *) plat_mmap(ram2_size + 16, 0); /* allocate and clear the RAM block above 1 GB */
|
||||
if (ram2 == NULL) {
|
||||
if (config_changed == 2)
|
||||
fatal(EMU_NAME " must be restarted for the memory amount change to be applied.\n");
|
||||
else
|
||||
fatal("Failed to allocate secondary RAM block. Make sure you have enough RAM available.\n");
|
||||
return;
|
||||
}
|
||||
memset(ram2, 0x00, ram2_size + 16);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
ram_size = m;
|
||||
/* Allocate 16 extra bytes of RAM to mitigate some dynarec recompiler memory access quirks. */
|
||||
ram = (uint8_t *) plat_mmap(ram_size + 16, 0); /* allocate and clear the RAM block */
|
||||
if (ram == NULL) {
|
||||
fatal("Failed to allocate RAM block. Make sure you have enough RAM available.\n");
|
||||
return;
|
||||
}
|
||||
memset(ram, 0x00, ram_size + 16);
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576)
|
||||
ram2 = &(ram[1 << 30]);
|
||||
#endif
|
||||
ram_size = m;
|
||||
/* Allocate 16 extra bytes of RAM to mitigate some dynarec recompiler memory access quirks. */
|
||||
ram = (uint8_t *) plat_mmap(ram_size + 16, 0); /* allocate and clear the RAM block */
|
||||
if (ram == NULL) {
|
||||
fatal("Failed to allocate RAM block. Make sure you have enough RAM available.\n");
|
||||
return;
|
||||
}
|
||||
memset(ram, 0x00, ram_size + 16);
|
||||
|
||||
/*
|
||||
* Allocate the page table based on how much RAM we have.
|
||||
@@ -2905,17 +2802,8 @@ mem_reset(void)
|
||||
if ((c << 12) >= (mem_size << 10))
|
||||
pages[c].mem = page_ff;
|
||||
else {
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576) {
|
||||
if ((c << 12) < (1 << 30))
|
||||
pages[c].mem = &ram[c << 12];
|
||||
else
|
||||
pages[c].mem = &ram2[(c << 12) - (1 << 30)];
|
||||
} else
|
||||
pages[c].mem = &ram[c << 12];
|
||||
#else
|
||||
|
||||
pages[c].mem = &ram[c << 12];
|
||||
#endif
|
||||
}
|
||||
if (c < m) {
|
||||
pages[c].write_b = mem_write_ramb_page;
|
||||
@@ -2951,22 +2839,7 @@ mem_reset(void)
|
||||
else if (cpu_16bitbus && is6117 && mem_size > 65408)
|
||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (65408 - 1024) * 1024);
|
||||
else {
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576) {
|
||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (1048576 - 1024) * 1024);
|
||||
|
||||
mem_set_mem_state_both((1 << 30), (mem_size - 1048576) * 1024,
|
||||
MEM_READ_INTERNAL | MEM_WRITE_INTERNAL);
|
||||
mem_mapping_add(&ram_2gb_mapping, (1 << 30),
|
||||
((mem_size - 1048576) * 1024),
|
||||
mem_read_ram_2gb, mem_read_ram_2gbw, mem_read_ram_2gbl,
|
||||
mem_write_ram, mem_write_ramw, mem_write_raml,
|
||||
ram2, MEM_MAPPING_INTERNAL, NULL);
|
||||
} else
|
||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (mem_size - 1024) * 1024);
|
||||
#else
|
||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (mem_size - 1024) * 1024);
|
||||
#endif
|
||||
mem_init_ram_mapping(&ram_high_mapping, 0x100000, (mem_size - 1024) * 1024);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3005,26 +2878,8 @@ mem_init(void)
|
||||
ram = rom = NULL;
|
||||
ram2 = NULL;
|
||||
pages = NULL;
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
/* Allocate the lookup tables. */
|
||||
page_lookup = (page_t **) malloc((1 << 20) * sizeof(page_t *));
|
||||
readlookup2 = malloc((1 << 20) * sizeof(uintptr_t));
|
||||
writelookup2 = malloc((1 << 20) * sizeof(uintptr_t));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
void
|
||||
mem_free(void)
|
||||
{
|
||||
free(page_lookup);
|
||||
free(readlookup2);
|
||||
free(writelookup2);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
umc_page_recalc(uint32_t c, uint32_t phys, int set)
|
||||
{
|
||||
@@ -3125,17 +2980,7 @@ mem_remap_top_ex_common(int kb, uint32_t start, int mid)
|
||||
if (sis_mode || ((c << 12) >= (mem_size << 10)))
|
||||
pages[c].mem = page_ff;
|
||||
else {
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576) {
|
||||
if ((c << 12) < (1 << 30))
|
||||
pages[c].mem = &ram[c << 12];
|
||||
else
|
||||
pages[c].mem = &ram2[(c << 12) - (1 << 30)];
|
||||
} else
|
||||
pages[c].mem = &ram[c << 12];
|
||||
#else
|
||||
pages[c].mem = &ram[c << 12];
|
||||
#endif
|
||||
}
|
||||
if (!sis_mode && (c < addr_space_size)) {
|
||||
pages[c].write_b = mem_write_ramb_page;
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <86box/device.h>
|
||||
#include <86box/timer.h>
|
||||
#include <86box/nvr.h>
|
||||
#include <86box/net_eeprom_nmc93cxx.h>
|
||||
#include <86box/nmc93cxx.h>
|
||||
#include <86box/plat_unused.h>
|
||||
|
||||
#ifdef ENABLE_NMC93CXX_EEPROM_LOG
|
||||
@@ -256,7 +256,12 @@ static void
|
||||
nmc93cxx_eeprom_close(void *priv)
|
||||
{
|
||||
nmc93cxx_eeprom_t *eeprom = (nmc93cxx_eeprom_t *) priv;
|
||||
free(eeprom);
|
||||
FILE *fp = nvr_fopen(eeprom->filename, "wb");
|
||||
if (fp) {
|
||||
fwrite(eeprom->dev.data, 2, eeprom->size, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
free(priv);
|
||||
}
|
||||
|
||||
uint16_t *
|
||||
@@ -155,18 +155,9 @@ row_allocate(uint8_t row_id, uint8_t set)
|
||||
mem_mapping_set_exec(&rows[row_id].mapping, rows[row_id].buf + rows[row_id].ram_base);
|
||||
mem_mapping_set_mask(&rows[row_id].mapping, rows[row_id].ram_mask);
|
||||
if ((rows[row_id].host_base == rows[row_id].ram_base) && (rows[row_id].host_size == rows[row_id].ram_size)) {
|
||||
#if (defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64)
|
||||
mem_mapping_set_handler(&rows[row_id].mapping, mem_read_ram,mem_read_ramw,mem_read_raml,
|
||||
mem_write_ram,mem_write_ramw,mem_write_raml);
|
||||
#else
|
||||
if (rows[row_id].buf == ram2) {
|
||||
mem_mapping_set_handler(&rows[row_id].mapping, mem_read_ram_2gb,mem_read_ram_2gbw,mem_read_ram_2gbl,
|
||||
mem_write_ram,mem_write_ramw,mem_write_raml);
|
||||
} else {
|
||||
mem_mapping_set_handler(&rows[row_id].mapping, mem_read_ram,mem_read_ramw,mem_read_raml,
|
||||
mem_write_ram,mem_write_ramw,mem_write_raml);
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
mem_mapping_set_handler(&rows[row_id].mapping, row_read, row_readw, row_readl,
|
||||
row_write, row_writew, row_writel);
|
||||
@@ -268,10 +259,6 @@ row_init(const device_t *info)
|
||||
mem_mapping_disable(&ram_low_mapping);
|
||||
mem_mapping_disable(&ram_mid_mapping);
|
||||
mem_mapping_disable(&ram_high_mapping);
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (mem_size > 1048576)
|
||||
mem_mapping_disable(&ram_2gb_mapping);
|
||||
#endif
|
||||
|
||||
for (uint32_t c = 0; c < pages_sz; c++) {
|
||||
pages[c].mem = page_ff;
|
||||
@@ -303,12 +290,7 @@ row_init(const device_t *info)
|
||||
rows[i].ram_size -= rows[i].ram_base;
|
||||
|
||||
rows[i].buf = ram;
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (rows[i].ram_base >= (1 << 30)) {
|
||||
rows[i].ram_base -= (1 << 30);
|
||||
rows[i].buf = ram2;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
rows[i].ram_mask = rows[i].ram_size - 1;
|
||||
|
||||
|
||||
@@ -59,11 +59,6 @@ smram_read(uint32_t addr, void *priv)
|
||||
const smram_t *dev = (smram_t *) priv;
|
||||
uint32_t new_addr = addr - dev->host_base + dev->ram_base;
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (new_addr >= (1 << 30))
|
||||
return mem_read_ram_2gb(new_addr, priv);
|
||||
else
|
||||
#endif
|
||||
if (!use_separate_smram || (new_addr >= 0xa0000))
|
||||
return mem_read_ram(new_addr, priv);
|
||||
else
|
||||
@@ -76,11 +71,6 @@ smram_readw(uint32_t addr, void *priv)
|
||||
smram_t *dev = (smram_t *) priv;
|
||||
uint32_t new_addr = addr - dev->host_base + dev->ram_base;
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (new_addr >= (1 << 30))
|
||||
return mem_read_ram_2gbw(new_addr, priv);
|
||||
else
|
||||
#endif
|
||||
if (!use_separate_smram || (new_addr >= 0xa0000))
|
||||
return mem_read_ramw(new_addr, priv);
|
||||
else
|
||||
@@ -93,11 +83,6 @@ smram_readl(uint32_t addr, void *priv)
|
||||
smram_t *dev = (smram_t *) priv;
|
||||
uint32_t new_addr = addr - dev->host_base + dev->ram_base;
|
||||
|
||||
#if (!(defined __amd64__ || defined _M_X64 || defined __aarch64__ || defined _M_ARM64))
|
||||
if (new_addr >= (1 << 30))
|
||||
return mem_read_ram_2gbl(new_addr, priv);
|
||||
else
|
||||
#endif
|
||||
if (!use_separate_smram || (new_addr >= 0xa0000))
|
||||
return mem_read_raml(new_addr, priv);
|
||||
else
|
||||
|
||||
@@ -419,7 +419,7 @@ void mtr_flush_with_state(int is_last) {
|
||||
len = snprintf(linebuf, ARRAY_SIZE(linebuf), "%s{\"cat\":\"%s\",\"pid\":%i,\"tid\":%i,\"ts\":%" PRId64 ",\"ph\":\"%c\",\"name\":\"%s\",\"args\":{%s}%s}",
|
||||
first_line ? "" : ",\n",
|
||||
cat, raw->pid, raw->tid, raw->ts - time_offset, raw->ph, raw->name, arg_buf, id_buf);
|
||||
fwrite(linebuf, 1, len, f);
|
||||
fwrite(linebuf, 1, len, fp);
|
||||
first_line = 0;
|
||||
|
||||
if (raw->arg_type == MTR_ARG_TYPE_STRING_COPY) {
|
||||
|
||||
@@ -28,7 +28,6 @@ list(APPEND net_sources
|
||||
net_plip.c
|
||||
net_event.c
|
||||
net_null.c
|
||||
net_eeprom_nmc93cxx.c
|
||||
net_tulip.c
|
||||
net_rtl8139.c
|
||||
net_l80225.c
|
||||
|
||||
@@ -1566,6 +1566,8 @@ static const device_config_t modem_config[] = {
|
||||
{ .description = "57600", .value = 57600 },
|
||||
{ .description = "56000", .value = 56000 },
|
||||
{ .description = "38400", .value = 38400 },
|
||||
{ .description = "33600", .value = 33600 },
|
||||
{ .description = "28800", .value = 28800 },
|
||||
{ .description = "19200", .value = 19200 },
|
||||
{ .description = "14400", .value = 14400 },
|
||||
{ .description = "9600", .value = 9600 },
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user