project rename

This commit is contained in:
Anthony Pesch 2016-02-06 01:25:18 -08:00
parent 198cd53525
commit b587b3611b
128 changed files with 542 additions and 546 deletions

View File

@ -13,7 +13,7 @@ endif()
# enable both ASM and ASM_MASM. cmake will ignore whichever one isn't supported
# by the current platform
project(dreavm C CXX ASM ASM_MASM)
project(redream C CXX ASM ASM_MASM)
# export compile_commands.json for clang-tidy
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
@ -25,7 +25,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
check_function_exists(strcasecmp HAVE_STRCASECMP)
check_function_exists(strnstr HAVE_STRNSTR)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/core/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/src/core/config.h)
list(APPEND DREAVM_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/src)
list(APPEND REDREAM_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/src)
#--------------------------------------------------
# dynamic libs
@ -33,8 +33,8 @@ list(APPEND DREAVM_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}/src)
# opengl
find_package(OpenGL REQUIRED)
list(APPEND DREAVM_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND DREAVM_LIBS ${OPENGL_LIBRARIES})
list(APPEND REDREAM_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR})
list(APPEND REDREAM_LIBS ${OPENGL_LIBRARIES})
#--------------------------------------------------
@ -56,39 +56,39 @@ if(APPLE)
set(SDL_FRAMEWORK_CARBON 1)
endif()
add_subdirectory(deps/sdl2-2.0.3 EXCLUDE_FROM_ALL)
list(APPEND DREAVM_INCLUDE_DIRS deps/sdl2-2.0.3/include)
list(APPEND DREAVM_LIBS SDL2main SDL2-static)
list(APPEND REDREAM_INCLUDE_DIRS deps/sdl2-2.0.3/include)
list(APPEND REDREAM_LIBS SDL2main SDL2-static)
# eigen
list(APPEND DREAVM_DEFS EIGEN_DEFAULT_TO_ROW_MAJOR)
list(APPEND DREAVM_INCLUDE_DIRS deps/eigen-3.2.1)
list(APPEND REDREAM_DEFS EIGEN_DEFAULT_TO_ROW_MAJOR)
list(APPEND REDREAM_INCLUDE_DIRS deps/eigen-3.2.1)
# gflags
set(GFLAGS_NAMESPACE "google" CACHE STRING "")
add_subdirectory(deps/gflags-2.1.2 EXCLUDE_FROM_ALL)
list(APPEND DREAVM_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/deps/gflags-2.1.2/include)
list(APPEND DREAVM_LIBS gflags_nothreads-static)
list(APPEND REDREAM_INCLUDE_DIRS ${CMAKE_BINARY_DIR}/deps/gflags-2.1.2/include)
list(APPEND REDREAM_LIBS gflags_nothreads-static)
# glew
set(BUILD_UTILS OFF CACHE BOOL "")
add_subdirectory(deps/glew-1.13.0/build/cmake EXCLUDE_FROM_ALL)
list(APPEND DREAVM_INCLUDE_DIRS deps/glew-1.13.0/include)
list(APPEND DREAVM_LIBS glew_s)
list(APPEND REDREAM_INCLUDE_DIRS deps/glew-1.13.0/include)
list(APPEND REDREAM_LIBS glew_s)
# json11
add_library(json11 STATIC deps/json11/json11.cpp)
list(APPEND DREAVM_INCLUDE_DIRS deps/json11)
list(APPEND DREAVM_LIBS json11)
list(APPEND REDREAM_INCLUDE_DIRS deps/json11)
list(APPEND REDREAM_LIBS json11)
target_compile_options(json11 PRIVATE -std=c++11)
# microprofile
list(APPEND DREAVM_INCLUDE_DIRS deps/microprofile)
list(APPEND REDREAM_INCLUDE_DIRS deps/microprofile)
# stb_truetype
list(APPEND DREAVM_INCLUDE_DIRS deps/stb_truetype-1.0.5)
list(APPEND REDREAM_INCLUDE_DIRS deps/stb_truetype-1.0.5)
# xbyak
list(APPEND DREAVM_INCLUDE_DIRS deps/xbyak-4.85)
list(APPEND REDREAM_INCLUDE_DIRS deps/xbyak-4.85)
#--------------------------------------------------
@ -115,7 +115,7 @@ add_custom_target(tidy ${CLANG_TIDY_EXECUTABLE} -p=${CMAKE_CURRENT_BINARY_DIR}/c
# emulator
#--------------------------------------------------
set(DREAVM_SOURCES
set(REDREAM_SOURCES
src/core/assert.cc
src/core/log.cc
src/core/string.cc
@ -167,54 +167,54 @@ set(DREAVM_SOURCES
src/main.cc)
if(WIN32)
list(APPEND DREAVM_DEFS PLATFORM_WINDOWS=1)
list(APPEND DREAVM_SOURCES src/jit/backend/x64/x64_thunks_win.asm)
list(APPEND DREAVM_SOURCES src/sys/exception_handler_win.cc)
list(APPEND DREAVM_SOURCES src/sys/filesystem_win.cc)
list(APPEND DREAVM_SOURCES src/sys/memory_win.cc)
list(APPEND REDREAM_DEFS PLATFORM_WINDOWS=1)
list(APPEND REDREAM_SOURCES src/jit/backend/x64/x64_thunks_win.asm)
list(APPEND REDREAM_SOURCES src/sys/exception_handler_win.cc)
list(APPEND REDREAM_SOURCES src/sys/filesystem_win.cc)
list(APPEND REDREAM_SOURCES src/sys/memory_win.cc)
elseif(APPLE)
list(APPEND DREAVM_DEFS PLATFORM_DARWIN=1)
list(APPEND DREAVM_SOURCES src/jit/backend/x64/x64_thunks_posix.s)
list(APPEND DREAVM_SOURCES src/sys/exception_handler_mac.cc)
list(APPEND DREAVM_SOURCES src/sys/filesystem_posix.cc)
list(APPEND DREAVM_SOURCES src/sys/memory_posix.cc)
list(APPEND REDREAM_DEFS PLATFORM_DARWIN=1)
list(APPEND REDREAM_SOURCES src/jit/backend/x64/x64_thunks_posix.s)
list(APPEND REDREAM_SOURCES src/sys/exception_handler_mac.cc)
list(APPEND REDREAM_SOURCES src/sys/filesystem_posix.cc)
list(APPEND REDREAM_SOURCES src/sys/memory_posix.cc)
else()
list(APPEND DREAVM_DEFS PLATFORM_LINUX=1)
list(APPEND DREAVM_SOURCES src/jit/backend/x64/x64_thunks_posix.s)
list(APPEND DREAVM_SOURCES src/sys/exception_handler_linux.cc)
list(APPEND DREAVM_SOURCES src/sys/filesystem_posix.cc)
list(APPEND DREAVM_SOURCES src/sys/memory_posix.cc)
list(APPEND REDREAM_DEFS PLATFORM_LINUX=1)
list(APPEND REDREAM_SOURCES src/jit/backend/x64/x64_thunks_posix.s)
list(APPEND REDREAM_SOURCES src/sys/exception_handler_linux.cc)
list(APPEND REDREAM_SOURCES src/sys/filesystem_posix.cc)
list(APPEND REDREAM_SOURCES src/sys/memory_posix.cc)
endif()
# assign source groups for visual studio projects
source_group_by_dir(DREAVM_SOURCES)
source_group_by_dir(REDREAM_SOURCES)
if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
set(DREAVM_COMPILE_FLAGS -std=c++11 -fno-operator-names -fno-rtti -Wall -Wextra -Werror -Wno-unused-parameter -Wno-strict-aliasing)
set(REDREAM_COMPILE_FLAGS -std=c++11 -fno-operator-names -fno-rtti -Wall -Wextra -Werror -Wno-unused-parameter -Wno-strict-aliasing)
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILD_TYPE)
if(BUILD_TYPE STREQUAL "debug")
set(DREAVM_COMPILE_FLAGS ${DREAVM_COMPILE_FLAGS} -fno-omit-frame-pointer)
set(REDREAM_COMPILE_FLAGS ${REDREAM_COMPILE_FLAGS} -fno-omit-frame-pointer)
endif()
# used by shm_open / shm_unlink on linux
if(NOT WIN32 AND NOT APPLE)
list(APPEND DREAVM_LIBS rt)
list(APPEND REDREAM_LIBS rt)
endif()
else()
set(DREAVM_COMPILE_FLAGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN -DNOMINMAX /GR- /bigobj /W3 /WX /wd4100 /wd4127 /wd4505 /wd4512 /wd4800 /wd4351)
set(REDREAM_COMPILE_FLAGS -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN -DNOMINMAX /GR- /bigobj /W3 /WX /wd4100 /wd4127 /wd4505 /wd4512 /wd4800 /wd4351)
list(APPEND DREAVM_LIBS userenv ws2_32)
list(APPEND REDREAM_LIBS userenv ws2_32)
endif()
add_executable(dreavm ${DREAVM_SOURCES})
target_include_directories(dreavm SYSTEM PUBLIC ${DREAVM_INCLUDE_DIRS})
target_include_directories(dreavm PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(dreavm ${DREAVM_LIBS})
target_compile_definitions(dreavm PRIVATE ${DREAVM_DEFS})
target_compile_options(dreavm PRIVATE ${DREAVM_COMPILE_FLAGS})
add_executable(redream ${REDREAM_SOURCES})
target_include_directories(redream SYSTEM PUBLIC ${REDREAM_INCLUDE_DIRS})
target_include_directories(redream PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(redream ${REDREAM_LIBS})
target_compile_definitions(redream PRIVATE ${REDREAM_DEFS})
target_compile_options(redream PRIVATE ${REDREAM_COMPILE_FLAGS})
#--------------------------------------------------
@ -323,8 +323,8 @@ else()
endif()
# build test binary
set(DREAVM_TEST_SOURCES
${DREAVM_SOURCES}
set(REDREAM_TEST_SOURCES
${REDREAM_SOURCES}
test/test_interval_tree.cc
test/test_intrusive_list.cc
test/test_load_store_elimination_pass.cc
@ -332,13 +332,13 @@ set(DREAVM_TEST_SOURCES
test/test_ring_buffer.cc
test/test_sh4.cc
${asm_inc})
list(REMOVE_ITEM DREAVM_TEST_SOURCES src/main.cc)
list(REMOVE_ITEM REDREAM_TEST_SOURCES src/main.cc)
# assign source groups for visual studio projects
source_group_by_dir(DREAVM_TEST_SOURCES)
source_group_by_dir(REDREAM_TEST_SOURCES)
add_executable(dreavm_test ${DREAVM_TEST_SOURCES})
target_include_directories(dreavm_test PUBLIC deps/gtest-1.7.0/include src/ test/ ${DREAVM_INCLUDE_DIRS})
target_link_libraries(dreavm_test gtest gtest_main ${DREAVM_LIBS})
target_compile_definitions(dreavm_test PRIVATE DREAVM_TEST=1 ${DREAVM_DEFS})
target_compile_options(dreavm_test PRIVATE ${DREAVM_COMPILE_FLAGS})
add_executable(redream_test ${REDREAM_TEST_SOURCES})
target_include_directories(redream_test PUBLIC deps/gtest-1.7.0/include src/ test/ ${REDREAM_INCLUDE_DIRS})
target_link_libraries(redream_test gtest gtest_main ${REDREAM_LIBS})
target_compile_definitions(redream_test PRIVATE REDREAM_TEST=1 ${REDREAM_DEFS})
target_compile_options(redream_test PRIVATE ${REDREAM_COMPILE_FLAGS})

View File

@ -1,6 +1,6 @@
# dreavm
# redream
dreavm is a work in progress emulator for the SEGA Dreamcast.
redream is a work in progress emulator for the SEGA Dreamcast.
<p align="center">
<a href="http://www.youtube.com/watch?v=kDBAweW9hD0"><img src="http://share.gifyoutube.com/vMZXGb.gif" /></a>
@ -10,21 +10,21 @@ dreavm is a work in progress emulator for the SEGA Dreamcast.
Start by cloning the repository and setting up a build directory.
```shell
git clone https://github.com/inolen/dreavm.git
mkdir dreavm_build
cd dreavm_build
git clone https://github.com/inolen/redream.git
mkdir redream_build
cd redream_build
```
Next, generate a makefile or project file for your IDE of choice. For more info on the supported IDEs, checkout the [CMake documentation](http://www.cmake.org/cmake/help/latest/manual/cmake-generators.7.html).
```shell
# Makefile
cmake ../dreavm
cmake ../redream
# Xcode project
cmake -G "Xcode" ../dreavm
cmake -G "Xcode" ../redream
# Visual Studio project
cmake -G "Visual Studio 14 Win64" ../dreavm
cmake -G "Visual Studio 14 Win64" ../redream
```
Finally, you can either run `make` from the command line if you've generated a Makefile or load up the project file and compile the code from inside of your IDE.
@ -33,10 +33,10 @@ The build has been tested on OSX 10.10 with clang 3.6, Ubuntu 14.04 with GCC 4.9
## Running
```
dreavm --bios=path/to/dc_boot.bin --flash=path/to/dc_flash.bin <bin or gdi file>
redream --bios=path/to/dc_boot.bin --flash=path/to/dc_flash.bin <bin or gdi file>
```
Command line flags are loaded from and saved to `$HOME/.dreavm/flags` each run. This means that bios and flash path, etc. only need to be set on the first run.
Command line flags are loaded from and saved to `$HOME/.redream/flags` each run. This means that bios and flash path, etc. only need to be set on the first run.
### All options
```
@ -47,5 +47,5 @@ Command line flags are loaded from and saved to `$HOME/.dreavm/flags` each run.
## Running tests
```shell
dreavm_test
redream_test
```

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include "core/assert.h"
namespace dvm {
namespace re {
class Arena {
struct Chunk {

View File

@ -2,7 +2,7 @@
#include <stdio.h>
#include "core/assert.h"
namespace dvm {
namespace re {
const char *FormatCheckError(const char *filename, int linenum,
const char *expr, const char *format, ...) {

View File

@ -1,10 +1,10 @@
#ifndef DREAVM_ASSERT_H
#define DREAVM_ASSERT_H
#ifndef REDREAM_ASSERT_H
#define REDREAM_ASSERT_H
#include "core/debug_break.h"
#include "core/log.h"
namespace dvm {
namespace re {
// CHECK_* macros are usually true, hint this to the compiler if possible
#if defined(PLATFORM_LINUX) || defined(PLATFORM_DARWIN)

View File

@ -1,5 +1,5 @@
#ifndef DREAVM_CONFIG_H
#define DREAVM_CONFIG_H
#ifndef REDREAM_CONFIG_H
#define REDREAM_CONFIG_H
#cmakedefine HAVE_STRCASECMP
#cmakedefine HAVE_STRNSTR

View File

@ -8,7 +8,7 @@
#include "core/assert.h"
#include "core/intrusive_tree.h"
namespace dvm {
namespace re {
typedef uintptr_t interval_type;

View File

@ -6,7 +6,7 @@
#include <type_traits>
#include "core/assert.h"
namespace dvm {
namespace re {
// Objects are directly stored in the instrusive container, not copies. Due to
// this, the lifetime of the object is not bound to the container. It's up to

View File

@ -5,7 +5,7 @@
#include <stdlib.h>
#include "core/assert.h"
namespace dvm {
namespace re {
enum Color { RED = true, BLACK = false };

View File

@ -1,5 +1,5 @@
#ifndef DREAVM_LOG_H
#define DREAVM_LOG_H
#ifndef REDREAM_LOG_H
#define REDREAM_LOG_H
#include <stdlib.h>

View File

@ -1,9 +1,9 @@
#ifndef DREAVM_MATH_H
#define DREAVM_MATH_H
#ifndef REDREAM_MATH_H
#define REDREAM_MATH_H
#include <functional>
namespace dvm {
namespace re {
template <typename T>
T align(T v, T alignment) {

View File

@ -1,7 +1,7 @@
#ifndef DREAVM_MEMORY_H
#define DREAVM_MEMORY_H
#ifndef REDREAM_MEMORY_H
#define REDREAM_MEMORY_H
namespace dvm {
namespace re {
template <typename T>
T load(const void *ptr) {

View File

@ -8,7 +8,7 @@
// Min-max heap implementation, based on
// http://www.akira.ruc.dk/~keld/teaching/algoritmedesign_f03/Artikler/02../Atkinson86.pdf
namespace dvm {
namespace re {
template <typename T>
static inline bool mmheap_is_max_level(T index) {

View File

@ -4,7 +4,7 @@
#include <iterator>
#include "core/assert.h"
namespace dvm {
namespace re {
template <typename T>
class RingBuffer {

View File

@ -1,7 +1,7 @@
#include <string.h>
#include "core/string.h"
namespace dvm {
namespace re {
#ifndef HAVE_STRNSTR
char *strnstr(const char *s1, const char *s2, size_t n) {

View File

@ -1,12 +1,12 @@
#ifndef DREAVM_STRING_H
#define DREAVM_STRING_H
#ifndef REDREAM_STRING_H
#define REDREAM_STRING_H
#include <ctype.h>
#include <stdio.h>
#include <strings.h>
#include "core/config.h"
namespace dvm {
namespace re {
#ifndef HAVE_STRCASECMP
#define strcasecmp stricmp

View File

@ -1,7 +1,7 @@
#ifndef DEBUGGER_H
#define DEBUGGER_H
namespace dvm {
namespace re {
namespace emu {
class Debugger {

View File

@ -11,14 +11,14 @@
#include "renderer/gl_backend.h"
#include "trace/trace.h"
using namespace dvm;
using namespace dvm::emu;
using namespace dvm::hw;
using namespace dvm::hw::gdrom;
using namespace dvm::hw::holly;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace dvm::trace;
using namespace re;
using namespace re::emu;
using namespace re::hw;
using namespace re::hw::gdrom;
using namespace re::hw::holly;
using namespace re::renderer;
using namespace re::sys;
using namespace re::trace;
DEFINE_string(bios, "dc_boot.bin", "Path to BIOS");
DEFINE_string(flash, "dc_flash.bin", "Path to flash ROM");

View File

@ -8,7 +8,7 @@
#include "renderer/backend.h"
#include "sys/window.h"
namespace dvm {
namespace re {
namespace emu {
class Emulator {

View File

@ -13,9 +13,9 @@
#include <string>
#include "emu/profiler.h"
using namespace dvm::emu;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace re::emu;
using namespace re::renderer;
using namespace re::sys;
static Backend *current_backend = nullptr;

View File

@ -6,17 +6,17 @@
#include "sys/keycode.h"
#define PROFILER_SCOPE(group, name) \
MICROPROFILE_SCOPEI(group, name, dvm::emu::Profiler::ScopeColor(name))
MICROPROFILE_SCOPEI(group, name, re::emu::Profiler::ScopeColor(name))
#define PROFILER_GPU(name) \
MICROPROFILE_SCOPEI("gpu", name, dvm::emu::Profiler::ScopeColor(name))
MICROPROFILE_SCOPEI("gpu", name, re::emu::Profiler::ScopeColor(name))
#define PROFILER_RUNTIME(name) \
MICROPROFILE_SCOPEI("runtime", name, dvm::emu::Profiler::ScopeColor(name))
MICROPROFILE_SCOPEI("runtime", name, re::emu::Profiler::ScopeColor(name))
#define PROFILER_COUNT(name, count) MICROPROFILE_COUNTER_SET(name, count)
namespace dvm {
namespace re {
namespace emu {
class Profiler {

View File

@ -2,9 +2,9 @@
#include "hw/aica/aica.h"
#include "hw/dreamcast.h"
using namespace dvm::hw;
using namespace dvm::hw::aica;
using namespace dvm::hw::holly;
using namespace re::hw;
using namespace re::hw::aica;
using namespace re::hw::holly;
AICA::AICA(Dreamcast *dc) : dc_(dc) {}
@ -17,8 +17,8 @@ bool AICA::Init() {
// frequency 22579200
// int AICA::Run(int cycles) {
// // uint16_t MCIEB = dvm::load<uint16_t>(&aica_regs_[MCIEB_OFFSET]);
// // uint16_t MCIPD = dvm::load<uint16_t>(&aica_regs_[MCIPD_OFFSET]);
// // uint16_t MCIEB = re::load<uint16_t>(&aica_regs_[MCIEB_OFFSET]);
// // uint16_t MCIPD = re::load<uint16_t>(&aica_regs_[MCIPD_OFFSET]);
// // if (MCIEB || MCIPD) {
// // LOG_INFO("0x%x & 0x%x", MCIEB, MCIPD);
@ -31,13 +31,13 @@ bool AICA::Init() {
// uint32_t AICA::ReadRegister(void *ctx, uint32_t addr) {
// AICA *self = reinterpret_cast<AICA *>(ctx);
// // LOG_INFO("AICA::ReadRegister32 0x%x", addr);
// return dvm::load<uint32_t>(&self->aica_regs_[addr]);
// return re::load<uint32_t>(&self->aica_regs_[addr]);
// }
// void AICA::WriteRegister(void *ctx, uint32_t addr, uint32_t value) {
// AICA *self = reinterpret_cast<AICA *>(ctx);
// // LOG_INFO("AICA::WriteRegister32 0x%x", addr);
// dvm::store(&self->aica_regs_[addr], value);
// re::store(&self->aica_regs_[addr], value);
// }
template uint8_t AICA::ReadWave(void *ctx, uint32_t addr);
@ -58,7 +58,7 @@ T AICA::ReadWave(void *ctx, uint32_t addr) {
}
}
return dvm::load<T>(&self->wave_ram_[addr]);
return re::load<T>(&self->wave_ram_[addr]);
}
template void AICA::WriteWave(void *ctx, uint32_t addr, uint8_t value);
@ -67,5 +67,5 @@ template void AICA::WriteWave(void *ctx, uint32_t addr, uint32_t value);
template <typename T>
void AICA::WriteWave(void *ctx, uint32_t addr, T value) {
AICA *self = reinterpret_cast<AICA *>(ctx);
dvm::store(&self->wave_ram_[addr], value);
re::store(&self->wave_ram_[addr], value);
}

View File

@ -3,7 +3,7 @@
#include <stdint.h>
namespace dvm {
namespace re {
namespace hw {
struct Dreamcast;

View File

@ -12,19 +12,19 @@
#include "renderer/backend.h"
#include "trace/trace.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::hw::aica;
using namespace dvm::hw::gdrom;
using namespace dvm::hw::holly;
using namespace dvm::hw::maple;
using namespace dvm::hw::sh4;
using namespace dvm::jit;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace dvm::trace;
using namespace re;
using namespace re::hw;
using namespace re::hw::aica;
using namespace re::hw::gdrom;
using namespace re::hw::holly;
using namespace re::hw::maple;
using namespace re::hw::sh4;
using namespace re::jit;
using namespace re::renderer;
using namespace re::sys;
using namespace re::trace;
namespace dvm {
namespace re {
namespace hw {
// clang-format off

View File

@ -6,7 +6,7 @@
#include "hw/holly/pvr2.h"
#include "hw/sh4/sh4.h"
namespace dvm {
namespace re {
namespace renderer {
class Backend;

View File

@ -3,9 +3,9 @@
#define PREGAP_SIZE 150
using namespace dvm;
using namespace dvm::hw::gdrom;
using namespace dvm::sys;
using namespace re;
using namespace re::hw::gdrom;
using namespace re::sys;
//
// GDI format

View File

@ -4,7 +4,7 @@
#include <vector>
#include "sys/filesystem.h"
namespace dvm {
namespace re {
namespace hw {
namespace gdrom {

View File

@ -3,11 +3,11 @@
#include "hw/dreamcast.h"
#include "hw/memory.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::hw::gdrom;
using namespace dvm::hw::holly;
using namespace dvm::hw::sh4;
using namespace re;
using namespace re::hw;
using namespace re::hw::gdrom;
using namespace re::hw::holly;
using namespace re::hw::sh4;
#define SWAP_24(fad) \
(((fad & 0xff) << 16) | (fad & 0x00ff00) | ((fad & 0xff0000) >> 16))

View File

@ -4,7 +4,7 @@
#include <memory>
#include "hw/gdrom/disc.h"
namespace dvm {
namespace re {
namespace hw {
namespace holly {
class Holly;

View File

@ -3,14 +3,14 @@
#include "hw/maple/maple.h"
#include "hw/dreamcast.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::hw::gdrom;
using namespace dvm::hw::holly;
using namespace dvm::hw::maple;
using namespace dvm::hw::sh4;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace re;
using namespace re::hw;
using namespace re::hw::gdrom;
using namespace re::hw::holly;
using namespace re::hw::maple;
using namespace re::hw::sh4;
using namespace re::renderer;
using namespace re::sys;
Holly::Holly(Dreamcast *dc) : dc_(dc) {}

View File

@ -3,7 +3,7 @@
#include <stdint.h>
namespace dvm {
namespace re {
namespace hw {
namespace gdrom {
class GDROM;

View File

@ -18,7 +18,7 @@
(((TWIDTAB(x & (min - 1)) << 1) | TWIDTAB(y & (min - 1))) + \
(x / min + y / min) * min * min)
namespace dvm {
namespace re {
namespace hw {
namespace holly {
@ -216,7 +216,7 @@ class PixelConvert {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
int palette_idx = src[TWIDIDX(x, y, min)];
auto entry = dvm::load<typename FROM::data_type>(&palette[palette_idx]);
auto entry = re::load<typename FROM::data_type>(&palette[palette_idx]);
FROM::Read(entry, &r, &g, &b, &a);
TO::Write(dst++, r, g, b, a);
}
@ -233,7 +233,7 @@ class PixelConvert {
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
int tidx = TWIDIDX(x, y, min);
auto code = dvm::load<typename FROM::data_type>(
auto code = re::load<typename FROM::data_type>(
&codebook[index[tidx / 4] * 8 + ((tidx % 4) * 2)]);
FROM::Read(code, &r, &g, &b, &a);
TO::Write(dst++, r, g, b, a);

View File

@ -3,10 +3,10 @@
#include "hw/holly/tile_accelerator.h"
#include "hw/dreamcast.h"
using namespace dvm::hw;
using namespace dvm::hw::holly;
using namespace dvm::hw::sh4;
using namespace dvm::renderer;
using namespace re::hw;
using namespace re::hw::holly;
using namespace re::hw::sh4;
using namespace re::renderer;
PVR2::PVR2(Dreamcast *dc)
: dc_(dc), line_timer_(INVALID_TIMER), current_scanline_(0), rps_(0.0f) {}
@ -120,7 +120,7 @@ T PVR2::ReadVRamInterleaved(void *ctx, uint32_t addr) {
addr = MAP64(addr);
return dvm::load<T>(&self->video_ram_[addr]);
return re::load<T>(&self->video_ram_[addr]);
}
template void PVR2::WriteVRamInterleaved(void *ctx, uint32_t addr,
@ -133,7 +133,7 @@ void PVR2::WriteVRamInterleaved(void *ctx, uint32_t addr, T value) {
addr = MAP64(addr);
dvm::store(&self->video_ram_[addr], value);
re::store(&self->video_ram_[addr], value);
}
void PVR2::ReconfigureSPG() {

View File

@ -4,7 +4,7 @@
#include <stdint.h>
#include "hw/scheduler.h"
namespace dvm {
namespace re {
namespace hw {
struct Dreamcast;
struct Register;

View File

@ -3,12 +3,12 @@ PVR_REG(0x005f8004, REVISION, R, 0x00000011, uint32_t)
PVR_REG(0x005f8008, SOFTRESET, RW, 0x00000007, uint32_t)
PVR_REG(0x005f8014, STARTRENDER, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8018, TEST_SELECT, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8020, PARAM_BASE, RW, 0x00000000, dvm::hw::holly::PARAM_BASE_T)
PVR_REG(0x005f8020, PARAM_BASE, RW, 0x00000000, re::hw::holly::PARAM_BASE_T)
PVR_REG(0x005f802c, REGION_BASE, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8030, SPAN_SORT_CFG, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8040, VO_BORDER_COL, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8044, FB_R_CTRL, RW, 0x00000000, dvm::hw::holly::FB_R_CTRL_T)
PVR_REG(0x005f8048, FB_W_CTRL, RW, 0x00000000, dvm::hw::holly::FB_W_CTRL_T)
PVR_REG(0x005f8044, FB_R_CTRL, RW, 0x00000000, re::hw::holly::FB_R_CTRL_T)
PVR_REG(0x005f8048, FB_W_CTRL, RW, 0x00000000, re::hw::holly::FB_W_CTRL_T)
PVR_REG(0x005f804c, FB_W_LINESTRIDE, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8050, FB_R_SOF1, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8054, FB_R_SOF2, RW, 0x00000000, uint32_t)
@ -17,14 +17,14 @@ PVR_REG(0x005f8060, FB_W_SOF1, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8064, FB_W_SOF2, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8068, FB_X_CLIP, RW, 0x00000000, uint32_t)
PVR_REG(0x005f806c, FB_Y_CLIP, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8074, FPU_SHAD_SCALE, RW, 0x00000000, dvm::hw::holly::FPU_SHAD_SCALE_T)
PVR_REG(0x005f8074, FPU_SHAD_SCALE, RW, 0x00000000, re::hw::holly::FPU_SHAD_SCALE_T)
PVR_REG(0x005f8078, FPU_CULL_VAL, RW, 0x00000000, uint32_t)
PVR_REG(0x005f807c, FPU_PARAM_CFG, RW, 0x0007df77, dvm::hw::holly::FPU_PARAM_CFG_T)
PVR_REG(0x005f807c, FPU_PARAM_CFG, RW, 0x0007df77, re::hw::holly::FPU_PARAM_CFG_T)
PVR_REG(0x005f8080, HALF_OFFSET, RW, 0x00000007, uint32_t)
PVR_REG(0x005f8084, FPU_PERP_VAL, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8088, ISP_BACKGND_D, RW, 0x00000000, uint32_t)
PVR_REG(0x005f808c, ISP_BACKGND_T, RW, 0x00000000, dvm::hw::holly::ISP_BACKGND_T_T)
PVR_REG(0x005f8098, ISP_FEED_CFG, RW, 0x00402000, dvm::hw::holly::ISP_FEED_CFG_T)
PVR_REG(0x005f808c, ISP_BACKGND_T, RW, 0x00000000, re::hw::holly::ISP_BACKGND_T_T)
PVR_REG(0x005f8098, ISP_FEED_CFG, RW, 0x00402000, re::hw::holly::ISP_FEED_CFG_T)
PVR_REG(0x005f80a0, SDRAM_REFRESH, RW, 0x00000020, uint32_t)
PVR_REG(0x005f80a4, SDRAM_ARB_CFG, RW, 0x0000001f, uint32_t)
PVR_REG(0x005f80a8, SDRAM_CFG, RW, 0x15f28997, uint32_t)
@ -34,26 +34,26 @@ PVR_REG(0x005f80b8, FOG_DENSITY, RW, 0x00000000, uint32_t)
PVR_REG(0x005f80bc, FOG_CLAMP_MAX, RW, 0x00000000, uint32_t)
PVR_REG(0x005f80c0, FOG_CLAMP_MIN, RW, 0x00000000, uint32_t)
PVR_REG(0x005f80c4, SPG_TRIGGER_POS, RW, 0x00000000, uint32_t)
PVR_REG(0x005f80c8, SPG_HBLANK_INT, RW, 0x031d0000, dvm::hw::holly::SPG_HBLANK_INT_T)
PVR_REG(0x005f80cc, SPG_VBLANK_INT, RW, 0x01500104, dvm::hw::holly::SPG_VBLANK_INT_T)
PVR_REG(0x005f80d0, SPG_CONTROL, RW, 0x00000000, dvm::hw::holly::SPG_CONTROL_T)
PVR_REG(0x005f80c8, SPG_HBLANK_INT, RW, 0x031d0000, re::hw::holly::SPG_HBLANK_INT_T)
PVR_REG(0x005f80cc, SPG_VBLANK_INT, RW, 0x01500104, re::hw::holly::SPG_VBLANK_INT_T)
PVR_REG(0x005f80d0, SPG_CONTROL, RW, 0x00000000, re::hw::holly::SPG_CONTROL_T)
PVR_REG(0x005f80d4, SPG_HBLANK, RW, 0x007e0345, uint32_t)
PVR_REG(0x005f80d8, SPG_LOAD, RW, 0x01060359, dvm::hw::holly::SPG_LOAD_T)
PVR_REG(0x005f80dc, SPG_VBLANK, RW, 0x01500104, dvm::hw::holly::SPG_VBLANK_T)
PVR_REG(0x005f80d8, SPG_LOAD, RW, 0x01060359, re::hw::holly::SPG_LOAD_T)
PVR_REG(0x005f80dc, SPG_VBLANK, RW, 0x01500104, re::hw::holly::SPG_VBLANK_T)
PVR_REG(0x005f80e0, SPG_WIDTH, RW, 0x07f1933f, uint32_t)
PVR_REG(0x005f80e4, TEXT_CONTROL, RW, 0x00000000, dvm::hw::holly::TEXT_CONTROL_T)
PVR_REG(0x005f80e4, TEXT_CONTROL, RW, 0x00000000, re::hw::holly::TEXT_CONTROL_T)
PVR_REG(0x005f80e8, VO_CONTROL, RW, 0x00000108, uint32_t)
PVR_REG(0x005f80ec, VO_STARTX, RW, 0x0000009d, uint32_t)
PVR_REG(0x005f80f0, VO_STARTY, RW, 0x00000015, uint32_t)
PVR_REG(0x005f80f4, SCALER_CTL, RW, 0x00000400, uint32_t)
PVR_REG(0x005f8108, PAL_RAM_CTRL, RW, 0x00000000, dvm::hw::holly::PAL_RAM_CTRL_T)
PVR_REG(0x005f810c, SPG_STATUS, R, 0x00000000, dvm::hw::holly::SPG_STATUS_T)
PVR_REG(0x005f8108, PAL_RAM_CTRL, RW, 0x00000000, re::hw::holly::PAL_RAM_CTRL_T)
PVR_REG(0x005f810c, SPG_STATUS, R, 0x00000000, re::hw::holly::SPG_STATUS_T)
PVR_REG(0x005f8110, FB_BURSTCTRL, RW, 0x00090639, uint32_t)
PVR_REG(0x005f8114, FB_C_SOF, R, 0x00000000, uint32_t)
PVR_REG(0x005f8118, Y_COEFF, RW, 0x00000000, uint32_t)
PVR_REG(0x005f811c, PT_ALPHA_REF, RW, 0x000000ff, uint32_t)
PVR_REG(0x005f8124, TA_OL_BASE, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8128, TA_ISP_BASE, RW, 0x00000000, dvm::hw::holly::TA_ISP_BASE_T)
PVR_REG(0x005f8128, TA_ISP_BASE, RW, 0x00000000, re::hw::holly::TA_ISP_BASE_T)
PVR_REG(0x005f812c, TA_OL_LIMIT, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8130, TA_ISP_LIMIT, RW, 0x00000000, uint32_t)
PVR_REG(0x005f8134, TA_NEXT_OPB, R, 0x00000000, uint32_t)

View File

@ -4,10 +4,10 @@
#include "hw/dreamcast.h"
#include "trace/trace.h"
using namespace dvm::hw;
using namespace dvm::hw::holly;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace re::hw;
using namespace re::hw::holly;
using namespace re::renderer;
using namespace re::sys;
TextureCache::TextureCache(Dreamcast *dc)
: dc_(dc), trace_writer_(nullptr), num_invalidated_(0) {}

View File

@ -8,7 +8,7 @@
#include "hw/memory.h"
#include "renderer/backend.h"
namespace dvm {
namespace re {
namespace trace {
class TraceWriter;
}

View File

@ -5,11 +5,11 @@
#include "hw/memory.h"
#include "trace/trace.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::hw::holly;
using namespace dvm::renderer;
using namespace dvm::trace;
using namespace re;
using namespace re::hw;
using namespace re::hw::holly;
using namespace re::renderer;
using namespace re::trace;
static void BuildLookupTables();
static int GetParamSize_raw(const PCW &pcw, int vertex_type);
@ -267,7 +267,7 @@ void TileAccelerator::WriteContext(uint32_t addr, uint32_t value) {
// completely received or not
if (tactx->size % 32 == 0) {
void *data = &tactx->data[tactx->cursor];
PCW pcw = dvm::load<PCW>(data);
PCW pcw = re::load<PCW>(data);
int size = GetParamSize(pcw, tactx->vertex_type);
int recv = tactx->size - tactx->cursor;
@ -358,7 +358,7 @@ void TileAccelerator::WriteTexture(void *ctx, uint32_t addr, uint32_t value) {
addr &= 0xeeffffff;
dvm::store(&self->video_ram_[addr], value);
re::store(&self->video_ram_[addr], value);
}
void TileAccelerator::WritePVRState(TileContext *tactx) {
@ -407,7 +407,7 @@ void TileAccelerator::WriteBackgroundState(TileContext *tactx) {
vram_offset += 12;
// get the background depth
tactx->bg_depth = dvm::load<float>(&dc_->ISP_BACKGND_D);
tactx->bg_depth = re::load<float>(&dc_->ISP_BACKGND_D);
// get the byte size for each vertex. normally, the byte size is
// ISP_BACKGND_T.skip + 3, but if parameter selection volume mode is in

View File

@ -7,7 +7,7 @@
#include "hw/holly/tile_renderer.h"
#include "renderer/backend.h"
namespace dvm {
namespace re {
namespace trace {
class TraceWriter;
}

View File

@ -4,8 +4,8 @@
#include "hw/holly/tile_accelerator.h"
#include "hw/holly/tile_renderer.h"
using namespace dvm::hw::holly;
using namespace dvm::renderer;
using namespace re::hw::holly;
using namespace re::renderer;
static int compressed_mipmap_offsets[] = {
0x00006, // 8 x 8
@ -253,26 +253,26 @@ void TileRenderer::ParseBackground(const TileContext *tactx) {
for (int i = 0; i < 3; i++) {
Vertex *v = verts[i] = AllocVert();
v->xyz[0] = dvm::load<float>(&tactx->bg_vertices[offset]);
v->xyz[1] = dvm::load<float>(&tactx->bg_vertices[offset + 4]);
v->xyz[2] = dvm::load<float>(&tactx->bg_vertices[offset + 8]);
v->xyz[0] = re::load<float>(&tactx->bg_vertices[offset]);
v->xyz[1] = re::load<float>(&tactx->bg_vertices[offset + 4]);
v->xyz[2] = re::load<float>(&tactx->bg_vertices[offset + 8]);
offset += 12;
if (tactx->bg_isp.texture) {
LOG_FATAL("Unhandled");
// v->uv[0] = dvm::load<float>(&tactx->bg_vertices[offset]);
// v->uv[1] = dvm::load<float>(&tactx->bg_vertices[offset + 4]);
// v->uv[0] = re::load<float>(&tactx->bg_vertices[offset]);
// v->uv[1] = re::load<float>(&tactx->bg_vertices[offset + 4]);
// offset += 8;
}
uint32_t base_color = dvm::load<uint32_t>(&tactx->bg_vertices[offset]);
uint32_t base_color = re::load<uint32_t>(&tactx->bg_vertices[offset]);
v->color = abgr_to_rgba(base_color);
offset += 4;
if (tactx->bg_isp.offset) {
LOG_FATAL("Unhandled");
// uint32_t offset_color =
// dvm::load<uint32_t>(&tactx->bg_vertices[offset]);
// re::load<uint32_t>(&tactx->bg_vertices[offset]);
// v->offset_color[0] = ((offset_color >> 16) & 0xff) / 255.0f;
// v->offset_color[1] = ((offset_color >> 16) & 0xff) / 255.0f;
// v->offset_color[2] = ((offset_color >> 16) & 0xff) / 255.0f;
@ -457,8 +457,8 @@ void TileRenderer::ParseVertexParam(const TileContext *tactx,
ParseOffsetColor(param->type4.offset_color, &vert->offset_color);
uint32_t u = param->type4.uv[0] << 16;
uint32_t v = param->type4.uv[0] << 16;
vert->uv[0] = dvm::load<float>(&u);
vert->uv[1] = dvm::load<float>(&v);
vert->uv[0] = re::load<float>(&u);
vert->uv[1] = re::load<float>(&v);
} break;
case 5: {
@ -489,8 +489,8 @@ void TileRenderer::ParseVertexParam(const TileContext *tactx,
&vert->offset_color);
uint32_t u = param->type6.uv[0] << 16;
uint32_t v = param->type6.uv[0] << 16;
vert->uv[0] = dvm::load<float>(&u);
vert->uv[1] = dvm::load<float>(&v);
vert->uv[0] = re::load<float>(&u);
vert->uv[1] = re::load<float>(&v);
} break;
case 7: {
@ -513,8 +513,8 @@ void TileRenderer::ParseVertexParam(const TileContext *tactx,
ParseOffsetColor(param->type8.offset_intensity, &vert->offset_color);
uint32_t u = param->type8.uv[0] << 16;
uint32_t v = param->type8.uv[0] << 16;
vert->uv[0] = dvm::load<float>(&u);
vert->uv[1] = dvm::load<float>(&v);
vert->uv[0] = re::load<float>(&u);
vert->uv[1] = re::load<float>(&v);
} break;
case 15:
@ -543,8 +543,8 @@ void TileRenderer::ParseVertexParam(const TileContext *tactx,
u = (param->sprite1.uv[i] & 0xffff0000);
v = (param->sprite1.uv[i] & 0x0000ffff) << 16;
}
vert->uv[0] = dvm::load<float>(&u);
vert->uv[1] = dvm::load<float>(&v);
vert->uv[0] = re::load<float>(&u);
vert->uv[1] = re::load<float>(&v);
};
ParseSpriteVert(0, AllocVert());

View File

@ -5,7 +5,7 @@
#include <Eigen/Dense>
#include "renderer/backend.h"
namespace dvm {
namespace re {
namespace hw {
namespace holly {

View File

@ -3,12 +3,12 @@
#include "hw/dreamcast.h"
#include "hw/memory.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::hw::holly;
using namespace dvm::hw::maple;
using namespace dvm::hw::sh4;
using namespace dvm::sys;
using namespace re;
using namespace re::hw;
using namespace re::hw::holly;
using namespace re::hw::maple;
using namespace re::hw::sh4;
using namespace re::sys;
Maple::Maple(Dreamcast *dc) : dc_(dc), devices_() {
// default controller device

View File

@ -4,7 +4,7 @@
#include <memory>
#include "sys/keycode.h"
namespace dvm {
namespace re {
namespace hw {
namespace holly {
class Holly;

View File

@ -5,8 +5,8 @@
#include "core/log.h"
#include "hw/maple/maple_controller.h"
using namespace dvm::hw::maple;
using namespace dvm::sys;
using namespace re::hw::maple;
using namespace re::sys;
using namespace json11;
DEFINE_string(profile, "", "Controller profile");

View File

@ -3,7 +3,7 @@
#include "hw/maple/maple.h"
namespace dvm {
namespace re {
namespace hw {
namespace maple {

View File

@ -1,9 +1,9 @@
#include "core/memory.h"
#include "hw/memory.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::sys;
using namespace re;
using namespace re::hw;
using namespace re::sys;
static inline bool PageAligned(uint32_t start, uint32_t size) {
return (start & (PAGE_OFFSET_BITS - 1)) == 0 &&
@ -199,7 +199,7 @@ void Memory::Lookup(uint32_t virtual_addr, uint8_t **ptr, MemoryRegion **region,
bool Memory::CreateSharedMemory() {
// create the shared memory object to back the address space
shmem_ = ::CreateSharedMemory("/dreavm", ADDRESS_SPACE_SIZE, ACC_READWRITE);
shmem_ = ::CreateSharedMemory("/redream", ADDRESS_SPACE_SIZE, ACC_READWRITE);
if (shmem_ == SHMEM_INVALID) {
LOG_WARNING("Failed to create shared memory object");
@ -543,7 +543,7 @@ inline INT Memory::ReadBytes(uint32_t addr) {
DCHECK(page);
if (IsStaticRegion(page)) {
return dvm::load<INT>(RegionPointer(page) + page_offset);
return re::load<INT>(RegionPointer(page) + page_offset);
}
MemoryRegion &region = regions_[RegionIndex(page)];
@ -563,7 +563,7 @@ inline void Memory::WriteBytes(uint32_t addr, INT value) {
DCHECK(page);
if (IsStaticRegion(page)) {
dvm::store(RegionPointer(page) + page_offset, value);
re::store(RegionPointer(page) + page_offset, value);
return;
}

View File

@ -4,7 +4,7 @@
#include "sys/exception_handler.h"
#include "sys/memory.h"
namespace dvm {
namespace re {
namespace hw {
typedef uint8_t RegionHandle;

View File

@ -1,7 +1,7 @@
#include "core/assert.h"
#include "hw/scheduler.h"
using namespace dvm::hw;
using namespace re::hw;
Scheduler::Scheduler()
: base_time_(), timers_(), num_timers_(0), next_handle_(0) {}

View File

@ -4,7 +4,7 @@
#include <chrono>
#include <functional>
namespace dvm {
namespace re {
namespace hw {
enum {

View File

@ -6,12 +6,12 @@
#include "hw/memory.h"
#include "hw/scheduler.h"
using namespace dvm;
using namespace dvm::emu;
using namespace dvm::hw;
using namespace dvm::hw::sh4;
using namespace dvm::jit;
using namespace dvm::jit::frontend::sh4;
using namespace re;
using namespace re::emu;
using namespace re::hw;
using namespace re::hw::sh4;
using namespace re::jit;
using namespace re::jit::frontend::sh4;
static InterruptInfo interrupts[NUM_INTERRUPTS] = {
#define SH4_INT(name, intevt, pri, ipr, ipr_shift) \
@ -298,7 +298,7 @@ T SH4::ReadCache(void *ctx, uint32_t addr) {
SH4 *self = reinterpret_cast<SH4 *>(ctx);
CHECK_EQ(self->CCR.ORA, 1u);
addr = CACHE_OFFSET(addr, self->CCR.OIX);
return dvm::load<T>(&self->cache_[addr]);
return re::load<T>(&self->cache_[addr]);
}
template void SH4::WriteCache(void *ctx, uint32_t addr, uint8_t value);
@ -310,7 +310,7 @@ void SH4::WriteCache(void *ctx, uint32_t addr, T value) {
SH4 *self = reinterpret_cast<SH4 *>(ctx);
CHECK_EQ(self->CCR.ORA, 1u);
addr = CACHE_OFFSET(addr, self->CCR.OIX);
dvm::store(&self->cache_[addr], value);
re::store(&self->cache_[addr], value);
}
template uint8_t SH4::ReadSQ(void *ctx, uint32_t addr);
@ -449,7 +449,7 @@ void SH4::ReprioritizeInterrupts() {
// get current priority for interrupt
int priority = int_info.default_priority;
if (int_info.ipr) {
uint16_t v = dvm::load<uint16_t>(&area7_[int_info.ipr]);
uint16_t v = re::load<uint16_t>(&area7_[int_info.ipr]);
priority = (v >> int_info.ipr_shift) & 0xf;
}
@ -488,7 +488,7 @@ inline void SH4::CheckPendingInterrupts() {
}
// process the highest priority in the pending vector
int n = 63 - dvm::clz(pending_interrupts_);
int n = 63 - re::clz(pending_interrupts_);
Interrupt intr = sorted_interrupts_[n];
InterruptInfo &int_info = interrupts[intr];

View File

@ -7,7 +7,7 @@
struct SH4Test;
namespace dvm {
namespace re {
namespace hw {
struct Dreamcast;

View File

@ -10,16 +10,16 @@
#include "jit/ir/passes/register_allocation_pass.h"
#include "jit/ir/passes/validate_pass.h"
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::backend;
using namespace dvm::jit::backend::interpreter;
using namespace dvm::jit::backend::x64;
using namespace dvm::jit::frontend;
using namespace dvm::jit::frontend::sh4;
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace dvm::sys;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::backend;
using namespace re::jit::backend::interpreter;
using namespace re::jit::backend::x64;
using namespace re::jit::frontend;
using namespace re::jit::frontend::sh4;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
using namespace re::sys;
DEFINE_bool(interpreter, false, "Use interpreter");

View File

@ -6,7 +6,7 @@
#include "jit/ir/passes/pass_runner.h"
#include "sys/exception_handler.h"
namespace dvm {
namespace re {
namespace hw {
class Memory;

View File

@ -6,7 +6,7 @@
#include "jit/ir/ir_builder.h"
#include "jit/source_map.h"
namespace dvm {
namespace re {
namespace sys {
struct Exception;
}

View File

@ -3,15 +3,15 @@
#include "jit/backend/interpreter/interpreter_emitter.h"
#include "sys/exception_handler.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::backend;
using namespace dvm::jit::backend::interpreter;
using namespace dvm::jit::ir;
using namespace dvm::sys;
using namespace re;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::backend;
using namespace re::jit::backend::interpreter;
using namespace re::jit::ir;
using namespace re::sys;
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace interpreter {

View File

@ -4,7 +4,7 @@
#include "jit/backend/backend.h"
#include "jit/backend/interpreter/interpreter_emitter.h"
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace interpreter {

View File

@ -16,7 +16,7 @@
#define REP_4096(l, x, r) REP_2048(l, x, r), REP_2048(l, x + 2048, r)
#define REP_8192(l, x, r) REP_4096(l, x, r), REP_4096(l, x + 4096, r)
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace interpreter {

View File

@ -1,7 +1,7 @@
#ifndef INTERPRETER_BLOCK_H
#define INTERPRETER_BLOCK_H
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace interpreter {

View File

@ -4,11 +4,11 @@
#include "jit/backend/interpreter/interpreter_backend.h"
#include "jit/backend/interpreter/interpreter_emitter.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::backend::interpreter;
using namespace dvm::jit::ir;
using namespace re;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::backend::interpreter;
using namespace re::jit::ir;
static IntFn GetCallback(Instr &ir_i);
@ -259,54 +259,54 @@ template <typename T>
static inline T GetLocal(int offset);
template <>
inline int8_t GetLocal(int offset) {
return dvm::load<int8_t>(&int_state.stack[int_state.sp + offset]);
return re::load<int8_t>(&int_state.stack[int_state.sp + offset]);
}
template <>
inline int16_t GetLocal(int offset) {
return dvm::load<int16_t>(&int_state.stack[int_state.sp + offset]);
return re::load<int16_t>(&int_state.stack[int_state.sp + offset]);
}
template <>
inline int32_t GetLocal(int offset) {
return dvm::load<int32_t>(&int_state.stack[int_state.sp + offset]);
return re::load<int32_t>(&int_state.stack[int_state.sp + offset]);
}
template <>
inline int64_t GetLocal(int offset) {
return dvm::load<int64_t>(&int_state.stack[int_state.sp + offset]);
return re::load<int64_t>(&int_state.stack[int_state.sp + offset]);
}
template <>
inline float GetLocal(int offset) {
return dvm::load<float>(&int_state.stack[int_state.sp + offset]);
return re::load<float>(&int_state.stack[int_state.sp + offset]);
}
template <>
inline double GetLocal(int offset) {
return dvm::load<double>(&int_state.stack[int_state.sp + offset]);
return re::load<double>(&int_state.stack[int_state.sp + offset]);
}
template <typename T>
static inline void SetLocal(int offset, T v);
template <>
inline void SetLocal(int offset, int8_t v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <>
inline void SetLocal(int offset, int16_t v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <>
inline void SetLocal(int offset, int32_t v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <>
inline void SetLocal(int offset, int64_t v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <>
inline void SetLocal(int offset, float v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <>
inline void SetLocal(int offset, double v) {
dvm::store(&int_state.stack[int_state.sp + offset], v);
re::store(&int_state.stack[int_state.sp + offset], v);
}
template <typename T, int ARG, int ACC>
@ -344,33 +344,33 @@ struct helper<T, ARG, ACC_IMM> {
//
INT_CALLBACK(LOAD_HOST_I8) {
uint64_t addr = LOAD_ARG0();
R v = dvm::load<int8_t>(reinterpret_cast<void *>(addr));
R v = re::load<int8_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(v);
}
INT_CALLBACK(LOAD_HOST_I16) {
uint64_t addr = LOAD_ARG0();
R v = dvm::load<int16_t>(reinterpret_cast<void *>(addr));
R v = re::load<int16_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(v);
}
INT_CALLBACK(LOAD_HOST_I32) {
uint64_t addr = LOAD_ARG0();
R v = dvm::load<int32_t>(reinterpret_cast<void *>(addr));
R v = re::load<int32_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(v);
}
INT_CALLBACK(LOAD_HOST_I64) {
uint64_t addr = LOAD_ARG0();
R v = dvm::load<int64_t>(reinterpret_cast<void *>(addr));
R v = re::load<int64_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(v);
}
INT_CALLBACK(LOAD_HOST_F32) {
uint64_t addr = LOAD_ARG0();
int32_t v = dvm::load<int32_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(dvm::load<float>(&v));
int32_t v = re::load<int32_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(re::load<float>(&v));
}
INT_CALLBACK(LOAD_HOST_F64) {
uint64_t addr = LOAD_ARG0();
int64_t v = dvm::load<int64_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(dvm::load<double>(&v));
int64_t v = re::load<int64_t>(reinterpret_cast<void *>(addr));
STORE_RESULT(re::load<double>(&v));
}
REGISTER_INT_CALLBACK(LOAD_HOST, LOAD_HOST_I8, I8, I64, V);
REGISTER_INT_CALLBACK(LOAD_HOST, LOAD_HOST_I16, I16, I64, V);
@ -382,32 +382,32 @@ REGISTER_INT_CALLBACK(LOAD_HOST, LOAD_HOST_F64, F64, I64, V);
INT_CALLBACK(STORE_HOST_I8) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), v);
re::store(reinterpret_cast<void *>(addr), v);
}
INT_CALLBACK(STORE_HOST_I16) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), v);
re::store(reinterpret_cast<void *>(addr), v);
}
INT_CALLBACK(STORE_HOST_I32) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), v);
re::store(reinterpret_cast<void *>(addr), v);
}
INT_CALLBACK(STORE_HOST_I64) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), v);
re::store(reinterpret_cast<void *>(addr), v);
}
INT_CALLBACK(STORE_HOST_F32) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), dvm::load<uint32_t>(&v));
re::store(reinterpret_cast<void *>(addr), re::load<uint32_t>(&v));
}
INT_CALLBACK(STORE_HOST_F64) {
uint64_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<void *>(addr), dvm::load<uint64_t>(&v));
re::store(reinterpret_cast<void *>(addr), re::load<uint64_t>(&v));
}
REGISTER_INT_CALLBACK(STORE_HOST, STORE_HOST_I8, V, I64, I8);
REGISTER_INT_CALLBACK(STORE_HOST, STORE_HOST_I16, V, I64, I16);
@ -439,12 +439,12 @@ INT_CALLBACK(LOAD_GUEST_I64) {
INT_CALLBACK(LOAD_GUEST_F32) {
uint32_t addr = LOAD_ARG0();
uint32_t v = reinterpret_cast<Memory *>(i->ctx)->R32(addr);
STORE_RESULT(dvm::load<float>(&v));
STORE_RESULT(re::load<float>(&v));
}
INT_CALLBACK(LOAD_GUEST_F64) {
uint32_t addr = LOAD_ARG0();
uint64_t v = reinterpret_cast<Memory *>(i->ctx)->R64(addr);
STORE_RESULT(dvm::load<double>(&v));
STORE_RESULT(re::load<double>(&v));
}
REGISTER_INT_CALLBACK(LOAD_GUEST, LOAD_GUEST_I8, I8, I32, V);
REGISTER_INT_CALLBACK(LOAD_GUEST, LOAD_GUEST_I16, I16, I32, V);
@ -476,12 +476,12 @@ INT_CALLBACK(STORE_GUEST_I64) {
INT_CALLBACK(STORE_GUEST_F32) {
uint32_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
reinterpret_cast<Memory *>(i->ctx)->W32(addr, dvm::load<uint32_t>(&v));
reinterpret_cast<Memory *>(i->ctx)->W32(addr, re::load<uint32_t>(&v));
}
INT_CALLBACK(STORE_GUEST_F64) {
uint32_t addr = LOAD_ARG0();
A1 v = LOAD_ARG1();
reinterpret_cast<Memory *>(i->ctx)->W64(addr, dvm::load<uint64_t>(&v));
reinterpret_cast<Memory *>(i->ctx)->W64(addr, re::load<uint64_t>(&v));
}
REGISTER_INT_CALLBACK(STORE_GUEST, STORE_GUEST_I8, V, I32, I8);
REGISTER_INT_CALLBACK(STORE_GUEST, STORE_GUEST_I16, V, I32, I16);
@ -492,7 +492,7 @@ REGISTER_INT_CALLBACK(STORE_GUEST, STORE_GUEST_F64, V, I32, F64);
INT_CALLBACK(LOAD_CONTEXT) {
A0 offset = LOAD_ARG0();
R v = dvm::load<R>(reinterpret_cast<uint8_t *>(i->ctx) + offset);
R v = re::load<R>(reinterpret_cast<uint8_t *>(i->ctx) + offset);
STORE_RESULT(v);
}
REGISTER_INT_CALLBACK(LOAD_CONTEXT, LOAD_CONTEXT, I8, I32, V);
@ -505,7 +505,7 @@ REGISTER_INT_CALLBACK(LOAD_CONTEXT, LOAD_CONTEXT, F64, I32, V);
INT_CALLBACK(STORE_CONTEXT) {
A0 offset = LOAD_ARG0();
A1 v = LOAD_ARG1();
dvm::store(reinterpret_cast<uint8_t *>(i->ctx) + offset, v);
re::store(reinterpret_cast<uint8_t *>(i->ctx) + offset, v);
}
REGISTER_INT_CALLBACK(STORE_CONTEXT, STORE_CONTEXT, V, I32, I8);
REGISTER_INT_CALLBACK(STORE_CONTEXT, STORE_CONTEXT, V, I32, I16);

View File

@ -3,7 +3,7 @@
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace interpreter {

View File

@ -7,13 +7,13 @@
#include "jit/backend/x64/x64_disassembler.h"
#include "sys/exception_handler.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::backend;
using namespace dvm::jit::backend::x64;
using namespace dvm::jit::ir;
using namespace dvm::sys;
using namespace re;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::backend;
using namespace re::jit::backend::x64;
using namespace re::jit::ir;
using namespace re::sys;
extern "C" void load_thunk_rax();
extern "C" void load_thunk_rcx();
@ -33,7 +33,7 @@ extern "C" void load_thunk_r14();
extern "C" void load_thunk_r15();
extern "C" void store_thunk();
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace x64 {
@ -174,18 +174,18 @@ bool X64Backend::HandleException(BlockPointer block, int *block_flags,
// push the original argument registers and the return address (the next
// instruction after the current mov) to the stack
ex.thread_state.rsp -= STACK_SHADOW_SPACE + 24 + 8;
dvm::store(
re::store(
reinterpret_cast<uint8_t *>(ex.thread_state.rsp + STACK_SHADOW_SPACE),
ex.thread_state.r[x64_arg2_idx]);
dvm::store(
re::store(
reinterpret_cast<uint8_t *>(ex.thread_state.rsp + STACK_SHADOW_SPACE + 8),
ex.thread_state.r[x64_arg1_idx]);
dvm::store(reinterpret_cast<uint8_t *>(ex.thread_state.rsp +
STACK_SHADOW_SPACE + 16),
ex.thread_state.r[x64_arg0_idx]);
dvm::store(reinterpret_cast<uint8_t *>(ex.thread_state.rsp +
STACK_SHADOW_SPACE + 24),
ex.thread_state.rip + mov.length);
re::store(reinterpret_cast<uint8_t *>(ex.thread_state.rsp +
STACK_SHADOW_SPACE + 16),
ex.thread_state.r[x64_arg0_idx]);
re::store(reinterpret_cast<uint8_t *>(ex.thread_state.rsp +
STACK_SHADOW_SPACE + 24),
ex.thread_state.rip + mov.length);
if (mov.is_load) {
// prep argument registers (memory object, guest_addr) for read function

View File

@ -4,7 +4,7 @@
#include "jit/backend/backend.h"
#include "jit/backend/x64/x64_emitter.h"
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace x64 {

View File

@ -1,7 +1,7 @@
#include "core/memory.h"
#include "jit/backend/x64/x64_disassembler.h"
using namespace dvm::jit::backend::x64;
using namespace re::jit::backend::x64;
bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
const uint8_t *start = data;
@ -9,7 +9,7 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
// test for operand size prefix
bool has_opprefix = false;
if (dvm::load<uint8_t>(data) == 0x66) {
if (re::load<uint8_t>(data) == 0x66) {
has_opprefix = true;
data++;
}
@ -22,8 +22,8 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
uint8_t rex_x = 0;
uint8_t rex_b = 0;
if ((dvm::load<uint8_t>(data) & 0xf0) == 0x40) {
rex = dvm::load<uint8_t>(data);
if ((re::load<uint8_t>(data) & 0xf0) == 0x40) {
rex = re::load<uint8_t>(data);
rex_w = rex & 0b1000;
rex_r = rex & 0b0100;
rex_x = rex & 0b0010;
@ -41,10 +41,10 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
// MOV r16,r/m16
// MOV r32,r/m32
// MOV r64,r/m64
if (dvm::load<uint8_t>(data) == 0x8a || dvm::load<uint8_t>(data) == 0x8b) {
if (re::load<uint8_t>(data) == 0x8a || re::load<uint8_t>(data) == 0x8b) {
is_load = true;
has_imm = false;
operand_size = dvm::load<uint8_t>(data) == 0x8a
operand_size = re::load<uint8_t>(data) == 0x8a
? 1
: (has_opprefix ? 2 : (rex_w ? 8 : 4));
data++;
@ -53,11 +53,10 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
// MOV r/m16,r16
// MOV r/m32,r32
// MOV r/m64,r64
else if (dvm::load<uint8_t>(data) == 0x88 ||
dvm::load<uint8_t>(data) == 0x89) {
else if (re::load<uint8_t>(data) == 0x88 || re::load<uint8_t>(data) == 0x89) {
is_load = false;
has_imm = false;
operand_size = dvm::load<uint8_t>(data) == 0x88
operand_size = re::load<uint8_t>(data) == 0x88
? 1
: (has_opprefix ? 2 : (rex_w ? 8 : 4));
data++;
@ -65,23 +64,19 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
// MOV r8,imm8
// MOV r16,imm16
// MOV r32,imm32
else if (dvm::load<uint8_t>(data) == 0xb0 ||
dvm::load<uint8_t>(data) == 0xb8) {
else if (re::load<uint8_t>(data) == 0xb0 || re::load<uint8_t>(data) == 0xb8) {
is_load = true;
has_imm = true;
operand_size =
dvm::load<uint8_t>(data) == 0xb0 ? 1 : (has_opprefix ? 2 : 4);
operand_size = re::load<uint8_t>(data) == 0xb0 ? 1 : (has_opprefix ? 2 : 4);
data++;
}
// MOV r/m8,imm8
// MOV r/m16,imm16
// MOV r/m32,imm32
else if (dvm::load<uint8_t>(data) == 0xc6 ||
dvm::load<uint8_t>(data) == 0xc7) {
else if (re::load<uint8_t>(data) == 0xc6 || re::load<uint8_t>(data) == 0xc7) {
is_load = false;
has_imm = true;
operand_size =
dvm::load<uint8_t>(data) == 0xc6 ? 1 : (has_opprefix ? 2 : 4);
operand_size = re::load<uint8_t>(data) == 0xc6 ? 1 : (has_opprefix ? 2 : 4);
data++;
}
// not a supported MOV instruction
@ -90,7 +85,7 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
}
// process ModR/M byte
uint8_t modrm = dvm::load<uint8_t>(data);
uint8_t modrm = re::load<uint8_t>(data);
uint8_t modrm_mod = (modrm & 0b11000000) >> 6;
uint8_t modrm_reg = (modrm & 0b00111000) >> 3;
uint8_t modrm_rm = (modrm & 0b00000111);
@ -111,7 +106,7 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
// process optional SIB byte
if (modrm_rm == 0b100) {
uint8_t sib = dvm::load<uint8_t>(data);
uint8_t sib = re::load<uint8_t>(data);
uint8_t sib_scale = (sib & 0b11000000) >> 6;
uint8_t sib_index = (sib & 0b00111000) >> 3;
uint8_t sib_base = (sib & 0b00000111);
@ -132,18 +127,18 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
case 0b00: {
// RIP-relative
if (modrm_rm == 0b101) {
mov->disp = dvm::load<uint32_t>(data);
mov->disp = re::load<uint32_t>(data);
data += 4;
}
} break;
case 0b01: {
mov->disp = dvm::load<uint8_t>(data);
mov->disp = re::load<uint8_t>(data);
data++;
} break;
case 0b10: {
mov->disp = dvm::load<uint32_t>(data);
mov->disp = re::load<uint32_t>(data);
data += 4;
} break;
}
@ -152,22 +147,22 @@ bool X64Disassembler::DecodeMov(const uint8_t *data, X64Mov *mov) {
if (mov->has_imm) {
switch (mov->operand_size) {
case 1: {
mov->imm = dvm::load<uint8_t>(data);
mov->imm = re::load<uint8_t>(data);
data++;
} break;
case 2: {
mov->imm = dvm::load<uint16_t>(data);
mov->imm = re::load<uint16_t>(data);
data += 2;
} break;
case 4: {
mov->imm = dvm::load<uint32_t>(data);
mov->imm = re::load<uint32_t>(data);
data += 4;
} break;
case 8: {
mov->imm = dvm::load<uint64_t>(data);
mov->imm = re::load<uint64_t>(data);
data += 8;
} break;
}

View File

@ -3,7 +3,7 @@
#include <stdint.h>
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace x64 {

View File

@ -5,12 +5,12 @@
#include "jit/backend/x64/x64_backend.h"
#include "jit/backend/x64/x64_emitter.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::backend;
using namespace dvm::jit::backend::x64;
using namespace dvm::jit::ir;
using namespace re;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::backend;
using namespace re::jit::backend::x64;
using namespace re::jit::ir;
const Xbyak::Reg64 arg0(x64_arg0_idx);
const Xbyak::Reg64 arg1(x64_arg1_idx);
@ -124,13 +124,13 @@ void X64Emitter::EmitProlog(IRBuilder &builder, int *out_stack_size) {
// align locals
for (auto local : builder.locals()) {
int type_size = SizeForType(local->type());
stack_size = dvm::align(stack_size, type_size);
stack_size = re::align(stack_size, type_size);
local->set_offset(builder.AllocConstant(stack_size));
stack_size += type_size;
}
// stack must be 16 byte aligned
stack_size = dvm::align(stack_size, 16);
stack_size = re::align(stack_size, 16);
// add 8 for return address which will be pushed when this is called
stack_size += 8;
@ -296,11 +296,11 @@ void X64Emitter::CopyOperand(const Value *v, const Xbyak::Reg &to) {
if (v->type() == VALUE_F32) {
float val = v->value<float>();
mov(eax, dvm::load<int32_t>(&val));
mov(eax, re::load<int32_t>(&val));
movd(reinterpret_cast<const Xbyak::Xmm &>(to), eax);
} else {
double val = v->value<double>();
mov(rax, dvm::load<int64_t>(&val));
mov(rax, re::load<int64_t>(&val));
movq(reinterpret_cast<const Xbyak::Xmm &>(to), rax);
}
} else {

View File

@ -6,7 +6,7 @@
#include "hw/memory.h"
#include "jit/source_map.h"
namespace dvm {
namespace re {
namespace jit {
namespace backend {
namespace x64 {

View File

@ -5,7 +5,7 @@
#include "hw/memory.h"
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace frontend {

View File

@ -2,12 +2,12 @@
#include "emu/profiler.h"
#include "jit/frontend/sh4/sh4_builder.h"
using namespace dvm;
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::frontend;
using namespace dvm::jit::frontend::sh4;
using namespace dvm::jit::ir;
using namespace re;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::frontend;
using namespace re::jit::frontend::sh4;
using namespace re::jit::ir;
static uint32_t s_fsca_table[0x20000] = {
#include "jit/frontend/sh4/sh4_fsca.inc"

View File

@ -6,7 +6,7 @@
#include "jit/frontend/sh4/sh4_disassembler.h"
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace frontend {
namespace sh4 {

View File

@ -3,7 +3,7 @@
#include <stdint.h>
namespace dvm {
namespace re {
namespace jit {
namespace frontend {
namespace sh4 {

View File

@ -3,9 +3,9 @@
#include "hw/memory.h"
#include "jit/frontend/sh4/sh4_disassembler.h"
using namespace dvm;
using namespace re;
namespace dvm {
namespace re {
namespace jit {
namespace frontend {
namespace sh4 {
@ -104,7 +104,7 @@ void Dump(const void *data, size_t size, uint32_t base) {
for (size_t i = 0; i < size; i += 2) {
instr.addr = base + i;
instr.opcode =
dvm::load<uint16_t>(reinterpret_cast<const uint8_t *>(data) + i);
re::load<uint16_t>(reinterpret_cast<const uint8_t *>(data) + i);
if (!Disasm(&instr)) {
snprintf(buffer, sizeof(buffer), "%08x .word 0x%04x", instr.addr,

View File

@ -3,7 +3,7 @@
#include <stdint.h>
namespace dvm {
namespace re {
namespace jit {
namespace frontend {
namespace sh4 {

View File

@ -1,10 +1,10 @@
#include "jit/frontend/sh4/sh4_builder.h"
#include "jit/frontend/sh4/sh4_frontend.h"
using namespace dvm::hw;
using namespace dvm::jit;
using namespace dvm::jit::frontend::sh4;
using namespace dvm::jit::ir;
using namespace re::hw;
using namespace re::jit;
using namespace re::jit::frontend::sh4;
using namespace re::jit::ir;
SH4Frontend::SH4Frontend(Memory &memory) : Frontend(memory) {}

View File

@ -3,7 +3,7 @@
#include "jit/frontend/frontend.h"
namespace dvm {
namespace re {
namespace jit {
namespace frontend {
namespace sh4 {

View File

@ -3,10 +3,10 @@
#include "jit/ir/ir_builder.h"
#include "jit/ir/ir_writer.h"
using namespace dvm::jit;
using namespace dvm::jit::ir;
using namespace re::jit;
using namespace re::jit::ir;
const char *dvm::jit::ir::Opnames[NUM_OPCODES] = {
const char *re::jit::ir::Opnames[NUM_OPCODES] = {
#define IR_OP(name) #name,
#include "jit/ir/ir_ops.inc"
};
@ -33,9 +33,9 @@ uint64_t Value::GetZExtValue() const {
case VALUE_I64:
return static_cast<uint64_t>(i64_);
case VALUE_F32:
return dvm::load<uint32_t>(&f32_);
return re::load<uint32_t>(&f32_);
case VALUE_F64:
return dvm::load<uint64_t>(&f64_);
return re::load<uint64_t>(&f64_);
}
return 0;
}

View File

@ -6,7 +6,7 @@
#include "core/assert.h"
#include "core/intrusive_list.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {

View File

@ -1,9 +1,9 @@
#include "core/string.h"
#include "jit/ir/ir_reader.h"
using namespace dvm;
using namespace dvm::jit;
using namespace dvm::jit::ir;
using namespace re;
using namespace re::jit;
using namespace re::jit::ir;
struct IRType {
const char *name;

View File

@ -5,7 +5,7 @@
#include <unordered_map>
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {

View File

@ -1,8 +1,8 @@
#include <iomanip>
#include "jit/ir/ir_writer.h"
using namespace dvm::jit;
using namespace dvm::jit::ir;
using namespace re::jit;
using namespace re::jit::ir;
void IRWriter::Print(const IRBuilder &builder, std::ostream &output) {
slots_.clear();
@ -91,8 +91,7 @@ void IRWriter::PrintValue(const Value *value, std::ostream &output) {
}
}
void IRWriter::PrintInstruction(const Instr *instr,
std::ostream &output) {
void IRWriter::PrintInstruction(const Instr *instr, std::ostream &output) {
// print result value if we have one
if (instr->result()) {
PrintValue(instr->result(), output);

View File

@ -5,7 +5,7 @@
#include <unordered_map>
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {

View File

@ -3,8 +3,8 @@
#include "emu/profiler.h"
#include "jit/ir/passes/constant_propagation_pass.h"
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
typedef void (*FoldFn)(IRBuilder &, Block *, Instr *i);

View File

@ -3,7 +3,7 @@
#include "jit/ir/passes/pass_runner.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {
namespace passes {

View File

@ -1,8 +1,8 @@
#include "emu/profiler.h"
#include "jit/ir/passes/load_store_elimination_pass.h"
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
LoadStoreEliminationPass::LoadStoreEliminationPass()
: available_(nullptr), num_available_(0) {}

View File

@ -3,7 +3,7 @@
#include "jit/ir/passes/pass_runner.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {
namespace passes {

View File

@ -2,8 +2,8 @@
#include "jit/ir/ir_builder.h"
#include "jit/ir/passes/pass_runner.h"
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
PassRunner::PassRunner() {}

View File

@ -5,7 +5,7 @@
#include <vector>
#include "jit/ir/ir_builder.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {
namespace passes {

View File

@ -2,9 +2,9 @@
#include "emu/profiler.h"
#include "jit/ir/passes/register_allocation_pass.h"
using namespace dvm::jit::backend;
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace re::jit::backend;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
static inline int GetOrdinal(const Instr *i) { return (int)i->tag(); }
@ -51,7 +51,7 @@ Interval *RegisterSet::HeadInterval() {
return nullptr;
}
auto it = dvm::mmheap_find_min(live_, live_ + num_live_, LiveIntervalSort());
auto it = re::mmheap_find_min(live_, live_ + num_live_, LiveIntervalSort());
return *it;
}
@ -60,23 +60,23 @@ Interval *RegisterSet::TailInterval() {
return nullptr;
}
auto it = dvm::mmheap_find_max(live_, live_ + num_live_, LiveIntervalSort());
auto it = re::mmheap_find_max(live_, live_ + num_live_, LiveIntervalSort());
return *it;
}
void RegisterSet::PopHeadInterval() {
dvm::mmheap_pop_min(live_, live_ + num_live_, LiveIntervalSort());
re::mmheap_pop_min(live_, live_ + num_live_, LiveIntervalSort());
num_live_--;
}
void RegisterSet::PopTailInterval() {
dvm::mmheap_pop_max(live_, live_ + num_live_, LiveIntervalSort());
re::mmheap_pop_max(live_, live_ + num_live_, LiveIntervalSort());
num_live_--;
}
void RegisterSet::InsertInterval(Interval *interval) {
live_[num_live_++] = interval;
dvm::mmheap_push(live_, live_ + num_live_, LiveIntervalSort());
re::mmheap_push(live_, live_ + num_live_, LiveIntervalSort());
}
RegisterAllocationPass::RegisterAllocationPass(const Backend &backend)

View File

@ -5,7 +5,7 @@
#include "jit/backend/backend.h"
#include "jit/ir/passes/pass_runner.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {
namespace passes {

View File

@ -1,8 +1,8 @@
#include "emu/profiler.h"
#include "jit/ir/passes/validate_pass.h"
using namespace dvm::jit::ir;
using namespace dvm::jit::ir::passes;
using namespace re::jit::ir;
using namespace re::jit::ir::passes;
void ValidatePass::Run(IRBuilder &builder) {
PROFILER_RUNTIME("ValidatePass::Run");

View File

@ -3,7 +3,7 @@
#include "jit/ir/passes/pass_runner.h"
namespace dvm {
namespace re {
namespace jit {
namespace ir {
namespace passes {

View File

@ -1,7 +1,7 @@
#include "jit/source_map.h"
using namespace dvm;
using namespace dvm::jit;
using namespace re;
using namespace re::jit;
void SourceMap::AddBlockAddress(uintptr_t host_addr, uint32_t guest_addr) {
block_addresses_.insert(std::make_pair(host_addr, guest_addr));

View File

@ -3,7 +3,7 @@
#include <map>
namespace dvm {
namespace re {
namespace jit {
class SourceMap {

View File

@ -7,10 +7,10 @@
#include "sys/filesystem.h"
#include "sys/network.h"
using namespace dvm;
using namespace dvm::emu;
using namespace dvm::sys;
using namespace dvm::trace;
using namespace re;
using namespace re::emu;
using namespace re::sys;
using namespace re::trace;
void InitFlags(int *argc, char ***argv) {
const char *appdir = GetAppDir();

View File

@ -3,7 +3,7 @@
#include <Eigen/Dense>
namespace dvm {
namespace re {
namespace renderer {
typedef int TextureHandle;

View File

@ -5,9 +5,9 @@
#define STB_TRUETYPE_IMPLEMENTATION
#include <stb_truetype.h>
using namespace dvm;
using namespace dvm::renderer;
using namespace dvm::sys;
using namespace re;
using namespace re::renderer;
using namespace re::sys;
#include "inconsolata_ttf.inc"
#include "renderer/ta.glsl"

View File

@ -9,7 +9,7 @@
#include "renderer/gl_shader.h"
#include "sys/window.h"
namespace dvm {
namespace re {
namespace renderer {
enum { //

View File

@ -2,7 +2,7 @@
#include "core/string.h"
#include "renderer/gl_shader.h"
namespace dvm {
namespace re {
namespace renderer {
#define GLSL_VERSION 330

View File

@ -3,7 +3,7 @@
#include <GL/glew.h>
namespace dvm {
namespace re {
namespace renderer {
enum UniformAttr {

View File

@ -2,7 +2,7 @@
#include "emu/profiler.h"
#include "sys/exception_handler.h"
using namespace dvm::sys;
using namespace re::sys;
ExceptionHandler::ExceptionHandler() : next_handle_(0) {}

View File

@ -3,7 +3,7 @@
#include <vector>
namespace dvm {
namespace re {
namespace sys {
// exception handler information

Some files were not shown because too many files have changed in this diff Show More