remove old files
BIN
dist/icons/controller/dual_joycon.png
vendored
Before Width: | Height: | Size: 36 KiB |
BIN
dist/icons/controller/dual_joycon_dark.png
vendored
Before Width: | Height: | Size: 35 KiB |
BIN
dist/icons/controller/dual_joycon_midnight.png
vendored
Before Width: | Height: | Size: 34 KiB |
BIN
dist/icons/controller/handheld.png
vendored
Before Width: | Height: | Size: 14 KiB |
BIN
dist/icons/controller/handheld_dark.png
vendored
Before Width: | Height: | Size: 13 KiB |
BIN
dist/icons/controller/handheld_midnight.png
vendored
Before Width: | Height: | Size: 13 KiB |
BIN
dist/icons/controller/pro_controller.png
vendored
Before Width: | Height: | Size: 36 KiB |
BIN
dist/icons/controller/pro_controller_dark.png
vendored
Before Width: | Height: | Size: 34 KiB |
BIN
dist/icons/controller/pro_controller_midnight.png
vendored
Before Width: | Height: | Size: 35 KiB |
BIN
dist/icons/controller/single_joycon_left.png
vendored
Before Width: | Height: | Size: 25 KiB |
BIN
dist/icons/controller/single_joycon_left_dark.png
vendored
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 23 KiB |
BIN
dist/icons/controller/single_joycon_right.png
vendored
Before Width: | Height: | Size: 28 KiB |
BIN
dist/icons/controller/single_joycon_right_dark.png
vendored
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 26 KiB |
101
externals/SDL/build-scripts/g++-fat.sh
vendored
|
@ -1,101 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Build Universal binaries on Mac OS X, thanks Ryan!
|
|
||||||
#
|
|
||||||
# Usage: ./configure CXX="sh g++-fat.sh" && make && rm -rf x86 x64
|
|
||||||
|
|
||||||
DEVELOPER="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer"
|
|
||||||
|
|
||||||
# Intel 32-bit compiler flags (10.6 runtime compatibility)
|
|
||||||
GCC_COMPILE_X86="g++ -arch i386 -mmacosx-version-min=10.6 \
|
|
||||||
-I/usr/local/include"
|
|
||||||
|
|
||||||
GCC_LINK_X86="-mmacosx-version-min=10.6"
|
|
||||||
|
|
||||||
# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
|
||||||
GCC_COMPILE_X64="g++ -arch x86_64 -mmacosx-version-min=10.6 \
|
|
||||||
-I/usr/local/include"
|
|
||||||
|
|
||||||
GCC_LINK_X64="-mmacosx-version-min=10.6"
|
|
||||||
|
|
||||||
# Output both PowerPC and Intel object files
|
|
||||||
args="$*"
|
|
||||||
compile=yes
|
|
||||||
link=yes
|
|
||||||
while test x$1 != x; do
|
|
||||||
case $1 in
|
|
||||||
--version) exec g++ $1;;
|
|
||||||
-v) exec g++ $1;;
|
|
||||||
-V) exec g++ $1;;
|
|
||||||
-print-prog-name=*) exec g++ $1;;
|
|
||||||
-print-search-dirs) exec g++ $1;;
|
|
||||||
-E) GCC_COMPILE_X86="$GCC_COMPILE_X86 -E"
|
|
||||||
GCC_COMPILE_X64="$GCC_COMPILE_X64 -E"
|
|
||||||
compile=no; link=no;;
|
|
||||||
-c) link=no;;
|
|
||||||
-o) output=$2;;
|
|
||||||
*.c|*.cc|*.cpp|*.S|*.m|*.mm) source=$1;;
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
if test x$link = xyes; then
|
|
||||||
GCC_COMPILE_X86="$GCC_COMPILE_X86 $GCC_LINK_X86"
|
|
||||||
GCC_COMPILE_X64="$GCC_COMPILE_X64 $GCC_LINK_X64"
|
|
||||||
fi
|
|
||||||
if test x"$output" = x; then
|
|
||||||
if test x$link = xyes; then
|
|
||||||
output=a.out
|
|
||||||
elif test x$compile = xyes; then
|
|
||||||
output=`echo $source | sed -e 's|.*/||' -e 's|\(.*\)\.[^\.]*|\1|'`.o
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compile X86 32-bit
|
|
||||||
if test x"$output" != x; then
|
|
||||||
dir=x86/`dirname $output`
|
|
||||||
if test -d $dir; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
mkdir -p $dir
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
set -- $args
|
|
||||||
while test x$1 != x; do
|
|
||||||
if test -f "x86/$1" && test "$1" != "$output"; then
|
|
||||||
x86_args="$x86_args x86/$1"
|
|
||||||
else
|
|
||||||
x86_args="$x86_args $1"
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
$GCC_COMPILE_X86 $x86_args || exit $?
|
|
||||||
if test x"$output" != x; then
|
|
||||||
cp $output x86/$output
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Compile X86 32-bit
|
|
||||||
if test x"$output" != x; then
|
|
||||||
dir=x64/`dirname $output`
|
|
||||||
if test -d $dir; then
|
|
||||||
:
|
|
||||||
else
|
|
||||||
mkdir -p $dir
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
set -- $args
|
|
||||||
while test x$1 != x; do
|
|
||||||
if test -f "x64/$1" && test "$1" != "$output"; then
|
|
||||||
x64_args="$x64_args x64/$1"
|
|
||||||
else
|
|
||||||
x64_args="$x64_args $1"
|
|
||||||
fi
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
$GCC_COMPILE_X64 $x64_args || exit $?
|
|
||||||
if test x"$output" != x; then
|
|
||||||
cp $output x64/$output
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test x"$output" != x; then
|
|
||||||
lipo -create -o $output x86/$output x64/$output
|
|
||||||
fi
|
|
85
externals/cubeb/.travis.yml
vendored
|
@ -1,85 +0,0 @@
|
||||||
language: cpp
|
|
||||||
dist: xenial
|
|
||||||
sudo: required
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- clang-3.8
|
|
||||||
- g++-5
|
|
||||||
- libpulse-dev
|
|
||||||
- libasound2-dev
|
|
||||||
- pulseaudio
|
|
||||||
- doxygen
|
|
||||||
- mingw-w64
|
|
||||||
- mingw-w64-tools
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- CMAKE_USE_ASAN=OFF
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- env: C_COMPILER=clang-3.8 CXX_COMPILER=clang++-3.8
|
|
||||||
- env: C_COMPILER=clang-3.8 CXX_COMPILER=clang++-3.8 CMAKE_USE_ASAN=ON
|
|
||||||
- env: C_COMPILER=gcc-5 CXX_COMPILER=g++-5
|
|
||||||
- env: SCAN_BUILD=true
|
|
||||||
- env: CROSS=mingw
|
|
||||||
- env: CROSS=android API_LEVEL=android-16
|
|
||||||
- os: freebsd
|
|
||||||
compiler: clang
|
|
||||||
- os: freebsd
|
|
||||||
compiler: gcc
|
|
||||||
- os: freebsd
|
|
||||||
env: SCAN_BUILD=true
|
|
||||||
- os: osx
|
|
||||||
- os: osx
|
|
||||||
env: SCAN_BUILD=true
|
|
||||||
- os: windows
|
|
||||||
allow_failures:
|
|
||||||
- os: freebsd
|
|
||||||
env: SCAN_BUILD=true
|
|
||||||
before_install:
|
|
||||||
- if [[ -n $SCAN_BUILD ]]; then
|
|
||||||
if [[ $TRAVIS_OS_NAME = "osx" ]]; then
|
|
||||||
. scan-build-install.sh;
|
|
||||||
elif [[ $TRAVIS_OS_NAME = "freebsd" ]]; then
|
|
||||||
export SCAN_BUILD_PATH=scan-build10;
|
|
||||||
sudo pkg install -y llvm10;
|
|
||||||
else
|
|
||||||
export SCAN_BUILD_PATH=/usr/share/clang/scan-build-3.8/bin/scan-build;
|
|
||||||
fi;
|
|
||||||
export SCAN_BUILD_PATH="$SCAN_BUILD_PATH -o scan_results";
|
|
||||||
fi
|
|
||||||
- if [[ $TRAVIS_OS_NAME = "freebsd" ]]; then
|
|
||||||
export CFLAGS+=" -isystem/usr/local/include";
|
|
||||||
export CXXFLAGS+=" -isystem/usr/local/include";
|
|
||||||
sudo pkg install -y alsa-lib jackit pulseaudio sndio;
|
|
||||||
fi
|
|
||||||
- if [[ $CROSS = "android" ]]; then
|
|
||||||
NDK=android-ndk-r19c;
|
|
||||||
curl -LO https://dl.google.com/android/repository/$NDK-linux-x86_64.zip;
|
|
||||||
unzip -q $NDK-linux-x86_64.zip;
|
|
||||||
rm $NDK-linux-x86_64.zip;
|
|
||||||
export ANDROID_NDK=$(pwd)/$NDK;
|
|
||||||
fi
|
|
||||||
before_script:
|
|
||||||
- if [[ -n $C_COMPILER ]]; then
|
|
||||||
export CC=$C_COMPILER;
|
|
||||||
fi
|
|
||||||
- if [[ -n $CXX_COMPILER ]]; then
|
|
||||||
export CXX=$CXX_COMPILER;
|
|
||||||
fi
|
|
||||||
- if [[ -n $CROSS ]]; then
|
|
||||||
export TOOLCHAIN=-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain-cross-$CROSS.cmake;
|
|
||||||
fi
|
|
||||||
- if [[ $CROSS = "android" ]]; then
|
|
||||||
export TOOLCHAIN="-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=$API_LEVEL";
|
|
||||||
fi
|
|
||||||
- mkdir build && cd build
|
|
||||||
- $SCAN_BUILD_PATH cmake -DCMAKE_BUILD_TYPE=Debug -DSANITIZE_ADDRESS=$CMAKE_USE_ASAN $TOOLCHAIN ..;
|
|
||||||
script:
|
|
||||||
- $SCAN_BUILD_PATH cmake --build .
|
|
||||||
- if [[ $TRAVIS_OS_NAME = "linux" && -z $CROSS ]]; then
|
|
||||||
ctest -V;
|
|
||||||
fi
|
|
||||||
- if [[ -n $SCAN_BUILD ]]; then
|
|
||||||
rmdir scan_results || ( echo "scan-build detected bugs!" && exit 1 );
|
|
||||||
fi
|
|
9
externals/cubeb/appveyor.yml
vendored
|
@ -1,9 +0,0 @@
|
||||||
version: 1.0.{build}
|
|
||||||
install:
|
|
||||||
- cmd: git submodule update --init --recursive
|
|
||||||
build_script:
|
|
||||||
- cmd: |-
|
|
||||||
cd c:\projects\cubeb
|
|
||||||
cmake .
|
|
||||||
cmake --build . --config Debug
|
|
||||||
|
|
235
externals/cubeb/src/speex/arch.h
vendored
|
@ -1,235 +0,0 @@
|
||||||
/* Copyright (C) 2003 Jean-Marc Valin */
|
|
||||||
/**
|
|
||||||
@file arch.h
|
|
||||||
@brief Various architecture definitions Speex
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ARCH_H
|
|
||||||
#define ARCH_H
|
|
||||||
|
|
||||||
/* A couple test to catch stupid option combinations */
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
|
|
||||||
#ifdef FLOATING_POINT
|
|
||||||
#error You cannot compile as floating point and fixed point at the same time
|
|
||||||
#endif
|
|
||||||
#ifdef _USE_SSE
|
|
||||||
#error SSE is only for floating-point
|
|
||||||
#endif
|
|
||||||
#if ((defined (ARM4_ASM)||defined (ARM4_ASM)) && defined(BFIN_ASM)) || (defined (ARM4_ASM)&&defined(ARM5E_ASM))
|
|
||||||
#error Make up your mind. What CPU do you have?
|
|
||||||
#endif
|
|
||||||
#ifdef VORBIS_PSYCHO
|
|
||||||
#error Vorbis-psy model currently not implemented in fixed-point
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifndef FLOATING_POINT
|
|
||||||
#error You now need to define either FIXED_POINT or FLOATING_POINT
|
|
||||||
#endif
|
|
||||||
#if defined (ARM4_ASM) || defined(ARM5E_ASM) || defined(BFIN_ASM)
|
|
||||||
#error I suppose you can have a [ARM4/ARM5E/Blackfin] that has float instructions?
|
|
||||||
#endif
|
|
||||||
#ifdef FIXED_POINT_DEBUG
|
|
||||||
#error "Don't you think enabling fixed-point is a good thing to do if you want to debug that?"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef OUTSIDE_SPEEX
|
|
||||||
#include "speex/speexdsp_types.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ABS(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute integer value. */
|
|
||||||
#define ABS16(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 16-bit value. */
|
|
||||||
#define MIN16(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 16-bit value. */
|
|
||||||
#define MAX16(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 16-bit value. */
|
|
||||||
#define ABS32(x) ((x) < 0 ? (-(x)) : (x)) /**< Absolute 32-bit value. */
|
|
||||||
#define MIN32(a,b) ((a) < (b) ? (a) : (b)) /**< Maximum 32-bit value. */
|
|
||||||
#define MAX32(a,b) ((a) > (b) ? (a) : (b)) /**< Maximum 32-bit value. */
|
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
|
|
||||||
typedef spx_int16_t spx_word16_t;
|
|
||||||
typedef spx_int32_t spx_word32_t;
|
|
||||||
typedef spx_word32_t spx_mem_t;
|
|
||||||
typedef spx_word16_t spx_coef_t;
|
|
||||||
typedef spx_word16_t spx_lsp_t;
|
|
||||||
typedef spx_word32_t spx_sig_t;
|
|
||||||
|
|
||||||
#define Q15ONE 32767
|
|
||||||
|
|
||||||
#define LPC_SCALING 8192
|
|
||||||
#define SIG_SCALING 16384
|
|
||||||
#define LSP_SCALING 8192.
|
|
||||||
#define GAMMA_SCALING 32768.
|
|
||||||
#define GAIN_SCALING 64
|
|
||||||
#define GAIN_SCALING_1 0.015625
|
|
||||||
|
|
||||||
#define LPC_SHIFT 13
|
|
||||||
#define LSP_SHIFT 13
|
|
||||||
#define SIG_SHIFT 14
|
|
||||||
#define GAIN_SHIFT 6
|
|
||||||
|
|
||||||
#define WORD2INT(x) ((x) < -32767 ? -32768 : ((x) > 32766 ? 32767 : (x)))
|
|
||||||
|
|
||||||
#define VERY_SMALL 0
|
|
||||||
#define VERY_LARGE32 ((spx_word32_t)2147483647)
|
|
||||||
#define VERY_LARGE16 ((spx_word16_t)32767)
|
|
||||||
#define Q15_ONE ((spx_word16_t)32767)
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef FIXED_DEBUG
|
|
||||||
#include "fixed_debug.h"
|
|
||||||
#else
|
|
||||||
|
|
||||||
#include "fixed_generic.h"
|
|
||||||
|
|
||||||
#ifdef ARM5E_ASM
|
|
||||||
#include "fixed_arm5e.h"
|
|
||||||
#elif defined (ARM4_ASM)
|
|
||||||
#include "fixed_arm4.h"
|
|
||||||
#elif defined (BFIN_ASM)
|
|
||||||
#include "fixed_bfin.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
typedef float spx_mem_t;
|
|
||||||
typedef float spx_coef_t;
|
|
||||||
typedef float spx_lsp_t;
|
|
||||||
typedef float spx_sig_t;
|
|
||||||
typedef float spx_word16_t;
|
|
||||||
typedef float spx_word32_t;
|
|
||||||
|
|
||||||
#define Q15ONE 1.0f
|
|
||||||
#define LPC_SCALING 1.f
|
|
||||||
#define SIG_SCALING 1.f
|
|
||||||
#define LSP_SCALING 1.f
|
|
||||||
#define GAMMA_SCALING 1.f
|
|
||||||
#define GAIN_SCALING 1.f
|
|
||||||
#define GAIN_SCALING_1 1.f
|
|
||||||
|
|
||||||
|
|
||||||
#define VERY_SMALL 1e-15f
|
|
||||||
#define VERY_LARGE32 1e15f
|
|
||||||
#define VERY_LARGE16 1e15f
|
|
||||||
#define Q15_ONE ((spx_word16_t)1.f)
|
|
||||||
|
|
||||||
#define QCONST16(x,bits) (x)
|
|
||||||
#define QCONST32(x,bits) (x)
|
|
||||||
|
|
||||||
#define NEG16(x) (-(x))
|
|
||||||
#define NEG32(x) (-(x))
|
|
||||||
#define EXTRACT16(x) (x)
|
|
||||||
#define EXTEND32(x) (x)
|
|
||||||
#define SHR16(a,shift) (a)
|
|
||||||
#define SHL16(a,shift) (a)
|
|
||||||
#define SHR32(a,shift) (a)
|
|
||||||
#define SHL32(a,shift) (a)
|
|
||||||
#define PSHR16(a,shift) (a)
|
|
||||||
#define PSHR32(a,shift) (a)
|
|
||||||
#define VSHR32(a,shift) (a)
|
|
||||||
#define SATURATE16(x,a) (x)
|
|
||||||
#define SATURATE32(x,a) (x)
|
|
||||||
#define SATURATE32PSHR(x,shift,a) (x)
|
|
||||||
|
|
||||||
#define PSHR(a,shift) (a)
|
|
||||||
#define SHR(a,shift) (a)
|
|
||||||
#define SHL(a,shift) (a)
|
|
||||||
#define SATURATE(x,a) (x)
|
|
||||||
|
|
||||||
#define ADD16(a,b) ((a)+(b))
|
|
||||||
#define SUB16(a,b) ((a)-(b))
|
|
||||||
#define ADD32(a,b) ((a)+(b))
|
|
||||||
#define SUB32(a,b) ((a)-(b))
|
|
||||||
#define MULT16_16_16(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16(a,b) ((spx_word32_t)(a)*(spx_word32_t)(b))
|
|
||||||
#define MAC16_16(c,a,b) ((c)+(spx_word32_t)(a)*(spx_word32_t)(b))
|
|
||||||
|
|
||||||
#define MULT16_32_Q11(a,b) ((a)*(b))
|
|
||||||
#define MULT16_32_Q13(a,b) ((a)*(b))
|
|
||||||
#define MULT16_32_Q14(a,b) ((a)*(b))
|
|
||||||
#define MULT16_32_Q15(a,b) ((a)*(b))
|
|
||||||
#define MULT16_32_P15(a,b) ((a)*(b))
|
|
||||||
|
|
||||||
#define MAC16_32_Q11(c,a,b) ((c)+(a)*(b))
|
|
||||||
#define MAC16_32_Q15(c,a,b) ((c)+(a)*(b))
|
|
||||||
|
|
||||||
#define MAC16_16_Q11(c,a,b) ((c)+(a)*(b))
|
|
||||||
#define MAC16_16_Q13(c,a,b) ((c)+(a)*(b))
|
|
||||||
#define MAC16_16_P13(c,a,b) ((c)+(a)*(b))
|
|
||||||
#define MULT16_16_Q11_32(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_Q13(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_Q14(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_Q15(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_P15(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_P13(a,b) ((a)*(b))
|
|
||||||
#define MULT16_16_P14(a,b) ((a)*(b))
|
|
||||||
|
|
||||||
#define DIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
|
|
||||||
#define PDIV32_16(a,b) (((spx_word32_t)(a))/(spx_word16_t)(b))
|
|
||||||
#define DIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
|
|
||||||
#define PDIV32(a,b) (((spx_word32_t)(a))/(spx_word32_t)(b))
|
|
||||||
|
|
||||||
#define WORD2INT(x) ((x) < -32767.5f ? -32768 : \
|
|
||||||
((x) > 32766.5f ? 32767 : (spx_int16_t)floor(.5 + (x))))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if defined (CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
|
|
||||||
|
|
||||||
/* 2 on TI C5x DSP */
|
|
||||||
#define BYTES_PER_CHAR 2
|
|
||||||
#define BITS_PER_CHAR 16
|
|
||||||
#define LOG2_BITS_PER_CHAR 4
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define BYTES_PER_CHAR 1
|
|
||||||
#define BITS_PER_CHAR 8
|
|
||||||
#define LOG2_BITS_PER_CHAR 3
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef FIXED_DEBUG
|
|
||||||
extern long long spx_mips;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
110
externals/cubeb/src/speex/fixed_generic.h
vendored
|
@ -1,110 +0,0 @@
|
||||||
/* Copyright (C) 2003 Jean-Marc Valin */
|
|
||||||
/**
|
|
||||||
@file fixed_generic.h
|
|
||||||
@brief Generic fixed-point operations
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef FIXED_GENERIC_H
|
|
||||||
#define FIXED_GENERIC_H
|
|
||||||
|
|
||||||
#define QCONST16(x,bits) ((spx_word16_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
|
|
||||||
#define QCONST32(x,bits) ((spx_word32_t)(.5+(x)*(((spx_word32_t)1)<<(bits))))
|
|
||||||
|
|
||||||
#define NEG16(x) (-(x))
|
|
||||||
#define NEG32(x) (-(x))
|
|
||||||
#define EXTRACT16(x) ((spx_word16_t)(x))
|
|
||||||
#define EXTEND32(x) ((spx_word32_t)(x))
|
|
||||||
#define SHR16(a,shift) ((a) >> (shift))
|
|
||||||
#define SHL16(a,shift) ((a) << (shift))
|
|
||||||
#define SHR32(a,shift) ((a) >> (shift))
|
|
||||||
#define SHL32(a,shift) ((a) << (shift))
|
|
||||||
#define PSHR16(a,shift) (SHR16((a)+((1<<((shift))>>1)),shift))
|
|
||||||
#define PSHR32(a,shift) (SHR32((a)+((EXTEND32(1)<<((shift))>>1)),shift))
|
|
||||||
#define VSHR32(a, shift) (((shift)>0) ? SHR32(a, shift) : SHL32(a, -(shift)))
|
|
||||||
#define SATURATE16(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
|
|
||||||
#define SATURATE32(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
|
|
||||||
|
|
||||||
#define SATURATE32PSHR(x,shift,a) (((x)>=(SHL32(a,shift))) ? (a) : \
|
|
||||||
(x)<=-(SHL32(a,shift)) ? -(a) : \
|
|
||||||
(PSHR32(x, shift)))
|
|
||||||
|
|
||||||
#define SHR(a,shift) ((a) >> (shift))
|
|
||||||
#define SHL(a,shift) ((spx_word32_t)(a) << (shift))
|
|
||||||
#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
|
|
||||||
#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
|
|
||||||
|
|
||||||
|
|
||||||
#define ADD16(a,b) ((spx_word16_t)((spx_word16_t)(a)+(spx_word16_t)(b)))
|
|
||||||
#define SUB16(a,b) ((spx_word16_t)(a)-(spx_word16_t)(b))
|
|
||||||
#define ADD32(a,b) ((spx_word32_t)(a)+(spx_word32_t)(b))
|
|
||||||
#define SUB32(a,b) ((spx_word32_t)(a)-(spx_word32_t)(b))
|
|
||||||
|
|
||||||
|
|
||||||
/* result fits in 16 bits */
|
|
||||||
#define MULT16_16_16(a,b) ((((spx_word16_t)(a))*((spx_word16_t)(b))))
|
|
||||||
|
|
||||||
/* (spx_word32_t)(spx_word16_t) gives TI compiler a hint that it's 16x16->32 multiply */
|
|
||||||
#define MULT16_16(a,b) (((spx_word32_t)(spx_word16_t)(a))*((spx_word32_t)(spx_word16_t)(b)))
|
|
||||||
|
|
||||||
#define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
|
|
||||||
#define MULT16_32_Q12(a,b) ADD32(MULT16_16((a),SHR((b),12)), SHR(MULT16_16((a),((b)&0x00000fff)),12))
|
|
||||||
#define MULT16_32_Q13(a,b) ADD32(MULT16_16((a),SHR((b),13)), SHR(MULT16_16((a),((b)&0x00001fff)),13))
|
|
||||||
#define MULT16_32_Q14(a,b) ADD32(MULT16_16((a),SHR((b),14)), SHR(MULT16_16((a),((b)&0x00003fff)),14))
|
|
||||||
|
|
||||||
#define MULT16_32_Q11(a,b) ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11))
|
|
||||||
#define MAC16_32_Q11(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),11)), SHR(MULT16_16((a),((b)&0x000007ff)),11)))
|
|
||||||
|
|
||||||
#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15))
|
|
||||||
#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))
|
|
||||||
#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)))
|
|
||||||
|
|
||||||
|
|
||||||
#define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11)))
|
|
||||||
#define MAC16_16_Q13(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),13)))
|
|
||||||
#define MAC16_16_P13(c,a,b) (ADD32((c),SHR(ADD32(4096,MULT16_16((a),(b))),13)))
|
|
||||||
|
|
||||||
#define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
|
|
||||||
#define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
|
|
||||||
#define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
|
|
||||||
#define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
|
|
||||||
|
|
||||||
#define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13))
|
|
||||||
#define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14))
|
|
||||||
#define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
|
|
||||||
|
|
||||||
#define MUL_16_32_R15(a,bh,bl) ADD32(MULT16_16((a),(bh)), SHR(MULT16_16((a),(bl)),15))
|
|
||||||
|
|
||||||
#define DIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a))/((spx_word16_t)(b))))
|
|
||||||
#define PDIV32_16(a,b) ((spx_word16_t)(((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word16_t)(b))))
|
|
||||||
#define DIV32(a,b) (((spx_word32_t)(a))/((spx_word32_t)(b)))
|
|
||||||
#define PDIV32(a,b) (((spx_word32_t)(a)+((spx_word16_t)(b)>>1))/((spx_word32_t)(b)))
|
|
||||||
|
|
||||||
#endif
|
|
1240
externals/cubeb/src/speex/resample.c
vendored
201
externals/cubeb/src/speex/resample_neon.h
vendored
|
@ -1,201 +0,0 @@
|
||||||
/* Copyright (C) 2007-2008 Jean-Marc Valin
|
|
||||||
* Copyright (C) 2008 Thorvald Natvig
|
|
||||||
* Copyright (C) 2011 Texas Instruments
|
|
||||||
* author Jyri Sarha
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
@file resample_neon.h
|
|
||||||
@brief Resampler functions (NEON version)
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <arm_neon.h>
|
|
||||||
|
|
||||||
#ifdef FIXED_POINT
|
|
||||||
#ifdef __thumb2__
|
|
||||||
static inline int32_t saturate_32bit_to_16bit(int32_t a) {
|
|
||||||
int32_t ret;
|
|
||||||
asm ("ssat %[ret], #16, %[a]"
|
|
||||||
: [ret] "=&r" (ret)
|
|
||||||
: [a] "r" (a)
|
|
||||||
: );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static inline int32_t saturate_32bit_to_16bit(int32_t a) {
|
|
||||||
int32_t ret;
|
|
||||||
asm ("vmov.s32 d0[0], %[a]\n"
|
|
||||||
"vqmovn.s32 d0, q0\n"
|
|
||||||
"vmov.s16 %[ret], d0[0]\n"
|
|
||||||
: [ret] "=&r" (ret)
|
|
||||||
: [a] "r" (a)
|
|
||||||
: "q0");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#undef WORD2INT
|
|
||||||
#define WORD2INT(x) (saturate_32bit_to_16bit(x))
|
|
||||||
|
|
||||||
#define OVERRIDE_INNER_PRODUCT_SINGLE
|
|
||||||
/* Only works when len % 4 == 0 */
|
|
||||||
static inline int32_t inner_product_single(const int16_t *a, const int16_t *b, unsigned int len)
|
|
||||||
{
|
|
||||||
int32_t ret;
|
|
||||||
uint32_t remainder = len % 16;
|
|
||||||
len = len - remainder;
|
|
||||||
|
|
||||||
asm volatile (" cmp %[len], #0\n"
|
|
||||||
" bne 1f\n"
|
|
||||||
" vld1.16 {d16}, [%[b]]!\n"
|
|
||||||
" vld1.16 {d20}, [%[a]]!\n"
|
|
||||||
" subs %[remainder], %[remainder], #4\n"
|
|
||||||
" vmull.s16 q0, d16, d20\n"
|
|
||||||
" beq 5f\n"
|
|
||||||
" b 4f\n"
|
|
||||||
"1:"
|
|
||||||
" vld1.16 {d16, d17, d18, d19}, [%[b]]!\n"
|
|
||||||
" vld1.16 {d20, d21, d22, d23}, [%[a]]!\n"
|
|
||||||
" subs %[len], %[len], #16\n"
|
|
||||||
" vmull.s16 q0, d16, d20\n"
|
|
||||||
" vmlal.s16 q0, d17, d21\n"
|
|
||||||
" vmlal.s16 q0, d18, d22\n"
|
|
||||||
" vmlal.s16 q0, d19, d23\n"
|
|
||||||
" beq 3f\n"
|
|
||||||
"2:"
|
|
||||||
" vld1.16 {d16, d17, d18, d19}, [%[b]]!\n"
|
|
||||||
" vld1.16 {d20, d21, d22, d23}, [%[a]]!\n"
|
|
||||||
" subs %[len], %[len], #16\n"
|
|
||||||
" vmlal.s16 q0, d16, d20\n"
|
|
||||||
" vmlal.s16 q0, d17, d21\n"
|
|
||||||
" vmlal.s16 q0, d18, d22\n"
|
|
||||||
" vmlal.s16 q0, d19, d23\n"
|
|
||||||
" bne 2b\n"
|
|
||||||
"3:"
|
|
||||||
" cmp %[remainder], #0\n"
|
|
||||||
" beq 5f\n"
|
|
||||||
"4:"
|
|
||||||
" vld1.16 {d16}, [%[b]]!\n"
|
|
||||||
" vld1.16 {d20}, [%[a]]!\n"
|
|
||||||
" subs %[remainder], %[remainder], #4\n"
|
|
||||||
" vmlal.s16 q0, d16, d20\n"
|
|
||||||
" bne 4b\n"
|
|
||||||
"5:"
|
|
||||||
" vaddl.s32 q0, d0, d1\n"
|
|
||||||
" vadd.s64 d0, d0, d1\n"
|
|
||||||
" vqmovn.s64 d0, q0\n"
|
|
||||||
" vqrshrn.s32 d0, q0, #15\n"
|
|
||||||
" vmov.s16 %[ret], d0[0]\n"
|
|
||||||
: [ret] "=&r" (ret), [a] "+r" (a), [b] "+r" (b),
|
|
||||||
[len] "+r" (len), [remainder] "+r" (remainder)
|
|
||||||
:
|
|
||||||
: "cc", "q0",
|
|
||||||
"d16", "d17", "d18", "d19",
|
|
||||||
"d20", "d21", "d22", "d23");
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#elif defined(FLOATING_POINT)
|
|
||||||
|
|
||||||
static inline int32_t saturate_float_to_16bit(float a) {
|
|
||||||
int32_t ret;
|
|
||||||
asm ("vmov.f32 d0[0], %[a]\n"
|
|
||||||
"vcvt.s32.f32 d0, d0, #15\n"
|
|
||||||
"vqrshrn.s32 d0, q0, #15\n"
|
|
||||||
"vmov.s16 %[ret], d0[0]\n"
|
|
||||||
: [ret] "=&r" (ret)
|
|
||||||
: [a] "r" (a)
|
|
||||||
: "q0");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#undef WORD2INT
|
|
||||||
#define WORD2INT(x) (saturate_float_to_16bit(x))
|
|
||||||
|
|
||||||
#define OVERRIDE_INNER_PRODUCT_SINGLE
|
|
||||||
/* Only works when len % 4 == 0 */
|
|
||||||
static inline float inner_product_single(const float *a, const float *b, unsigned int len)
|
|
||||||
{
|
|
||||||
float ret;
|
|
||||||
uint32_t remainder = len % 16;
|
|
||||||
len = len - remainder;
|
|
||||||
|
|
||||||
asm volatile (" cmp %[len], #0\n"
|
|
||||||
" bne 1f\n"
|
|
||||||
" vld1.32 {q4}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q8}, [%[a]]!\n"
|
|
||||||
" subs %[remainder], %[remainder], #4\n"
|
|
||||||
" vmul.f32 q0, q4, q8\n"
|
|
||||||
" bne 4f\n"
|
|
||||||
" b 5f\n"
|
|
||||||
"1:"
|
|
||||||
" vld1.32 {q4, q5}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q8, q9}, [%[a]]!\n"
|
|
||||||
" vld1.32 {q6, q7}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q10, q11}, [%[a]]!\n"
|
|
||||||
" subs %[len], %[len], #16\n"
|
|
||||||
" vmul.f32 q0, q4, q8\n"
|
|
||||||
" vmul.f32 q1, q5, q9\n"
|
|
||||||
" vmul.f32 q2, q6, q10\n"
|
|
||||||
" vmul.f32 q3, q7, q11\n"
|
|
||||||
" beq 3f\n"
|
|
||||||
"2:"
|
|
||||||
" vld1.32 {q4, q5}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q8, q9}, [%[a]]!\n"
|
|
||||||
" vld1.32 {q6, q7}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q10, q11}, [%[a]]!\n"
|
|
||||||
" subs %[len], %[len], #16\n"
|
|
||||||
" vmla.f32 q0, q4, q8\n"
|
|
||||||
" vmla.f32 q1, q5, q9\n"
|
|
||||||
" vmla.f32 q2, q6, q10\n"
|
|
||||||
" vmla.f32 q3, q7, q11\n"
|
|
||||||
" bne 2b\n"
|
|
||||||
"3:"
|
|
||||||
" vadd.f32 q4, q0, q1\n"
|
|
||||||
" vadd.f32 q5, q2, q3\n"
|
|
||||||
" cmp %[remainder], #0\n"
|
|
||||||
" vadd.f32 q0, q4, q5\n"
|
|
||||||
" beq 5f\n"
|
|
||||||
"4:"
|
|
||||||
" vld1.32 {q6}, [%[b]]!\n"
|
|
||||||
" vld1.32 {q10}, [%[a]]!\n"
|
|
||||||
" subs %[remainder], %[remainder], #4\n"
|
|
||||||
" vmla.f32 q0, q6, q10\n"
|
|
||||||
" bne 4b\n"
|
|
||||||
"5:"
|
|
||||||
" vadd.f32 d0, d0, d1\n"
|
|
||||||
" vpadd.f32 d0, d0, d0\n"
|
|
||||||
" vmov.f32 %[ret], d0[0]\n"
|
|
||||||
: [ret] "=&r" (ret), [a] "+r" (a), [b] "+r" (b),
|
|
||||||
[len] "+l" (len), [remainder] "+l" (remainder)
|
|
||||||
:
|
|
||||||
: "cc", "q0", "q1", "q2", "q3", "q4", "q5", "q6", "q7", "q8",
|
|
||||||
"q9", "q10", "q11");
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
128
externals/cubeb/src/speex/resample_sse.h
vendored
|
@ -1,128 +0,0 @@
|
||||||
/* Copyright (C) 2007-2008 Jean-Marc Valin
|
|
||||||
* Copyright (C) 2008 Thorvald Natvig
|
|
||||||
*/
|
|
||||||
/**
|
|
||||||
@file resample_sse.h
|
|
||||||
@brief Resampler functions (SSE version)
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <xmmintrin.h>
|
|
||||||
|
|
||||||
#define OVERRIDE_INNER_PRODUCT_SINGLE
|
|
||||||
static inline float inner_product_single(const float *a, const float *b, unsigned int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
float ret;
|
|
||||||
__m128 sum = _mm_setzero_ps();
|
|
||||||
for (i=0;i<len;i+=8)
|
|
||||||
{
|
|
||||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i)));
|
|
||||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4)));
|
|
||||||
}
|
|
||||||
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
|
|
||||||
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
|
|
||||||
_mm_store_ss(&ret, sum);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define OVERRIDE_INTERPOLATE_PRODUCT_SINGLE
|
|
||||||
static inline float interpolate_product_single(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
|
|
||||||
int i;
|
|
||||||
float ret;
|
|
||||||
__m128 sum = _mm_setzero_ps();
|
|
||||||
__m128 f = _mm_loadu_ps(frac);
|
|
||||||
for(i=0;i<len;i+=2)
|
|
||||||
{
|
|
||||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample)));
|
|
||||||
sum = _mm_add_ps(sum, _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample)));
|
|
||||||
}
|
|
||||||
sum = _mm_mul_ps(f, sum);
|
|
||||||
sum = _mm_add_ps(sum, _mm_movehl_ps(sum, sum));
|
|
||||||
sum = _mm_add_ss(sum, _mm_shuffle_ps(sum, sum, 0x55));
|
|
||||||
_mm_store_ss(&ret, sum);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef _USE_SSE2
|
|
||||||
#include <emmintrin.h>
|
|
||||||
#define OVERRIDE_INNER_PRODUCT_DOUBLE
|
|
||||||
|
|
||||||
static inline double inner_product_double(const float *a, const float *b, unsigned int len)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
double ret;
|
|
||||||
__m128d sum = _mm_setzero_pd();
|
|
||||||
__m128 t;
|
|
||||||
for (i=0;i<len;i+=8)
|
|
||||||
{
|
|
||||||
t = _mm_mul_ps(_mm_loadu_ps(a+i), _mm_loadu_ps(b+i));
|
|
||||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
|
|
||||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
|
||||||
|
|
||||||
t = _mm_mul_ps(_mm_loadu_ps(a+i+4), _mm_loadu_ps(b+i+4));
|
|
||||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(t));
|
|
||||||
sum = _mm_add_pd(sum, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
|
||||||
}
|
|
||||||
sum = _mm_add_sd(sum, _mm_unpackhi_pd(sum, sum));
|
|
||||||
_mm_store_sd(&ret, sum);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define OVERRIDE_INTERPOLATE_PRODUCT_DOUBLE
|
|
||||||
static inline double interpolate_product_double(const float *a, const float *b, unsigned int len, const spx_uint32_t oversample, float *frac) {
|
|
||||||
int i;
|
|
||||||
double ret;
|
|
||||||
__m128d sum;
|
|
||||||
__m128d sum1 = _mm_setzero_pd();
|
|
||||||
__m128d sum2 = _mm_setzero_pd();
|
|
||||||
__m128 f = _mm_loadu_ps(frac);
|
|
||||||
__m128d f1 = _mm_cvtps_pd(f);
|
|
||||||
__m128d f2 = _mm_cvtps_pd(_mm_movehl_ps(f,f));
|
|
||||||
__m128 t;
|
|
||||||
for(i=0;i<len;i+=2)
|
|
||||||
{
|
|
||||||
t = _mm_mul_ps(_mm_load1_ps(a+i), _mm_loadu_ps(b+i*oversample));
|
|
||||||
sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
|
|
||||||
sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
|
||||||
|
|
||||||
t = _mm_mul_ps(_mm_load1_ps(a+i+1), _mm_loadu_ps(b+(i+1)*oversample));
|
|
||||||
sum1 = _mm_add_pd(sum1, _mm_cvtps_pd(t));
|
|
||||||
sum2 = _mm_add_pd(sum2, _mm_cvtps_pd(_mm_movehl_ps(t, t)));
|
|
||||||
}
|
|
||||||
sum1 = _mm_mul_pd(f1, sum1);
|
|
||||||
sum2 = _mm_mul_pd(f2, sum2);
|
|
||||||
sum = _mm_add_pd(sum1, sum2);
|
|
||||||
sum = _mm_add_sd(sum, _mm_unpackhi_pd(sum, sum));
|
|
||||||
_mm_store_sd(&ret, sum);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
10
externals/cubeb/src/speex/speex_config_types.h
vendored
|
@ -1,10 +0,0 @@
|
||||||
#ifndef __SPEEX_TYPES_H__
|
|
||||||
#define __SPEEX_TYPES_H__
|
|
||||||
|
|
||||||
/* these are filled in by configure */
|
|
||||||
typedef int16_t spx_int16_t;
|
|
||||||
typedef uint16_t spx_uint16_t;
|
|
||||||
typedef int32_t spx_int32_t;
|
|
||||||
typedef uint32_t spx_uint32_t;
|
|
||||||
|
|
||||||
#endif
|
|
343
externals/cubeb/src/speex/speex_resampler.h
vendored
|
@ -1,343 +0,0 @@
|
||||||
/* Copyright (C) 2007 Jean-Marc Valin
|
|
||||||
|
|
||||||
File: speex_resampler.h
|
|
||||||
Resampling code
|
|
||||||
|
|
||||||
The design goals of this code are:
|
|
||||||
- Very fast algorithm
|
|
||||||
- Low memory requirement
|
|
||||||
- Good *perceptual* quality (and not best SNR)
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are
|
|
||||||
met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. The name of the author may not be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
|
||||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
||||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
|
||||||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
||||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SPEEX_RESAMPLER_H
|
|
||||||
#define SPEEX_RESAMPLER_H
|
|
||||||
|
|
||||||
#ifdef OUTSIDE_SPEEX
|
|
||||||
|
|
||||||
/********* WARNING: MENTAL SANITY ENDS HERE *************/
|
|
||||||
|
|
||||||
/* If the resampler is defined outside of Speex, we change the symbol names so that
|
|
||||||
there won't be any clash if linking with Speex later on. */
|
|
||||||
|
|
||||||
/* #define RANDOM_PREFIX your software name here */
|
|
||||||
#ifndef RANDOM_PREFIX
|
|
||||||
#error "Please define RANDOM_PREFIX (above) to something specific to your project to prevent symbol name clashes"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CAT_PREFIX2(a,b) a ## b
|
|
||||||
#define CAT_PREFIX(a,b) CAT_PREFIX2(a, b)
|
|
||||||
|
|
||||||
#define speex_resampler_init CAT_PREFIX(RANDOM_PREFIX,_resampler_init)
|
|
||||||
#define speex_resampler_init_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_init_frac)
|
|
||||||
#define speex_resampler_destroy CAT_PREFIX(RANDOM_PREFIX,_resampler_destroy)
|
|
||||||
#define speex_resampler_process_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_float)
|
|
||||||
#define speex_resampler_process_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_int)
|
|
||||||
#define speex_resampler_process_interleaved_float CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_float)
|
|
||||||
#define speex_resampler_process_interleaved_int CAT_PREFIX(RANDOM_PREFIX,_resampler_process_interleaved_int)
|
|
||||||
#define speex_resampler_set_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate)
|
|
||||||
#define speex_resampler_get_rate CAT_PREFIX(RANDOM_PREFIX,_resampler_get_rate)
|
|
||||||
#define speex_resampler_set_rate_frac CAT_PREFIX(RANDOM_PREFIX,_resampler_set_rate_frac)
|
|
||||||
#define speex_resampler_get_ratio CAT_PREFIX(RANDOM_PREFIX,_resampler_get_ratio)
|
|
||||||
#define speex_resampler_set_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_set_quality)
|
|
||||||
#define speex_resampler_get_quality CAT_PREFIX(RANDOM_PREFIX,_resampler_get_quality)
|
|
||||||
#define speex_resampler_set_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_input_stride)
|
|
||||||
#define speex_resampler_get_input_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_stride)
|
|
||||||
#define speex_resampler_set_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_set_output_stride)
|
|
||||||
#define speex_resampler_get_output_stride CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_stride)
|
|
||||||
#define speex_resampler_get_input_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_input_latency)
|
|
||||||
#define speex_resampler_get_output_latency CAT_PREFIX(RANDOM_PREFIX,_resampler_get_output_latency)
|
|
||||||
#define speex_resampler_skip_zeros CAT_PREFIX(RANDOM_PREFIX,_resampler_skip_zeros)
|
|
||||||
#define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
|
|
||||||
#define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
|
|
||||||
|
|
||||||
#define spx_int16_t short
|
|
||||||
#define spx_int32_t int
|
|
||||||
#define spx_uint16_t unsigned short
|
|
||||||
#define spx_uint32_t unsigned int
|
|
||||||
|
|
||||||
#define speex_assert(cond)
|
|
||||||
|
|
||||||
#else /* OUTSIDE_SPEEX */
|
|
||||||
|
|
||||||
#include "speexdsp_types.h"
|
|
||||||
|
|
||||||
#endif /* OUTSIDE_SPEEX */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define SPEEX_RESAMPLER_QUALITY_MAX 10
|
|
||||||
#define SPEEX_RESAMPLER_QUALITY_MIN 0
|
|
||||||
#define SPEEX_RESAMPLER_QUALITY_DEFAULT 4
|
|
||||||
#define SPEEX_RESAMPLER_QUALITY_VOIP 3
|
|
||||||
#define SPEEX_RESAMPLER_QUALITY_DESKTOP 5
|
|
||||||
|
|
||||||
enum {
|
|
||||||
RESAMPLER_ERR_SUCCESS = 0,
|
|
||||||
RESAMPLER_ERR_ALLOC_FAILED = 1,
|
|
||||||
RESAMPLER_ERR_BAD_STATE = 2,
|
|
||||||
RESAMPLER_ERR_INVALID_ARG = 3,
|
|
||||||
RESAMPLER_ERR_PTR_OVERLAP = 4,
|
|
||||||
RESAMPLER_ERR_OVERFLOW = 5,
|
|
||||||
|
|
||||||
RESAMPLER_ERR_MAX_ERROR
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SpeexResamplerState_;
|
|
||||||
typedef struct SpeexResamplerState_ SpeexResamplerState;
|
|
||||||
|
|
||||||
/** Create a new resampler with integer input and output rates.
|
|
||||||
* @param nb_channels Number of channels to be processed
|
|
||||||
* @param in_rate Input sampling rate (integer number of Hz).
|
|
||||||
* @param out_rate Output sampling rate (integer number of Hz).
|
|
||||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
|
||||||
* and 10 has very high quality.
|
|
||||||
* @return Newly created resampler state
|
|
||||||
* @retval NULL Error: not enough memory
|
|
||||||
*/
|
|
||||||
SpeexResamplerState *speex_resampler_init(spx_uint32_t nb_channels,
|
|
||||||
spx_uint32_t in_rate,
|
|
||||||
spx_uint32_t out_rate,
|
|
||||||
int quality,
|
|
||||||
int *err);
|
|
||||||
|
|
||||||
/** Create a new resampler with fractional input/output rates. The sampling
|
|
||||||
* rate ratio is an arbitrary rational number with both the numerator and
|
|
||||||
* denominator being 32-bit integers.
|
|
||||||
* @param nb_channels Number of channels to be processed
|
|
||||||
* @param ratio_num Numerator of the sampling rate ratio
|
|
||||||
* @param ratio_den Denominator of the sampling rate ratio
|
|
||||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
|
||||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
|
||||||
* @param quality Resampling quality between 0 and 10, where 0 has poor quality
|
|
||||||
* and 10 has very high quality.
|
|
||||||
* @return Newly created resampler state
|
|
||||||
* @retval NULL Error: not enough memory
|
|
||||||
*/
|
|
||||||
SpeexResamplerState *speex_resampler_init_frac(spx_uint32_t nb_channels,
|
|
||||||
spx_uint32_t ratio_num,
|
|
||||||
spx_uint32_t ratio_den,
|
|
||||||
spx_uint32_t in_rate,
|
|
||||||
spx_uint32_t out_rate,
|
|
||||||
int quality,
|
|
||||||
int *err);
|
|
||||||
|
|
||||||
/** Destroy a resampler state.
|
|
||||||
* @param st Resampler state
|
|
||||||
*/
|
|
||||||
void speex_resampler_destroy(SpeexResamplerState *st);
|
|
||||||
|
|
||||||
/** Resample a float array. The input and output buffers must *not* overlap.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param channel_index Index of the channel to process for the multi-channel
|
|
||||||
* base (0 otherwise)
|
|
||||||
* @param in Input buffer
|
|
||||||
* @param in_len Number of input samples in the input buffer. Returns the
|
|
||||||
* number of samples processed
|
|
||||||
* @param out Output buffer
|
|
||||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
|
||||||
*/
|
|
||||||
int speex_resampler_process_float(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t channel_index,
|
|
||||||
const float *in,
|
|
||||||
spx_uint32_t *in_len,
|
|
||||||
float *out,
|
|
||||||
spx_uint32_t *out_len);
|
|
||||||
|
|
||||||
/** Resample an int array. The input and output buffers must *not* overlap.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param channel_index Index of the channel to process for the multi-channel
|
|
||||||
* base (0 otherwise)
|
|
||||||
* @param in Input buffer
|
|
||||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
|
||||||
* of samples processed
|
|
||||||
* @param out Output buffer
|
|
||||||
* @param out_len Size of the output buffer. Returns the number of samples written
|
|
||||||
*/
|
|
||||||
int speex_resampler_process_int(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t channel_index,
|
|
||||||
const spx_int16_t *in,
|
|
||||||
spx_uint32_t *in_len,
|
|
||||||
spx_int16_t *out,
|
|
||||||
spx_uint32_t *out_len);
|
|
||||||
|
|
||||||
/** Resample an interleaved float array. The input and output buffers must *not* overlap.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param in Input buffer
|
|
||||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
|
||||||
* of samples processed. This is all per-channel.
|
|
||||||
* @param out Output buffer
|
|
||||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
|
||||||
* This is all per-channel.
|
|
||||||
*/
|
|
||||||
int speex_resampler_process_interleaved_float(SpeexResamplerState *st,
|
|
||||||
const float *in,
|
|
||||||
spx_uint32_t *in_len,
|
|
||||||
float *out,
|
|
||||||
spx_uint32_t *out_len);
|
|
||||||
|
|
||||||
/** Resample an interleaved int array. The input and output buffers must *not* overlap.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param in Input buffer
|
|
||||||
* @param in_len Number of input samples in the input buffer. Returns the number
|
|
||||||
* of samples processed. This is all per-channel.
|
|
||||||
* @param out Output buffer
|
|
||||||
* @param out_len Size of the output buffer. Returns the number of samples written.
|
|
||||||
* This is all per-channel.
|
|
||||||
*/
|
|
||||||
int speex_resampler_process_interleaved_int(SpeexResamplerState *st,
|
|
||||||
const spx_int16_t *in,
|
|
||||||
spx_uint32_t *in_len,
|
|
||||||
spx_int16_t *out,
|
|
||||||
spx_uint32_t *out_len);
|
|
||||||
|
|
||||||
/** Set (change) the input/output sampling rates (integer value).
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param in_rate Input sampling rate (integer number of Hz).
|
|
||||||
* @param out_rate Output sampling rate (integer number of Hz).
|
|
||||||
*/
|
|
||||||
int speex_resampler_set_rate(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t in_rate,
|
|
||||||
spx_uint32_t out_rate);
|
|
||||||
|
|
||||||
/** Get the current input/output sampling rates (integer value).
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param in_rate Input sampling rate (integer number of Hz) copied.
|
|
||||||
* @param out_rate Output sampling rate (integer number of Hz) copied.
|
|
||||||
*/
|
|
||||||
void speex_resampler_get_rate(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t *in_rate,
|
|
||||||
spx_uint32_t *out_rate);
|
|
||||||
|
|
||||||
/** Set (change) the input/output sampling rates and resampling ratio
|
|
||||||
* (fractional values in Hz supported).
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param ratio_num Numerator of the sampling rate ratio
|
|
||||||
* @param ratio_den Denominator of the sampling rate ratio
|
|
||||||
* @param in_rate Input sampling rate rounded to the nearest integer (in Hz).
|
|
||||||
* @param out_rate Output sampling rate rounded to the nearest integer (in Hz).
|
|
||||||
*/
|
|
||||||
int speex_resampler_set_rate_frac(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t ratio_num,
|
|
||||||
spx_uint32_t ratio_den,
|
|
||||||
spx_uint32_t in_rate,
|
|
||||||
spx_uint32_t out_rate);
|
|
||||||
|
|
||||||
/** Get the current resampling ratio. This will be reduced to the least
|
|
||||||
* common denominator.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param ratio_num Numerator of the sampling rate ratio copied
|
|
||||||
* @param ratio_den Denominator of the sampling rate ratio copied
|
|
||||||
*/
|
|
||||||
void speex_resampler_get_ratio(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t *ratio_num,
|
|
||||||
spx_uint32_t *ratio_den);
|
|
||||||
|
|
||||||
/** Set (change) the conversion quality.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
|
||||||
* quality and 10 has very high quality.
|
|
||||||
*/
|
|
||||||
int speex_resampler_set_quality(SpeexResamplerState *st,
|
|
||||||
int quality);
|
|
||||||
|
|
||||||
/** Get the conversion quality.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param quality Resampling quality between 0 and 10, where 0 has poor
|
|
||||||
* quality and 10 has very high quality.
|
|
||||||
*/
|
|
||||||
void speex_resampler_get_quality(SpeexResamplerState *st,
|
|
||||||
int *quality);
|
|
||||||
|
|
||||||
/** Set (change) the input stride.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param stride Input stride
|
|
||||||
*/
|
|
||||||
void speex_resampler_set_input_stride(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t stride);
|
|
||||||
|
|
||||||
/** Get the input stride.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param stride Input stride copied
|
|
||||||
*/
|
|
||||||
void speex_resampler_get_input_stride(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t *stride);
|
|
||||||
|
|
||||||
/** Set (change) the output stride.
|
|
||||||
* @param st Resampler state
|
|
||||||
* @param stride Output stride
|
|
||||||
*/
|
|
||||||
void speex_resampler_set_output_stride(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t stride);
|
|
||||||
|
|
||||||
/** Get the output stride.
|
|
||||||
* @param st Resampler state copied
|
|
||||||
* @param stride Output stride
|
|
||||||
*/
|
|
||||||
void speex_resampler_get_output_stride(SpeexResamplerState *st,
|
|
||||||
spx_uint32_t *stride);
|
|
||||||
|
|
||||||
/** Get the latency introduced by the resampler measured in input samples.
|
|
||||||
* @param st Resampler state
|
|
||||||
*/
|
|
||||||
int speex_resampler_get_input_latency(SpeexResamplerState *st);
|
|
||||||
|
|
||||||
/** Get the latency introduced by the resampler measured in output samples.
|
|
||||||
* @param st Resampler state
|
|
||||||
*/
|
|
||||||
int speex_resampler_get_output_latency(SpeexResamplerState *st);
|
|
||||||
|
|
||||||
/** Make sure that the first samples to go out of the resamplers don't have
|
|
||||||
* leading zeros. This is only useful before starting to use a newly created
|
|
||||||
* resampler. It is recommended to use that when resampling an audio file, as
|
|
||||||
* it will generate a file with the same length. For real-time processing,
|
|
||||||
* it is probably easier not to use this call (so that the output duration
|
|
||||||
* is the same for the first frame).
|
|
||||||
* @param st Resampler state
|
|
||||||
*/
|
|
||||||
int speex_resampler_skip_zeros(SpeexResamplerState *st);
|
|
||||||
|
|
||||||
/** Reset a resampler so a new (unrelated) stream can be processed.
|
|
||||||
* @param st Resampler state
|
|
||||||
*/
|
|
||||||
int speex_resampler_reset_mem(SpeexResamplerState *st);
|
|
||||||
|
|
||||||
/** Returns the English meaning for an error code
|
|
||||||
* @param err Error code
|
|
||||||
* @return English string
|
|
||||||
*/
|
|
||||||
const char *speex_resampler_strerror(int err);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
115
externals/cubeb/src/speex/stack_alloc.h
vendored
|
@ -1,115 +0,0 @@
|
||||||
/* Copyright (C) 2002 Jean-Marc Valin */
|
|
||||||
/**
|
|
||||||
@file stack_alloc.h
|
|
||||||
@brief Temporary memory allocation on stack
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
- Neither the name of the Xiph.org Foundation nor the names of its
|
|
||||||
contributors may be used to endorse or promote products derived from
|
|
||||||
this software without specific prior written permission.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
|
|
||||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
||||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
||||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
||||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
||||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
||||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef STACK_ALLOC_H
|
|
||||||
#define STACK_ALLOC_H
|
|
||||||
|
|
||||||
#ifdef USE_ALLOCA
|
|
||||||
# ifdef WIN32
|
|
||||||
# include <malloc.h>
|
|
||||||
# else
|
|
||||||
# ifdef HAVE_ALLOCA_H
|
|
||||||
# include <alloca.h>
|
|
||||||
# else
|
|
||||||
# include <stdlib.h>
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def ALIGN(stack, size)
|
|
||||||
*
|
|
||||||
* Aligns the stack to a 'size' boundary
|
|
||||||
*
|
|
||||||
* @param stack Stack
|
|
||||||
* @param size New size boundary
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def PUSH(stack, size, type)
|
|
||||||
*
|
|
||||||
* Allocates 'size' elements of type 'type' on the stack
|
|
||||||
*
|
|
||||||
* @param stack Stack
|
|
||||||
* @param size Number of elements
|
|
||||||
* @param type Type of element
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def VARDECL(var)
|
|
||||||
*
|
|
||||||
* Declare variable on stack
|
|
||||||
*
|
|
||||||
* @param var Variable to declare
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @def ALLOC(var, size, type)
|
|
||||||
*
|
|
||||||
* Allocate 'size' elements of 'type' on stack
|
|
||||||
*
|
|
||||||
* @param var Name of variable to allocate
|
|
||||||
* @param size Number of elements
|
|
||||||
* @param type Type of element
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef ENABLE_VALGRIND
|
|
||||||
|
|
||||||
#include <valgrind/memcheck.h>
|
|
||||||
|
|
||||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
|
||||||
|
|
||||||
#define PUSH(stack, size, type) (VALGRIND_MAKE_NOACCESS(stack, 1000),ALIGN((stack),sizeof(type)),VALGRIND_MAKE_WRITABLE(stack, ((size)*sizeof(type))),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
#define ALIGN(stack, size) ((stack) += ((size) - (long)(stack)) & ((size) - 1))
|
|
||||||
|
|
||||||
#define PUSH(stack, size, type) (ALIGN((stack),sizeof(type)),(stack)+=((size)*sizeof(type)),(type*)((stack)-((size)*sizeof(type))))
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(VAR_ARRAYS)
|
|
||||||
#define VARDECL(var)
|
|
||||||
#define ALLOC(var, size, type) type var[size]
|
|
||||||
#elif defined(USE_ALLOCA)
|
|
||||||
#define VARDECL(var) var
|
|
||||||
#define ALLOC(var, size, type) var = alloca(sizeof(type)*(size))
|
|
||||||
#else
|
|
||||||
#define VARDECL(var) var
|
|
||||||
#define ALLOC(var, size, type) var = PUSH(stack, size, type)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
66
externals/dynarmic/.travis.yml
vendored
|
@ -1,66 +0,0 @@
|
||||||
language: cpp
|
|
||||||
|
|
||||||
cache: ccache
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
- env: NAME="Linux Build" GCC_VERSION=7
|
|
||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- gcc-7
|
|
||||||
- g++-7
|
|
||||||
- ninja-build
|
|
||||||
install: ./.travis/build-x86_64-linux/deps.sh
|
|
||||||
script: ./.travis/build-x86_64-linux/build.sh
|
|
||||||
- env: NAME="Linux Build" GCC_VERSION=8
|
|
||||||
os: linux
|
|
||||||
dist: trusty
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- gcc-8
|
|
||||||
- g++-8
|
|
||||||
- ninja-build
|
|
||||||
install: ./.travis/build-x86_64-linux/deps.sh
|
|
||||||
script: ./.travis/build-x86_64-linux/build.sh
|
|
||||||
- env: NAME="macOS Build"
|
|
||||||
os: osx
|
|
||||||
sudo: false
|
|
||||||
osx_image: xcode10.2
|
|
||||||
install: ./.travis/build-x86_64-macos/deps.sh
|
|
||||||
script: ./.travis/build-x86_64-macos/build.sh
|
|
||||||
- env: NAME="Test - Fuzz against Unicorn"
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- gcc-7
|
|
||||||
- g++-7
|
|
||||||
- llvm-dev
|
|
||||||
- ninja-build
|
|
||||||
install: ./.travis/test-with-unicorn-on-x86_64-linux/deps.sh
|
|
||||||
script: ./.travis/test-with-unicorn-on-x86_64-linux/build.sh
|
|
||||||
- env: NAME="Test - SSE3 only"
|
|
||||||
os: linux
|
|
||||||
dist: bionic
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- gcc-7
|
|
||||||
- g++-7
|
|
||||||
- llvm-dev
|
|
||||||
- ninja-build
|
|
||||||
install: ./.travis/sse3-only-on-x86_64-linux/deps.sh
|
|
||||||
script: ./.travis/sse3-only-on-x86_64-linux/build.sh
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
export CC=gcc-7
|
|
||||||
export CXX=g++-7
|
|
||||||
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
export UNICORNDIR=$(pwd)/externals/unicorn
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake .. -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DCMAKE_BUILD_TYPE=Release -DDYNARMIC_USE_LLVM=1 -DDYNARMIC_TESTS_USE_UNICORN=1 -DDYNARMIC_ENABLE_CPU_FEATURE_DETECTION=0 -G Ninja
|
|
||||||
ninja
|
|
||||||
|
|
||||||
./tests/dynarmic_tests --durations yes
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
python3 --version
|
|
||||||
|
|
||||||
# TODO: This isn't ideal.
|
|
||||||
cd externals
|
|
||||||
git clone https://github.com/MerryMage/ext-boost
|
|
||||||
git clone https://github.com/MerryMage/unicorn
|
|
||||||
cd unicorn
|
|
||||||
UNICORN_ARCHS=aarch64,arm ./make.sh
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
mkdir -p $HOME/.local
|
|
||||||
curl -L https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz \
|
|
||||||
| tar -xz -C $HOME/.local --strip-components=1
|
|
|
@ -1,15 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
export CC=gcc-7
|
|
||||||
export CXX=g++-7
|
|
||||||
export PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:$PKG_CONFIG_PATH
|
|
||||||
export UNICORNDIR=$(pwd)/externals/unicorn
|
|
||||||
|
|
||||||
mkdir build && cd build
|
|
||||||
cmake .. -DBoost_INCLUDE_DIRS=${PWD}/../externals/ext-boost -DCMAKE_BUILD_TYPE=Release -DDYNARMIC_USE_LLVM=1 -DDYNARMIC_TESTS_USE_UNICORN=1 -G Ninja
|
|
||||||
ninja
|
|
||||||
|
|
||||||
./tests/dynarmic_tests --durations yes
|
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
set -x
|
|
||||||
|
|
||||||
python3 --version
|
|
||||||
|
|
||||||
# TODO: This isn't ideal.
|
|
||||||
cd externals
|
|
||||||
git clone https://github.com/MerryMage/ext-boost
|
|
||||||
git clone https://github.com/MerryMage/unicorn
|
|
||||||
cd unicorn
|
|
||||||
UNICORN_ARCHS="arm aarch64" ./make.sh
|
|
||||||
cd ../..
|
|
||||||
|
|
||||||
mkdir -p $HOME/.local
|
|
||||||
curl -L https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.tar.gz \
|
|
||||||
| tar -xz -C $HOME/.local --strip-components=1
|
|
17802
externals/dynarmic/externals/catch/catch.hpp
vendored
101
externals/dynarmic/externals/fmt/.travis.yml
vendored
|
@ -1,101 +0,0 @@
|
||||||
language: cpp
|
|
||||||
dist: trusty
|
|
||||||
sudo: false
|
|
||||||
|
|
||||||
os: linux
|
|
||||||
|
|
||||||
git:
|
|
||||||
depth: 1
|
|
||||||
|
|
||||||
env:
|
|
||||||
global:
|
|
||||||
- secure: |-
|
|
||||||
a1eovNn4uol9won7ghr67eD3/59oeESN+G9bWE+ecI1V6yRseG9whniGhIpC/YfMW/Qz5I
|
|
||||||
5sxSmFjaw9bxCISNwUIrL1O5x2AmRYTnFcXk4dFsUvlZg+WeF/aKyBYCNRM8C2ndbBmtAO
|
|
||||||
o1F2EwFbiso0EmtzhAPs19ujiVxkLn4=
|
|
||||||
|
|
||||||
matrix:
|
|
||||||
include:
|
|
||||||
# Documentation
|
|
||||||
- env: BUILD=Doc
|
|
||||||
sudo: required
|
|
||||||
# g++ 6 on Linux with C++14
|
|
||||||
- env: COMPILER=g++-6 BUILD=Debug STANDARD=14
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
- env: COMPILER=g++-6 BUILD=Release STANDARD=14
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-6
|
|
||||||
# g++ 8 on Linux with C++17
|
|
||||||
- env: COMPILER=g++-8 BUILD=Debug STANDARD=17
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-8
|
|
||||||
- env: COMPILER=g++-8 BUILD=Release STANDARD=17
|
|
||||||
compiler: gcc
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
packages:
|
|
||||||
- g++-8
|
|
||||||
|
|
||||||
# Apple clang on OS X with C++14
|
|
||||||
- env: BUILD=Debug STANDARD=14
|
|
||||||
compiler: clang
|
|
||||||
os: osx
|
|
||||||
- env: BUILD=Release STANDARD=14
|
|
||||||
compiler: clang
|
|
||||||
os: osx
|
|
||||||
# clang 6.0 on Linux with C++14 (builds the fuzzers as well)
|
|
||||||
- env: COMPILER=clang++-6.0 BUILD=Debug STANDARD=14 ENABLE_FUZZING=1
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- clang-6.0
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty
|
|
||||||
- llvm-toolchain-trusty-6.0
|
|
||||||
# clang 4.0 on Linux with C++14
|
|
||||||
- env: COMPILER=clang++-4.0 BUILD=Debug STANDARD=11
|
|
||||||
compiler: clang
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- clang-4.0
|
|
||||||
sources:
|
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- llvm-toolchain-trusty
|
|
||||||
- llvm-toolchain-trusty-4.0
|
|
||||||
# g++ 4.8 on Linux with C++11
|
|
||||||
- env: COMPILER=g++-4.8 BUILD=Debug STANDARD=11
|
|
||||||
compiler: gcc
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then export CXX=${COMPILER}; fi
|
|
||||||
- if [[ "${BUILD}" != "Doc" ]]; then ${CXX} --version; fi
|
|
||||||
|
|
||||||
script:
|
|
||||||
- support/travis-build.py
|
|
|
@ -1,2 +0,0 @@
|
||||||
#include "os.h"
|
|
||||||
#warning "fmt/posix.h is deprecated; use fmt/os.h instead"
|
|
27
externals/dynarmic/externals/fmt/support/fmt.pro
vendored
|
@ -1,27 +0,0 @@
|
||||||
# Staticlib configuration for qmake builds
|
|
||||||
# For some reason qmake 3.1 fails to identify source dependencies and excludes format.cc and printf.cc
|
|
||||||
# from compilation so it _MUST_ be called as qmake -nodepend
|
|
||||||
# A workaround is implemented below: a custom compiler is defined which does not track dependencies
|
|
||||||
|
|
||||||
TEMPLATE = lib
|
|
||||||
|
|
||||||
TARGET = fmt
|
|
||||||
|
|
||||||
QMAKE_EXT_CPP = .cc
|
|
||||||
|
|
||||||
CONFIG = staticlib warn_on c++11
|
|
||||||
|
|
||||||
FMT_SOURCES = \
|
|
||||||
../src/format.cc \
|
|
||||||
../src/posix.cc
|
|
||||||
|
|
||||||
fmt.name = libfmt
|
|
||||||
fmt.input = FMT_SOURCES
|
|
||||||
fmt.output = ${QMAKE_FILE_BASE}$$QMAKE_EXT_OBJ
|
|
||||||
fmt.clean = ${QMAKE_FILE_BASE}$$QMAKE_EXT_OBJ
|
|
||||||
fmt.depends = ${QMAKE_FILE_IN}
|
|
||||||
# QMAKE_RUN_CXX will not be expanded
|
|
||||||
fmt.commands = $$QMAKE_CXX -c $$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_WARN_ON $$QMAKE_CXXFLAGS_RELEASE_WITH_DEBUGINFO $$QMAKE_CXXFLAGS_CXX11 ${QMAKE_FILE_IN}
|
|
||||||
fmt.variable_out = OBJECTS
|
|
||||||
fmt.CONFIG = no_dependencies no_link
|
|
||||||
QMAKE_EXTRA_COMPILERS += fmt
|
|
|
@ -1,119 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Build the project on Travis CI.
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import errno, os, shutil, subprocess, sys, urllib
|
|
||||||
from subprocess import call, check_call, Popen, PIPE, STDOUT
|
|
||||||
|
|
||||||
def rmtree_if_exists(dir):
|
|
||||||
try:
|
|
||||||
shutil.rmtree(dir)
|
|
||||||
except OSError as e:
|
|
||||||
if e.errno == errno.ENOENT:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def makedirs_if_not_exist(dir):
|
|
||||||
try:
|
|
||||||
os.makedirs(dir)
|
|
||||||
except OSError as e:
|
|
||||||
if e.errno != errno.EEXIST:
|
|
||||||
raise
|
|
||||||
|
|
||||||
def install_dependencies():
|
|
||||||
branch = os.environ['TRAVIS_BRANCH']
|
|
||||||
if branch != 'master':
|
|
||||||
print('Branch: ' + branch)
|
|
||||||
exit(0) # Ignore non-master branches
|
|
||||||
check_call('curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key ' +
|
|
||||||
'| sudo apt-key add -', shell=True)
|
|
||||||
check_call('echo "deb https://deb.nodesource.com/node_0.10 precise main" ' +
|
|
||||||
'| sudo tee /etc/apt/sources.list.d/nodesource.list', shell=True)
|
|
||||||
check_call(['sudo', 'apt-get', 'update'])
|
|
||||||
check_call(['sudo', 'apt-get', 'install', 'python-virtualenv', 'nodejs'])
|
|
||||||
check_call(['sudo', 'npm', 'install', '-g', 'less@2.6.1', 'less-plugin-clean-css'])
|
|
||||||
deb_file = 'doxygen_1.8.6-2_amd64.deb'
|
|
||||||
urllib.urlretrieve('http://mirrors.kernel.org/ubuntu/pool/main/d/doxygen/' +
|
|
||||||
deb_file, deb_file)
|
|
||||||
check_call(['sudo', 'dpkg', '-i', deb_file])
|
|
||||||
|
|
||||||
fmt_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
|
||||||
|
|
||||||
build = os.environ['BUILD']
|
|
||||||
if build == 'Doc':
|
|
||||||
travis = 'TRAVIS' in os.environ
|
|
||||||
if travis:
|
|
||||||
install_dependencies()
|
|
||||||
sys.path.insert(0, os.path.join(fmt_dir, 'doc'))
|
|
||||||
import build
|
|
||||||
build.create_build_env()
|
|
||||||
html_dir = build.build_docs()
|
|
||||||
repo = 'fmtlib.github.io'
|
|
||||||
if travis and 'KEY' not in os.environ:
|
|
||||||
# Don't update the repo if building on Travis from an account that
|
|
||||||
# doesn't have push access.
|
|
||||||
print('Skipping update of ' + repo)
|
|
||||||
exit(0)
|
|
||||||
# Clone the fmtlib.github.io repo.
|
|
||||||
rmtree_if_exists(repo)
|
|
||||||
git_url = 'https://github.com/' if travis else 'git@github.com:'
|
|
||||||
check_call(['git', 'clone', git_url + 'fmtlib/{}.git'.format(repo)])
|
|
||||||
# Copy docs to the repo.
|
|
||||||
target_dir = os.path.join(repo, 'dev')
|
|
||||||
rmtree_if_exists(target_dir)
|
|
||||||
shutil.copytree(html_dir, target_dir, ignore=shutil.ignore_patterns('.*'))
|
|
||||||
if travis:
|
|
||||||
check_call(['git', 'config', '--global', 'user.name', 'amplbot'])
|
|
||||||
check_call(['git', 'config', '--global', 'user.email', 'viz@ampl.com'])
|
|
||||||
# Push docs to GitHub pages.
|
|
||||||
check_call(['git', 'add', '--all'], cwd=repo)
|
|
||||||
if call(['git', 'diff-index', '--quiet', 'HEAD'], cwd=repo):
|
|
||||||
check_call(['git', 'commit', '-m', 'Update documentation'], cwd=repo)
|
|
||||||
cmd = 'git push'
|
|
||||||
if travis:
|
|
||||||
cmd += ' https://$KEY@github.com/fmtlib/fmtlib.github.io.git master'
|
|
||||||
p = Popen(cmd, shell=True, stdout=PIPE, stderr=STDOUT, cwd=repo)
|
|
||||||
# Print the output without the key.
|
|
||||||
print(p.communicate()[0].replace(os.environ['KEY'], '$KEY'))
|
|
||||||
if p.returncode != 0:
|
|
||||||
raise subprocess.CalledProcessError(p.returncode, cmd)
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
standard = os.environ['STANDARD']
|
|
||||||
install_dir = os.path.join(fmt_dir, "_install")
|
|
||||||
build_dir = os.path.join(fmt_dir, "_build")
|
|
||||||
test_build_dir = os.path.join(fmt_dir, "_build_test")
|
|
||||||
|
|
||||||
# Configure the library.
|
|
||||||
makedirs_if_not_exist(build_dir)
|
|
||||||
cmake_flags = [
|
|
||||||
'-DCMAKE_INSTALL_PREFIX=' + install_dir, '-DCMAKE_BUILD_TYPE=' + build,
|
|
||||||
'-DCMAKE_CXX_STANDARD=' + standard
|
|
||||||
]
|
|
||||||
|
|
||||||
# Make sure the fuzzers still compile.
|
|
||||||
main_cmake_flags = list(cmake_flags)
|
|
||||||
if 'ENABLE_FUZZING' in os.environ:
|
|
||||||
main_cmake_flags += ['-DFMT_FUZZ=ON', '-DFMT_FUZZ_LINKMAIN=On']
|
|
||||||
|
|
||||||
check_call(['cmake', '-DFMT_DOC=OFF', '-DFMT_PEDANTIC=ON', '-DFMT_WERROR=ON', fmt_dir] +
|
|
||||||
main_cmake_flags, cwd=build_dir)
|
|
||||||
|
|
||||||
# Build the library.
|
|
||||||
check_call(['cmake', '--build','.'], cwd=build_dir)
|
|
||||||
|
|
||||||
# Test the library.
|
|
||||||
env = os.environ.copy()
|
|
||||||
env['CTEST_OUTPUT_ON_FAILURE'] = '1'
|
|
||||||
if call(['make', 'test'], env=env, cwd=build_dir):
|
|
||||||
with open(os.path.join(build_dir, 'Testing', 'Temporary', 'LastTest.log'), 'r') as f:
|
|
||||||
print(f.read())
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
# Install the library.
|
|
||||||
check_call(['make', 'install'], cwd=build_dir)
|
|
||||||
|
|
||||||
# Test installation.
|
|
||||||
makedirs_if_not_exist(test_build_dir)
|
|
||||||
check_call(['cmake', os.path.join(fmt_dir, "test", "find-package-test")] +
|
|
||||||
cmake_flags, cwd=test_build_dir)
|
|
||||||
check_call(['make', '-j4'], cwd=test_build_dir)
|
|
|
@ -1,30 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Update the coverity branch from the master branch.
|
|
||||||
# It is not done automatically because Coverity Scan limits
|
|
||||||
# the number of submissions per day.
|
|
||||||
|
|
||||||
from __future__ import print_function
|
|
||||||
import shutil, tempfile
|
|
||||||
from subprocess import check_output, STDOUT
|
|
||||||
|
|
||||||
class Git:
|
|
||||||
def __init__(self, dir):
|
|
||||||
self.dir = dir
|
|
||||||
|
|
||||||
def __call__(self, *args):
|
|
||||||
output = check_output(['git'] + list(args), cwd=self.dir, stderr=STDOUT)
|
|
||||||
print(output)
|
|
||||||
return output
|
|
||||||
|
|
||||||
dir = tempfile.mkdtemp()
|
|
||||||
try:
|
|
||||||
git = Git(dir)
|
|
||||||
git('clone', '-b', 'coverity', 'git@github.com:fmtlib/fmt.git', dir)
|
|
||||||
output = git('merge', '-X', 'theirs', '--no-commit', 'origin/master')
|
|
||||||
if 'Fast-forward' not in output:
|
|
||||||
git('reset', 'HEAD', '.travis.yml')
|
|
||||||
git('checkout', '--', '.travis.yml')
|
|
||||||
git('commit', '-m', 'Update coverity branch')
|
|
||||||
git('push')
|
|
||||||
finally:
|
|
||||||
shutil.rmtree(dir)
|
|
|
@ -1,58 +0,0 @@
|
||||||
// Formatting library for C++ - custom argument formatter tests
|
|
||||||
//
|
|
||||||
// Copyright (c) 2012 - present, Victor Zverovich
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// For the license information refer to format.h.
|
|
||||||
|
|
||||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
|
||||||
#define _CRT_SECURE_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "fmt/format.h"
|
|
||||||
#include "gtest-extra.h"
|
|
||||||
|
|
||||||
// MSVC 2013 is known to be broken.
|
|
||||||
#if !FMT_MSC_VER || FMT_MSC_VER > 1800
|
|
||||||
|
|
||||||
// A custom argument formatter that doesn't print `-` for floating-point values
|
|
||||||
// rounded to 0.
|
|
||||||
class custom_arg_formatter
|
|
||||||
: public fmt::detail::arg_formatter<fmt::format_context::iterator, char> {
|
|
||||||
public:
|
|
||||||
using base = fmt::detail::arg_formatter<fmt::format_context::iterator, char>;
|
|
||||||
|
|
||||||
custom_arg_formatter(fmt::format_context& ctx,
|
|
||||||
fmt::format_parse_context* parse_ctx,
|
|
||||||
fmt::format_specs* s = nullptr,
|
|
||||||
const char* = nullptr)
|
|
||||||
: base(ctx, parse_ctx, s) {}
|
|
||||||
|
|
||||||
using base::operator();
|
|
||||||
|
|
||||||
iterator operator()(double value) {
|
|
||||||
// Comparing a float to 0.0 is safe.
|
|
||||||
if (round(value * pow(10, specs()->precision)) == 0.0) value = 0;
|
|
||||||
return base::operator()(value);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
std::string custom_vformat(fmt::string_view format_str, fmt::format_args args) {
|
|
||||||
fmt::memory_buffer buffer;
|
|
||||||
fmt::detail::buffer<char>& base = buffer;
|
|
||||||
// Pass custom argument formatter as a template arg to vwrite.
|
|
||||||
fmt::vformat_to<custom_arg_formatter>(std::back_inserter(base), format_str,
|
|
||||||
args);
|
|
||||||
return std::string(buffer.data(), buffer.size());
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename... Args>
|
|
||||||
std::string custom_format(const char* format_str, const Args&... args) {
|
|
||||||
auto va = fmt::make_format_args(args...);
|
|
||||||
return custom_vformat(format_str, va);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(CustomFormatterTest, Format) {
|
|
||||||
EXPECT_EQ("0.00", custom_format("{:.2f}", -.00001));
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,6 +0,0 @@
|
||||||
// Copyright (c) 2020 Vladimir Solontsov
|
|
||||||
// SPDX-License-Identifier: MIT Licence
|
|
||||||
|
|
||||||
#include <fmt/core.h>
|
|
||||||
|
|
||||||
#include "gtest-extra.h"
|
|
|
@ -1,152 +0,0 @@
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
|
|
||||||
#include <fmt/chrono.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <limits>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
template <typename Item, typename Ratio>
|
|
||||||
void invoke_inner(fmt::string_view formatstring, const Item item) {
|
|
||||||
const std::chrono::duration<Item, Ratio> value(item);
|
|
||||||
try {
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(formatstring, value);
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer buf;
|
|
||||||
fmt::format_to(buf, formatstring, value);
|
|
||||||
#endif
|
|
||||||
} catch (std::exception& /*e*/) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Item is the underlying type for duration (int, long etc)
|
|
||||||
template <typename Item>
|
|
||||||
void invoke_outer(const uint8_t* Data, size_t Size, const int scaling) {
|
|
||||||
// always use a fixed location of the data
|
|
||||||
using fmt_fuzzer::Nfixed;
|
|
||||||
|
|
||||||
constexpr auto N = sizeof(Item);
|
|
||||||
static_assert(N <= Nfixed, "fixed size is too small");
|
|
||||||
if (Size <= Nfixed + 1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Item item = fmt_fuzzer::assignFromBuf<Item>(Data);
|
|
||||||
|
|
||||||
// fast forward
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
// Data is already allocated separately in libFuzzer so reading past
|
|
||||||
// the end will most likely be detected anyway
|
|
||||||
const auto formatstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
|
|
||||||
// doit_impl<Item,std::yocto>(buf.data(),item);
|
|
||||||
// doit_impl<Item,std::zepto>(buf.data(),item);
|
|
||||||
switch (scaling) {
|
|
||||||
case 1:
|
|
||||||
invoke_inner<Item, std::atto>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
invoke_inner<Item, std::femto>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
invoke_inner<Item, std::pico>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
invoke_inner<Item, std::nano>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
invoke_inner<Item, std::micro>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
invoke_inner<Item, std::milli>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
invoke_inner<Item, std::centi>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
invoke_inner<Item, std::deci>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
invoke_inner<Item, std::deca>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
invoke_inner<Item, std::kilo>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
invoke_inner<Item, std::mega>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
invoke_inner<Item, std::giga>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
invoke_inner<Item, std::tera>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 14:
|
|
||||||
invoke_inner<Item, std::peta>(formatstring, item);
|
|
||||||
break;
|
|
||||||
case 15:
|
|
||||||
invoke_inner<Item, std::exa>(formatstring, item);
|
|
||||||
}
|
|
||||||
// doit_impl<Item,std::zeta>(buf.data(),item);
|
|
||||||
// doit_impl<Item,std::yotta>(buf.data(),item);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
|
|
||||||
if (Size <= 4) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto representation = Data[0];
|
|
||||||
const auto scaling = Data[1];
|
|
||||||
Data += 2;
|
|
||||||
Size -= 2;
|
|
||||||
|
|
||||||
switch (representation) {
|
|
||||||
case 1:
|
|
||||||
invoke_outer<char>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
invoke_outer<unsigned char>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
invoke_outer<signed char>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
invoke_outer<short>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
invoke_outer<unsigned short>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
invoke_outer<int>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
invoke_outer<unsigned int>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
invoke_outer<long>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
invoke_outer<unsigned long>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
invoke_outer<float>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
invoke_outer<double>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
invoke_outer<long double>(Data, Size, scaling);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,67 +0,0 @@
|
||||||
#ifndef FUZZER_COMMON_H
|
|
||||||
#define FUZZER_COMMON_H
|
|
||||||
|
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
|
|
||||||
#include <cstdint> // std::uint8_t
|
|
||||||
#include <cstring> // memcpy
|
|
||||||
#include <type_traits> // trivially copyable
|
|
||||||
|
|
||||||
// one can format to either a string, or a buf. buf is faster,
|
|
||||||
// but one may be interested in formatting to a string instead to
|
|
||||||
// verify it works as intended. to avoid a combinatoric explosion,
|
|
||||||
// select this at compile time instead of dynamically from the fuzz data
|
|
||||||
#define FMT_FUZZ_FORMAT_TO_STRING 0
|
|
||||||
|
|
||||||
// if fmt is given a buffer that is separately allocated,
|
|
||||||
// chances that address sanitizer detects out of bound reads is
|
|
||||||
// much higher. However, it slows down the fuzzing.
|
|
||||||
#define FMT_FUZZ_SEPARATE_ALLOCATION 1
|
|
||||||
|
|
||||||
// To let the the fuzzer mutation be efficient at cross pollinating
|
|
||||||
// between different types, use a fixed size format.
|
|
||||||
// The same bit pattern, interpreted as another type,
|
|
||||||
// is likely interesting.
|
|
||||||
// For this, we must know the size of the largest possible type in use.
|
|
||||||
|
|
||||||
// There are some problems on travis, claiming Nfixed is not a constant
|
|
||||||
// expression which seems to be an issue with older versions of libstdc++
|
|
||||||
#if _GLIBCXX_RELEASE >= 7
|
|
||||||
# include <algorithm>
|
|
||||||
namespace fmt_fuzzer {
|
|
||||||
constexpr auto Nfixed = std::max(sizeof(long double), sizeof(std::intmax_t));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
namespace fmt_fuzzer {
|
|
||||||
constexpr auto Nfixed = 16;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace fmt_fuzzer {
|
|
||||||
// view data as a c char pointer.
|
|
||||||
template <typename T> inline const char* as_chars(const T* data) {
|
|
||||||
return static_cast<const char*>(static_cast<const void*>(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
// view data as a byte pointer
|
|
||||||
template <typename T> inline const std::uint8_t* as_bytes(const T* data) {
|
|
||||||
return static_cast<const std::uint8_t*>(static_cast<const void*>(data));
|
|
||||||
}
|
|
||||||
|
|
||||||
// blits bytes from Data to form an (assumed trivially constructible) object
|
|
||||||
// of type Item
|
|
||||||
template <class Item> inline Item assignFromBuf(const std::uint8_t* Data) {
|
|
||||||
Item item{};
|
|
||||||
std::memcpy(&item, Data, sizeof(Item));
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reads a boolean value by looking at the first byte from Data
|
|
||||||
template <> inline bool assignFromBuf<bool>(const std::uint8_t* Data) {
|
|
||||||
return !!Data[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace fmt_fuzzer
|
|
||||||
|
|
||||||
#endif // FUZZER_COMMON_H
|
|
|
@ -1,21 +0,0 @@
|
||||||
#include <cassert>
|
|
||||||
#include <fstream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <vector>
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size);
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
for (int i = 1; i < argc; ++i) {
|
|
||||||
std::ifstream in(argv[i]);
|
|
||||||
assert(in);
|
|
||||||
in.seekg(0, std::ios_base::end);
|
|
||||||
const auto pos = in.tellg();
|
|
||||||
assert(pos >= 0);
|
|
||||||
in.seekg(0, std::ios_base::beg);
|
|
||||||
std::vector<char> buf(static_cast<size_t>(pos));
|
|
||||||
in.read(buf.data(), static_cast<long>(buf.size()));
|
|
||||||
assert(in.gcount() == pos);
|
|
||||||
LLVMFuzzerTestOneInput(fmt_fuzzer::as_bytes(buf.data()), buf.size());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,128 +0,0 @@
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
|
|
||||||
#include <fmt/chrono.h>
|
|
||||||
#include <fmt/core.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
template <typename Item1>
|
|
||||||
void invoke_fmt(const uint8_t* Data, size_t Size, unsigned int argsize) {
|
|
||||||
constexpr auto N1 = sizeof(Item1);
|
|
||||||
static_assert(N1 <= fmt_fuzzer::Nfixed, "Nfixed too small");
|
|
||||||
if (Size <= fmt_fuzzer::Nfixed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const Item1 item1 = fmt_fuzzer::assignFromBuf<Item1>(Data);
|
|
||||||
|
|
||||||
Data += fmt_fuzzer::Nfixed;
|
|
||||||
Size -= fmt_fuzzer::Nfixed;
|
|
||||||
|
|
||||||
// how many chars should be used for the argument name?
|
|
||||||
if (argsize <= 0 || argsize >= Size) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// allocating buffers separately is slower, but increases chances
|
|
||||||
// of detecting memory errors
|
|
||||||
#if FMT_FUZZ_SEPARATE_ALLOCATION
|
|
||||||
std::vector<char> argnamebuffer(argsize + 1);
|
|
||||||
std::memcpy(argnamebuffer.data(), Data, argsize);
|
|
||||||
auto argname = argnamebuffer.data();
|
|
||||||
#else
|
|
||||||
auto argname = fmt_fuzzer::as_chars(Data);
|
|
||||||
#endif
|
|
||||||
Data += argsize;
|
|
||||||
Size -= argsize;
|
|
||||||
|
|
||||||
#if FMT_FUZZ_SEPARATE_ALLOCATION
|
|
||||||
// allocates as tight as possible, making it easier to catch buffer overruns.
|
|
||||||
std::vector<char> fmtstringbuffer(Size);
|
|
||||||
std::memcpy(fmtstringbuffer.data(), Data, Size);
|
|
||||||
auto fmtstring = fmt::string_view(fmtstringbuffer.data(), Size);
|
|
||||||
#else
|
|
||||||
auto fmtstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(fmtstring, fmt::arg(argname, item1));
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer outbuf;
|
|
||||||
fmt::format_to(outbuf, fmtstring, fmt::arg(argname, item1));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// for dynamic dispatching to an explicit instantiation
|
|
||||||
template <typename Callback> void invoke(int index, Callback callback) {
|
|
||||||
switch (index) {
|
|
||||||
case 0:
|
|
||||||
callback(bool{});
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
callback(char{});
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
using sc = signed char;
|
|
||||||
callback(sc{});
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
using uc = unsigned char;
|
|
||||||
callback(uc{});
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
callback(short{});
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
using us = unsigned short;
|
|
||||||
callback(us{});
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
callback(int{});
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
callback(unsigned{});
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
callback(long{});
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
using ul = unsigned long;
|
|
||||||
callback(ul{});
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
callback(float{});
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
callback(double{});
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
using LD = long double;
|
|
||||||
callback(LD{});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
|
|
||||||
if (Size <= 3) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch types depending on the first byte of the input
|
|
||||||
const auto first = Data[0] & 0x0F;
|
|
||||||
const unsigned int second = (Data[0] & 0xF0) >> 4;
|
|
||||||
Data++;
|
|
||||||
Size--;
|
|
||||||
|
|
||||||
auto outerfcn = [=](auto param1) {
|
|
||||||
invoke_fmt<decltype(param1)>(Data, Size, second);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
invoke(first, outerfcn);
|
|
||||||
} catch (std::exception& /*e*/) {
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,131 +0,0 @@
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
|
|
||||||
#include <fmt/core.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <fmt/chrono.h>
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
using fmt_fuzzer::Nfixed;
|
|
||||||
|
|
||||||
template <typename Item>
|
|
||||||
void invoke_fmt(const uint8_t* Data, size_t Size) {
|
|
||||||
constexpr auto N = sizeof(Item);
|
|
||||||
static_assert(N <= Nfixed, "Nfixed is too small");
|
|
||||||
if (Size <= Nfixed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const Item item = fmt_fuzzer::assignFromBuf<Item>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
#if FMT_FUZZ_SEPARATE_ALLOCATION
|
|
||||||
// allocates as tight as possible, making it easier to catch buffer overruns.
|
|
||||||
std::vector<char> fmtstringbuffer(Size);
|
|
||||||
std::memcpy(fmtstringbuffer.data(), Data, Size);
|
|
||||||
auto fmtstring = fmt::string_view(fmtstringbuffer.data(), Size);
|
|
||||||
#else
|
|
||||||
auto fmtstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(fmtstring, item);
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer message;
|
|
||||||
fmt::format_to(message, fmtstring, item);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void invoke_fmt_time(const uint8_t* Data, size_t Size) {
|
|
||||||
using Item = std::time_t;
|
|
||||||
constexpr auto N = sizeof(Item);
|
|
||||||
static_assert(N <= Nfixed, "Nfixed too small");
|
|
||||||
if (Size <= Nfixed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const Item item = fmt_fuzzer::assignFromBuf<Item>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
#if FMT_FUZZ_SEPARATE_ALLOCATION
|
|
||||||
// allocates as tight as possible, making it easier to catch buffer overruns.
|
|
||||||
std::vector<char> fmtstringbuffer(Size);
|
|
||||||
std::memcpy(fmtstringbuffer.data(), Data, Size);
|
|
||||||
auto fmtstring = fmt::string_view(fmtstringbuffer.data(), Size);
|
|
||||||
#else
|
|
||||||
auto fmtstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
#endif
|
|
||||||
auto* b = std::localtime(&item);
|
|
||||||
if (b) {
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(fmtstring, *b);
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer message;
|
|
||||||
fmt::format_to(message, fmtstring, *b);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
|
|
||||||
if (Size <= 3) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
const auto first = Data[0];
|
|
||||||
Data++;
|
|
||||||
Size--;
|
|
||||||
|
|
||||||
try {
|
|
||||||
switch (first) {
|
|
||||||
case 0:
|
|
||||||
invoke_fmt<bool>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
invoke_fmt<char>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
invoke_fmt<unsigned char>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
invoke_fmt<signed char>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
invoke_fmt<short>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
invoke_fmt<unsigned short>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
invoke_fmt<int>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
invoke_fmt<unsigned int>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
invoke_fmt<long>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
invoke_fmt<unsigned long>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
invoke_fmt<float>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
invoke_fmt<double>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
invoke_fmt<long double>(Data, Size);
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
invoke_fmt_time(Data, Size);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (std::exception& /*e*/) {
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,116 +0,0 @@
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <fmt/printf.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <stdexcept>
|
|
||||||
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
using fmt_fuzzer::Nfixed;
|
|
||||||
|
|
||||||
template <typename Item1, typename Item2>
|
|
||||||
void invoke_fmt(const uint8_t* Data, size_t Size) {
|
|
||||||
constexpr auto N1 = sizeof(Item1);
|
|
||||||
constexpr auto N2 = sizeof(Item2);
|
|
||||||
static_assert(N1 <= Nfixed, "size1 exceeded");
|
|
||||||
static_assert(N2 <= Nfixed, "size2 exceeded");
|
|
||||||
if (Size <= Nfixed + Nfixed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Item1 item1 = fmt_fuzzer::assignFromBuf<Item1>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
Item2 item2 = fmt_fuzzer::assignFromBuf<Item2>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
auto fmtstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(fmtstring, item1, item2);
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer message;
|
|
||||||
fmt::format_to(message, fmtstring, item1, item2);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// for dynamic dispatching to an explicit instantiation
|
|
||||||
template <typename Callback> void invoke(int index, Callback callback) {
|
|
||||||
switch (index) {
|
|
||||||
case 0:
|
|
||||||
callback(bool{});
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
callback(char{});
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
using sc = signed char;
|
|
||||||
callback(sc{});
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
using uc = unsigned char;
|
|
||||||
callback(uc{});
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
callback(short{});
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
using us = unsigned short;
|
|
||||||
callback(us{});
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
callback(int{});
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
callback(unsigned{});
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
callback(long{});
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
using ul = unsigned long;
|
|
||||||
callback(ul{});
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
callback(float{});
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
callback(double{});
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
using LD = long double;
|
|
||||||
callback(LD{});
|
|
||||||
break;
|
|
||||||
case 13:
|
|
||||||
using ptr = void*;
|
|
||||||
callback(ptr{});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
|
|
||||||
if (Size <= 3) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch types depending on the first byte of the input
|
|
||||||
const auto first = Data[0] & 0x0F;
|
|
||||||
const auto second = (Data[0] & 0xF0) >> 4;
|
|
||||||
Data++;
|
|
||||||
Size--;
|
|
||||||
|
|
||||||
auto outer = [=](auto param1) {
|
|
||||||
auto inner = [=](auto param2) {
|
|
||||||
invoke_fmt<decltype(param1), decltype(param2)>(Data, Size);
|
|
||||||
};
|
|
||||||
invoke(second, inner);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
invoke(first, outer);
|
|
||||||
} catch (std::exception& /*e*/) {
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -1,112 +0,0 @@
|
||||||
// Copyright (c) 2019, Paul Dreik
|
|
||||||
// License: see LICENSE.rst in the fmt root directory
|
|
||||||
#include <fmt/format.h>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <stdexcept>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include "fuzzer_common.h"
|
|
||||||
|
|
||||||
constexpr auto Nfixed = fmt_fuzzer::Nfixed;
|
|
||||||
|
|
||||||
template <typename Item1, typename Item2>
|
|
||||||
void invoke_fmt(const uint8_t* Data, size_t Size) {
|
|
||||||
constexpr auto N1 = sizeof(Item1);
|
|
||||||
constexpr auto N2 = sizeof(Item2);
|
|
||||||
static_assert(N1 <= Nfixed, "size1 exceeded");
|
|
||||||
static_assert(N2 <= Nfixed, "size2 exceeded");
|
|
||||||
if (Size <= Nfixed + Nfixed) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const Item1 item1 = fmt_fuzzer::assignFromBuf<Item1>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
const Item2 item2 = fmt_fuzzer::assignFromBuf<Item2>(Data);
|
|
||||||
Data += Nfixed;
|
|
||||||
Size -= Nfixed;
|
|
||||||
|
|
||||||
auto fmtstring = fmt::string_view(fmt_fuzzer::as_chars(Data), Size);
|
|
||||||
|
|
||||||
#if FMT_FUZZ_FORMAT_TO_STRING
|
|
||||||
std::string message = fmt::format(fmtstring, item1, item2);
|
|
||||||
#else
|
|
||||||
fmt::memory_buffer message;
|
|
||||||
fmt::format_to(message, fmtstring, item1, item2);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// for dynamic dispatching to an explicit instantiation
|
|
||||||
template <typename Callback> void invoke(int index, Callback callback) {
|
|
||||||
switch (index) {
|
|
||||||
case 0:
|
|
||||||
callback(bool{});
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
callback(char{});
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
using sc = signed char;
|
|
||||||
callback(sc{});
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
using uc = unsigned char;
|
|
||||||
callback(uc{});
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
callback(short{});
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
using us = unsigned short;
|
|
||||||
callback(us{});
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
callback(int{});
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
callback(unsigned{});
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
callback(long{});
|
|
||||||
break;
|
|
||||||
case 9:
|
|
||||||
using ul = unsigned long;
|
|
||||||
callback(ul{});
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
callback(float{});
|
|
||||||
break;
|
|
||||||
case 11:
|
|
||||||
callback(double{});
|
|
||||||
break;
|
|
||||||
case 12:
|
|
||||||
using LD = long double;
|
|
||||||
callback(LD{});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
|
|
||||||
if (Size <= 3) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// switch types depending on the first byte of the input
|
|
||||||
const auto first = Data[0] & 0x0F;
|
|
||||||
const auto second = (Data[0] & 0xF0) >> 4;
|
|
||||||
Data++;
|
|
||||||
Size--;
|
|
||||||
|
|
||||||
auto outer = [=](auto param1) {
|
|
||||||
auto inner = [=](auto param2) {
|
|
||||||
invoke_fmt<decltype(param1), decltype(param2)>(Data, Size);
|
|
||||||
};
|
|
||||||
invoke(second, inner);
|
|
||||||
};
|
|
||||||
|
|
||||||
try {
|
|
||||||
invoke(first, outer);
|
|
||||||
} catch (std::exception& /*e*/) {
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
11244
externals/dynarmic/externals/fmt/test/gmock-gtest-all.cc
vendored
14204
externals/dynarmic/externals/fmt/test/gmock/gmock.h
vendored
|
@ -1,75 +0,0 @@
|
||||||
// Formatting library for C++ - Grisu tests
|
|
||||||
//
|
|
||||||
// Copyright (c) 2012 - present, Victor Zverovich
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// For the license information refer to format.h.
|
|
||||||
|
|
||||||
#include "fmt/format.h"
|
|
||||||
#include "gtest.h"
|
|
||||||
|
|
||||||
static bool reported_skipped;
|
|
||||||
|
|
||||||
#undef TEST
|
|
||||||
#define TEST(test_fixture, test_name) \
|
|
||||||
void test_fixture##test_name(); \
|
|
||||||
GTEST_TEST(test_fixture, test_name) { \
|
|
||||||
if (FMT_USE_GRISU) { \
|
|
||||||
test_fixture##test_name(); \
|
|
||||||
} else if (!reported_skipped) { \
|
|
||||||
reported_skipped = true; \
|
|
||||||
fmt::print("Skipping Grisu tests.\n"); \
|
|
||||||
} \
|
|
||||||
} \
|
|
||||||
void test_fixture##test_name()
|
|
||||||
|
|
||||||
TEST(GrisuTest, NaN) {
|
|
||||||
auto nan = std::numeric_limits<double>::quiet_NaN();
|
|
||||||
EXPECT_EQ("nan", fmt::format("{}", nan));
|
|
||||||
EXPECT_EQ("-nan", fmt::format("{}", -nan));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(GrisuTest, Inf) {
|
|
||||||
auto inf = std::numeric_limits<double>::infinity();
|
|
||||||
EXPECT_EQ("inf", fmt::format("{}", inf));
|
|
||||||
EXPECT_EQ("-inf", fmt::format("{}", -inf));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(GrisuTest, Zero) { EXPECT_EQ("0.0", fmt::format("{}", 0.0)); }
|
|
||||||
|
|
||||||
TEST(GrisuTest, Round) {
|
|
||||||
EXPECT_EQ("1.9156918820264798e-56",
|
|
||||||
fmt::format("{}", 1.9156918820264798e-56));
|
|
||||||
EXPECT_EQ("0.0000", fmt::format("{:.4f}", 7.2809479766055470e-15));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(GrisuTest, Prettify) {
|
|
||||||
EXPECT_EQ("0.0001", fmt::format("{}", 1e-4));
|
|
||||||
EXPECT_EQ("1e-05", fmt::format("{}", 1e-5));
|
|
||||||
EXPECT_EQ("9.999e-05", fmt::format("{}", 9.999e-5));
|
|
||||||
EXPECT_EQ("10000000000.0", fmt::format("{}", 1e10));
|
|
||||||
EXPECT_EQ("100000000000.0", fmt::format("{}", 1e11));
|
|
||||||
EXPECT_EQ("12340000000.0", fmt::format("{}", 1234e7));
|
|
||||||
EXPECT_EQ("12.34", fmt::format("{}", 1234e-2));
|
|
||||||
EXPECT_EQ("0.001234", fmt::format("{}", 1234e-6));
|
|
||||||
EXPECT_EQ("0.1", fmt::format("{}", 0.1f));
|
|
||||||
EXPECT_EQ("0.10000000149011612", fmt::format("{}", double(0.1f)));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(GrisuTest, ZeroPrecision) { EXPECT_EQ("1", fmt::format("{:.0}", 1.0)); }
|
|
||||||
|
|
||||||
TEST(GrisuTest, Fallback) {
|
|
||||||
EXPECT_EQ("1e+23", fmt::format("{}", 1e23));
|
|
||||||
EXPECT_EQ("9e-265", fmt::format("{}", 9e-265));
|
|
||||||
EXPECT_EQ("5.423717798060526e+125",
|
|
||||||
fmt::format("{}", 5.423717798060526e+125));
|
|
||||||
EXPECT_EQ("1.372371880954233e-288",
|
|
||||||
fmt::format("{}", 1.372371880954233e-288));
|
|
||||||
EXPECT_EQ("55388492.622190244", fmt::format("{}", 55388492.622190244));
|
|
||||||
EXPECT_EQ("2.2506787569811123e-253",
|
|
||||||
fmt::format("{}", 2.2506787569811123e-253));
|
|
||||||
EXPECT_EQ("1103618912042992.8", fmt::format("{}", 1103618912042992.8));
|
|
||||||
// pow(2, -25) - assymetric boundaries:
|
|
||||||
EXPECT_EQ("2.9802322387695312e-08",
|
|
||||||
fmt::format("{}", 2.9802322387695312e-08));
|
|
||||||
}
|
|
|
@ -1,232 +0,0 @@
|
||||||
// Copyright 2007, Google Inc.
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are
|
|
||||||
// met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright
|
|
||||||
// notice, this list of conditions and the following disclaimer.
|
|
||||||
// * Redistributions in binary form must reproduce the above
|
|
||||||
// copyright notice, this list of conditions and the following disclaimer
|
|
||||||
// in the documentation and/or other materials provided with the
|
|
||||||
// distribution.
|
|
||||||
// * Neither the name of Google Inc. nor the names of its
|
|
||||||
// contributors may be used to endorse or promote products derived from
|
|
||||||
// this software without specific prior written permission.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
||||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
||||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
||||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
||||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
||||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
//
|
|
||||||
// Author: wan@google.com (Zhanyong Wan)
|
|
||||||
//
|
|
||||||
// Utilities for testing Google Test itself and code that uses Google Test
|
|
||||||
// (e.g. frameworks built on top of Google Test).
|
|
||||||
|
|
||||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
|
||||||
#define GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
|
||||||
|
|
||||||
namespace testing {
|
|
||||||
|
|
||||||
// This helper class can be used to mock out Google Test failure reporting
|
|
||||||
// so that we can test Google Test or code that builds on Google Test.
|
|
||||||
//
|
|
||||||
// An object of this class appends a TestPartResult object to the
|
|
||||||
// TestPartResultArray object given in the constructor whenever a Google Test
|
|
||||||
// failure is reported. It can either intercept only failures that are
|
|
||||||
// generated in the same thread that created this object or it can intercept
|
|
||||||
// all generated failures. The scope of this mock object can be controlled with
|
|
||||||
// the second argument to the two arguments constructor.
|
|
||||||
class GTEST_API_ ScopedFakeTestPartResultReporter
|
|
||||||
: public TestPartResultReporterInterface {
|
|
||||||
public:
|
|
||||||
// The two possible mocking modes of this object.
|
|
||||||
enum InterceptMode {
|
|
||||||
INTERCEPT_ONLY_CURRENT_THREAD, // Intercepts only thread local failures.
|
|
||||||
INTERCEPT_ALL_THREADS // Intercepts all failures.
|
|
||||||
};
|
|
||||||
|
|
||||||
// The c'tor sets this object as the test part result reporter used
|
|
||||||
// by Google Test. The 'result' parameter specifies where to report the
|
|
||||||
// results. This reporter will only catch failures generated in the current
|
|
||||||
// thread. DEPRECATED
|
|
||||||
explicit ScopedFakeTestPartResultReporter(TestPartResultArray* result);
|
|
||||||
|
|
||||||
// Same as above, but you can choose the interception scope of this object.
|
|
||||||
ScopedFakeTestPartResultReporter(InterceptMode intercept_mode,
|
|
||||||
TestPartResultArray* result);
|
|
||||||
|
|
||||||
// The d'tor restores the previous test part result reporter.
|
|
||||||
virtual ~ScopedFakeTestPartResultReporter();
|
|
||||||
|
|
||||||
// Appends the TestPartResult object to the TestPartResultArray
|
|
||||||
// received in the constructor.
|
|
||||||
//
|
|
||||||
// This method is from the TestPartResultReporterInterface
|
|
||||||
// interface.
|
|
||||||
virtual void ReportTestPartResult(const TestPartResult& result);
|
|
||||||
private:
|
|
||||||
void Init();
|
|
||||||
|
|
||||||
const InterceptMode intercept_mode_;
|
|
||||||
TestPartResultReporterInterface* old_reporter_;
|
|
||||||
TestPartResultArray* const result_;
|
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedFakeTestPartResultReporter);
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace internal {
|
|
||||||
|
|
||||||
// A helper class for implementing EXPECT_FATAL_FAILURE() and
|
|
||||||
// EXPECT_NONFATAL_FAILURE(). Its destructor verifies that the given
|
|
||||||
// TestPartResultArray contains exactly one failure that has the given
|
|
||||||
// type and contains the given substring. If that's not the case, a
|
|
||||||
// non-fatal failure will be generated.
|
|
||||||
class GTEST_API_ SingleFailureChecker {
|
|
||||||
public:
|
|
||||||
// The constructor remembers the arguments.
|
|
||||||
SingleFailureChecker(const TestPartResultArray* results,
|
|
||||||
TestPartResult::Type type,
|
|
||||||
const string& substr);
|
|
||||||
~SingleFailureChecker();
|
|
||||||
private:
|
|
||||||
const TestPartResultArray* const results_;
|
|
||||||
const TestPartResult::Type type_;
|
|
||||||
const string substr_;
|
|
||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(SingleFailureChecker);
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace internal
|
|
||||||
|
|
||||||
} // namespace testing
|
|
||||||
|
|
||||||
// A set of macros for testing Google Test assertions or code that's expected
|
|
||||||
// to generate Google Test fatal failures. It verifies that the given
|
|
||||||
// statement will cause exactly one fatal Google Test failure with 'substr'
|
|
||||||
// being part of the failure message.
|
|
||||||
//
|
|
||||||
// There are two different versions of this macro. EXPECT_FATAL_FAILURE only
|
|
||||||
// affects and considers failures generated in the current thread and
|
|
||||||
// EXPECT_FATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
|
||||||
//
|
|
||||||
// The verification of the assertion is done correctly even when the statement
|
|
||||||
// throws an exception or aborts the current function.
|
|
||||||
//
|
|
||||||
// Known restrictions:
|
|
||||||
// - 'statement' cannot reference local non-static variables or
|
|
||||||
// non-static members of the current object.
|
|
||||||
// - 'statement' cannot return a value.
|
|
||||||
// - You cannot stream a failure message to this macro.
|
|
||||||
//
|
|
||||||
// Note that even though the implementations of the following two
|
|
||||||
// macros are much alike, we cannot refactor them to use a common
|
|
||||||
// helper macro, due to some peculiarity in how the preprocessor
|
|
||||||
// works. The AcceptsMacroThatExpandsToUnprotectedComma test in
|
|
||||||
// gtest_unittest.cc will fail to compile if we do that.
|
|
||||||
#define EXPECT_FATAL_FAILURE(statement, substr) \
|
|
||||||
do { \
|
|
||||||
class GTestExpectFatalFailureHelper {\
|
|
||||||
public:\
|
|
||||||
static void Execute() { statement; }\
|
|
||||||
};\
|
|
||||||
::testing::TestPartResultArray gtest_failures;\
|
|
||||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
|
||||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
|
||||||
{\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter:: \
|
|
||||||
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
|
||||||
GTestExpectFatalFailureHelper::Execute();\
|
|
||||||
}\
|
|
||||||
} while (::testing::internal::AlwaysFalse())
|
|
||||||
|
|
||||||
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
|
||||||
do { \
|
|
||||||
class GTestExpectFatalFailureHelper {\
|
|
||||||
public:\
|
|
||||||
static void Execute() { statement; }\
|
|
||||||
};\
|
|
||||||
::testing::TestPartResultArray gtest_failures;\
|
|
||||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
|
||||||
>est_failures, ::testing::TestPartResult::kFatalFailure, (substr));\
|
|
||||||
{\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter:: \
|
|
||||||
INTERCEPT_ALL_THREADS, >est_failures);\
|
|
||||||
GTestExpectFatalFailureHelper::Execute();\
|
|
||||||
}\
|
|
||||||
} while (::testing::internal::AlwaysFalse())
|
|
||||||
|
|
||||||
// A macro for testing Google Test assertions or code that's expected to
|
|
||||||
// generate Google Test non-fatal failures. It asserts that the given
|
|
||||||
// statement will cause exactly one non-fatal Google Test failure with 'substr'
|
|
||||||
// being part of the failure message.
|
|
||||||
//
|
|
||||||
// There are two different versions of this macro. EXPECT_NONFATAL_FAILURE only
|
|
||||||
// affects and considers failures generated in the current thread and
|
|
||||||
// EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS does the same but for all threads.
|
|
||||||
//
|
|
||||||
// 'statement' is allowed to reference local variables and members of
|
|
||||||
// the current object.
|
|
||||||
//
|
|
||||||
// The verification of the assertion is done correctly even when the statement
|
|
||||||
// throws an exception or aborts the current function.
|
|
||||||
//
|
|
||||||
// Known restrictions:
|
|
||||||
// - You cannot stream a failure message to this macro.
|
|
||||||
//
|
|
||||||
// Note that even though the implementations of the following two
|
|
||||||
// macros are much alike, we cannot refactor them to use a common
|
|
||||||
// helper macro, due to some peculiarity in how the preprocessor
|
|
||||||
// works. If we do that, the code won't compile when the user gives
|
|
||||||
// EXPECT_NONFATAL_FAILURE() a statement that contains a macro that
|
|
||||||
// expands to code containing an unprotected comma. The
|
|
||||||
// AcceptsMacroThatExpandsToUnprotectedComma test in gtest_unittest.cc
|
|
||||||
// catches that.
|
|
||||||
//
|
|
||||||
// For the same reason, we have to write
|
|
||||||
// if (::testing::internal::AlwaysTrue()) { statement; }
|
|
||||||
// instead of
|
|
||||||
// GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
|
||||||
// to avoid an MSVC warning on unreachable code.
|
|
||||||
#define EXPECT_NONFATAL_FAILURE(statement, substr) \
|
|
||||||
do {\
|
|
||||||
::testing::TestPartResultArray gtest_failures;\
|
|
||||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
|
||||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
|
||||||
(substr));\
|
|
||||||
{\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter:: \
|
|
||||||
INTERCEPT_ONLY_CURRENT_THREAD, >est_failures);\
|
|
||||||
if (::testing::internal::AlwaysTrue()) { statement; }\
|
|
||||||
}\
|
|
||||||
} while (::testing::internal::AlwaysFalse())
|
|
||||||
|
|
||||||
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr) \
|
|
||||||
do {\
|
|
||||||
::testing::TestPartResultArray gtest_failures;\
|
|
||||||
::testing::internal::SingleFailureChecker gtest_checker(\
|
|
||||||
>est_failures, ::testing::TestPartResult::kNonFatalFailure, \
|
|
||||||
(substr));\
|
|
||||||
{\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter gtest_reporter(\
|
|
||||||
::testing::ScopedFakeTestPartResultReporter::INTERCEPT_ALL_THREADS, \
|
|
||||||
>est_failures);\
|
|
||||||
if (::testing::internal::AlwaysTrue()) { statement; }\
|
|
||||||
}\
|
|
||||||
} while (::testing::internal::AlwaysFalse())
|
|
||||||
|
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_SPI_H_
|
|
20065
externals/dynarmic/externals/fmt/test/gtest/gtest.h
vendored
|
@ -1,3 +0,0 @@
|
||||||
// Additional translation unit for the header-only configuration test
|
|
||||||
|
|
||||||
#include "fmt/core.h"
|
|
109
externals/dynarmic/externals/fmt/test/locale-test.cc
vendored
|
@ -1,109 +0,0 @@
|
||||||
// Formatting library for C++ - locale tests
|
|
||||||
//
|
|
||||||
// Copyright (c) 2012 - present, Victor Zverovich
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// For the license information refer to format.h.
|
|
||||||
|
|
||||||
#include "fmt/locale.h"
|
|
||||||
|
|
||||||
#include "gmock.h"
|
|
||||||
|
|
||||||
using fmt::detail::max_value;
|
|
||||||
|
|
||||||
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
|
|
||||||
template <typename Char> struct numpunct : std::numpunct<Char> {
|
|
||||||
protected:
|
|
||||||
Char do_decimal_point() const FMT_OVERRIDE { return '?'; }
|
|
||||||
std::string do_grouping() const FMT_OVERRIDE { return "\03"; }
|
|
||||||
Char do_thousands_sep() const FMT_OVERRIDE { return '~'; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Char> struct no_grouping : std::numpunct<Char> {
|
|
||||||
protected:
|
|
||||||
Char do_decimal_point() const FMT_OVERRIDE { return '.'; }
|
|
||||||
std::string do_grouping() const FMT_OVERRIDE { return ""; }
|
|
||||||
Char do_thousands_sep() const FMT_OVERRIDE { return ','; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Char> struct special_grouping : std::numpunct<Char> {
|
|
||||||
protected:
|
|
||||||
Char do_decimal_point() const FMT_OVERRIDE { return '.'; }
|
|
||||||
std::string do_grouping() const FMT_OVERRIDE { return "\03\02"; }
|
|
||||||
Char do_thousands_sep() const FMT_OVERRIDE { return ','; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template <typename Char> struct small_grouping : std::numpunct<Char> {
|
|
||||||
protected:
|
|
||||||
Char do_decimal_point() const FMT_OVERRIDE { return '.'; }
|
|
||||||
std::string do_grouping() const FMT_OVERRIDE { return "\01"; }
|
|
||||||
Char do_thousands_sep() const FMT_OVERRIDE { return ','; }
|
|
||||||
};
|
|
||||||
|
|
||||||
TEST(LocaleTest, DoubleDecimalPoint) {
|
|
||||||
std::locale loc(std::locale(), new numpunct<char>());
|
|
||||||
EXPECT_EQ("1?23", fmt::format(loc, "{:L}", 1.23));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(LocaleTest, Format) {
|
|
||||||
std::locale loc(std::locale(), new numpunct<char>());
|
|
||||||
EXPECT_EQ("1234567", fmt::format(std::locale(), "{:L}", 1234567));
|
|
||||||
EXPECT_EQ("1~234~567", fmt::format(loc, "{:L}", 1234567));
|
|
||||||
EXPECT_EQ("-1~234~567", fmt::format(loc, "{:L}", -1234567));
|
|
||||||
fmt::format_arg_store<fmt::format_context, int> as{1234567};
|
|
||||||
EXPECT_EQ("1~234~567", fmt::vformat(loc, "{:L}", fmt::format_args(as)));
|
|
||||||
std::string s;
|
|
||||||
fmt::format_to(std::back_inserter(s), loc, "{:L}", 1234567);
|
|
||||||
EXPECT_EQ("1~234~567", s);
|
|
||||||
|
|
||||||
std::locale no_grouping_loc(std::locale(), new no_grouping<char>());
|
|
||||||
EXPECT_EQ("1234567", fmt::format(no_grouping_loc, "{:L}", 1234567));
|
|
||||||
|
|
||||||
std::locale special_grouping_loc(std::locale(), new special_grouping<char>());
|
|
||||||
EXPECT_EQ("1,23,45,678", fmt::format(special_grouping_loc, "{:L}", 12345678));
|
|
||||||
EXPECT_EQ("12,345", fmt::format(special_grouping_loc, "{:L}", 12345));
|
|
||||||
|
|
||||||
std::locale small_grouping_loc(std::locale(), new small_grouping<char>());
|
|
||||||
EXPECT_EQ("4,2,9,4,9,6,7,2,9,5",
|
|
||||||
fmt::format(small_grouping_loc, "{:L}", max_value<uint32_t>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(LocaleTest, FormatDetaultAlign) {
|
|
||||||
std::locale special_grouping_loc(std::locale(), new special_grouping<char>());
|
|
||||||
EXPECT_EQ(" 12,345", fmt::format(special_grouping_loc, "{:8L}", 12345));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(LocaleTest, WFormat) {
|
|
||||||
std::locale loc(std::locale(), new numpunct<wchar_t>());
|
|
||||||
EXPECT_EQ(L"1234567", fmt::format(std::locale(), L"{:L}", 1234567));
|
|
||||||
EXPECT_EQ(L"1~234~567", fmt::format(loc, L"{:L}", 1234567));
|
|
||||||
fmt::format_arg_store<fmt::wformat_context, int> as{1234567};
|
|
||||||
EXPECT_EQ(L"1~234~567", fmt::vformat(loc, L"{:L}", fmt::wformat_args(as)));
|
|
||||||
EXPECT_EQ(L"1234567", fmt::format(std::locale("C"), L"{:L}", 1234567));
|
|
||||||
|
|
||||||
std::locale no_grouping_loc(std::locale(), new no_grouping<wchar_t>());
|
|
||||||
EXPECT_EQ(L"1234567", fmt::format(no_grouping_loc, L"{:L}", 1234567));
|
|
||||||
|
|
||||||
std::locale special_grouping_loc(std::locale(),
|
|
||||||
new special_grouping<wchar_t>());
|
|
||||||
EXPECT_EQ(L"1,23,45,678",
|
|
||||||
fmt::format(special_grouping_loc, L"{:L}", 12345678));
|
|
||||||
|
|
||||||
std::locale small_grouping_loc(std::locale(), new small_grouping<wchar_t>());
|
|
||||||
EXPECT_EQ(L"4,2,9,4,9,6,7,2,9,5",
|
|
||||||
fmt::format(small_grouping_loc, L"{:L}", max_value<uint32_t>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST(LocaleTest, DoubleFormatter) {
|
|
||||||
auto loc = std::locale(std::locale(), new special_grouping<char>());
|
|
||||||
auto f = fmt::formatter<int>();
|
|
||||||
auto parse_ctx = fmt::format_parse_context("L");
|
|
||||||
f.parse(parse_ctx);
|
|
||||||
char buf[10] = {};
|
|
||||||
fmt::basic_format_context<char*, char> format_ctx(
|
|
||||||
buf, {}, fmt::detail::locale_ref(loc));
|
|
||||||
*f.format(12345, format_ctx) = 0;
|
|
||||||
EXPECT_STREQ("12,345", buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // FMT_STATIC_THOUSANDS_SEPARATOR
|
|
12
externals/dynarmic/externals/xbyak/.travis.yml
vendored
|
@ -1,12 +0,0 @@
|
||||||
sudo: true
|
|
||||||
dist: bionic
|
|
||||||
language: cpp
|
|
||||||
compiler:
|
|
||||||
- gcc
|
|
||||||
- clang
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- nasm yasm g++-multilib tcsh
|
|
||||||
script:
|
|
||||||
- make test
|
|
427
externals/dynarmic/externals/xbyak/sample/bf.vcproj
vendored
|
@ -1,427 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="bf"
|
|
||||||
ProjectGUID="{654BD79B-59D3-4B10-BBAA-158BAB272828}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/bf.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/bf.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/bf.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/bf.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/bf.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/bf.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/bf.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/bf.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/bf.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/bf.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/bf.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/bf.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/bf.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/bf.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/bf.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/bf.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/bf.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/bf.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/bf.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/bf.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="bf.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,423 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="calc"
|
|
||||||
ProjectGUID="{5FDDFAA6-B947-491D-A17E-BBD863846579}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/calc.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/calc.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/calc.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/calc.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/calc.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/calc.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/calc.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/calc.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/calc.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/calc.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/calc.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/calc.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/calc.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/calc.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/calc.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/calc.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/calc.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/calc.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/calc.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/calc.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="calc.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,427 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="quantize"
|
|
||||||
ProjectGUID="{D06753BF-E1F3-4578-9B18-08673327F77C}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/quantize.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/quantize.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/quantize.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/quantize.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/quantize.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/quantize.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/quantize.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/quantize.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/quantize.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/quantize.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/quantize.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/quantize.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/quantize.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/quantize.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/quantize.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/quantize.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/quantize.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/quantize.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/quantize.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/quantize.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="quantize.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,427 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="test0"
|
|
||||||
ProjectGUID="{1CDE4D2A-BE3A-4B9B-B28F-524A23084A8E}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/test0.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/test0.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/test0.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/test0.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/test0.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/test0.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/test0.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/test0.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/test0.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/test0.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/test0.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/test0.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/test0.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/test0.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/test0.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/test0.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/test0.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/test0.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/test0.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/test0.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="test0.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,427 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="test_util"
|
|
||||||
ProjectGUID="{CFC9B272-FDA1-4C87-B4EF-CDCA9B57F4DD}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/test_util.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/test_util.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/test_util.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/test_util.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/test_util.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/test_util.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/test_util.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/test_util.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/test_util.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/test_util.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/test_util.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/test_util.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/test_util.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/test_util.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/test_util.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/test_util.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/test_util.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/test_util.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/test_util.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/test_util.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="test_util.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
|
@ -1,427 +0,0 @@
|
||||||
<?xml version="1.0" encoding="shift_jis"?>
|
|
||||||
<VisualStudioProject
|
|
||||||
ProjectType="Visual C++"
|
|
||||||
Version="9.00"
|
|
||||||
Name="toyvm"
|
|
||||||
ProjectGUID="{2E41C7AF-39FF-454C-B081-37445378DCB3}"
|
|
||||||
TargetFrameworkVersion="0"
|
|
||||||
>
|
|
||||||
<Platforms>
|
|
||||||
<Platform
|
|
||||||
Name="Win32"
|
|
||||||
/>
|
|
||||||
<Platform
|
|
||||||
Name="x64"
|
|
||||||
/>
|
|
||||||
</Platforms>
|
|
||||||
<ToolFiles>
|
|
||||||
</ToolFiles>
|
|
||||||
<Configurations>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
OutputDirectory=".\Debug"
|
|
||||||
IntermediateDirectory=".\Debug"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Debug/toyvm.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/toyvm.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/toyvm.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/toyvm.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/toyvm.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|Win32"
|
|
||||||
OutputDirectory=".\Release"
|
|
||||||
IntermediateDirectory=".\Release"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TypeLibraryName=".\Release/toyvm.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/toyvm.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/toyvm.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/toyvm.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/toyvm.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Debug|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Debug/toyvm.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="0"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\Debug/toyvm.pch"
|
|
||||||
AssemblerListingLocation=".\Debug/"
|
|
||||||
ObjectFile=".\Debug/"
|
|
||||||
ProgramDataBaseFileName=".\Debug/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Debug/toyvm.exe"
|
|
||||||
LinkIncremental="2"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile=".\Debug/toyvm.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/toyvm.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="Release|x64"
|
|
||||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
|
||||||
ConfigurationType="1"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
TargetEnvironment="3"
|
|
||||||
TypeLibraryName=".\Release/toyvm.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/toyvm.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="4"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1041"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLinkerTool"
|
|
||||||
OutputFile=".\Release/toyvm.exe"
|
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
ProgramDatabaseFile=".\Release/toyvm.pdb"
|
|
||||||
SubSystem="1"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
TargetMachine="17"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManifestTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/toyvm.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCAppVerifierTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
</Configurations>
|
|
||||||
<References>
|
|
||||||
</References>
|
|
||||||
<Files>
|
|
||||||
<File
|
|
||||||
RelativePath="toyvm.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Files>
|
|
||||||
<Globals>
|
|
||||||
</Globals>
|
|
||||||
</VisualStudioProject>
|
|
115
externals/dynarmic/include/dynarmic/A32/a32.h
vendored
|
@ -1,115 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/config.h>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
struct Context;
|
|
||||||
|
|
||||||
class Jit final {
|
|
||||||
public:
|
|
||||||
explicit Jit(UserConfig conf);
|
|
||||||
~Jit();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the emulated CPU.
|
|
||||||
* Cannot be recursively called.
|
|
||||||
*/
|
|
||||||
void Run();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Steps the emulated CPU.
|
|
||||||
* Cannot be recursively called.
|
|
||||||
*/
|
|
||||||
void Step();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the code cache of all compiled code.
|
|
||||||
* Can be called at any time. Halts execution if called within a callback.
|
|
||||||
*/
|
|
||||||
void ClearCache();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalidate the code cache at a range of addresses.
|
|
||||||
* @param start_address The starting address of the range to invalidate.
|
|
||||||
* @param length The length (in bytes) of the range to invalidate.
|
|
||||||
*/
|
|
||||||
void InvalidateCacheRange(std::uint32_t start_address, std::size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset CPU state to state at startup. Does not clear code cache.
|
|
||||||
* Cannot be called from a callback.
|
|
||||||
*/
|
|
||||||
void Reset();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops execution in Jit::Run.
|
|
||||||
* Can only be called from a callback.
|
|
||||||
*/
|
|
||||||
void HaltExecution();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HACK:
|
|
||||||
* Exits execution from a callback, the callback must rewind the stack or
|
|
||||||
* never return to dynarmic from it's current stack.
|
|
||||||
*/
|
|
||||||
void ExceptionalExit();
|
|
||||||
|
|
||||||
/// HACK: Change processor ID.
|
|
||||||
void ChangeProcessorID(std::size_t new_processor);
|
|
||||||
|
|
||||||
/// View and modify registers.
|
|
||||||
std::array<std::uint32_t, 16>& Regs();
|
|
||||||
const std::array<std::uint32_t, 16>& Regs() const;
|
|
||||||
std::array<std::uint32_t, 64>& ExtRegs();
|
|
||||||
const std::array<std::uint32_t, 64>& ExtRegs() const;
|
|
||||||
|
|
||||||
/// View and modify CPSR.
|
|
||||||
std::uint32_t Cpsr() const;
|
|
||||||
void SetCpsr(std::uint32_t value);
|
|
||||||
|
|
||||||
/// View and modify FPSCR.
|
|
||||||
std::uint32_t Fpscr() const;
|
|
||||||
void SetFpscr(std::uint32_t value);
|
|
||||||
|
|
||||||
Context SaveContext() const;
|
|
||||||
void SaveContext(Context&) const;
|
|
||||||
void LoadContext(const Context&);
|
|
||||||
|
|
||||||
/// Clears exclusive state for this core.
|
|
||||||
void ClearExclusiveState();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if Jit::Run was called but hasn't returned yet.
|
|
||||||
* i.e.: We're in a callback.
|
|
||||||
*/
|
|
||||||
bool IsExecuting() const {
|
|
||||||
return is_executing;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debugging: Disassemble all of compiled code.
|
|
||||||
* @return A string containing disassembly of all host machine code produced.
|
|
||||||
*/
|
|
||||||
std::string Disassemble() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool is_executing = false;
|
|
||||||
|
|
||||||
struct Impl;
|
|
||||||
std::unique_ptr<Impl> impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,23 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2020 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
enum class ArchVersion {
|
|
||||||
v3,
|
|
||||||
v4,
|
|
||||||
v4T,
|
|
||||||
v5TE,
|
|
||||||
v6K,
|
|
||||||
v6T2,
|
|
||||||
v7,
|
|
||||||
v8,
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
210
externals/dynarmic/include/dynarmic/A32/config.h
vendored
|
@ -1,210 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/arch_version.h>
|
|
||||||
#include <dynarmic/optimization_flags.h>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
class ExclusiveMonitor;
|
|
||||||
} // namespace Dynarmic
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
using VAddr = std::uint32_t;
|
|
||||||
|
|
||||||
class Coprocessor;
|
|
||||||
|
|
||||||
enum class Exception {
|
|
||||||
/// An UndefinedFault occured due to executing instruction with an unallocated encoding
|
|
||||||
UndefinedInstruction,
|
|
||||||
/// An unpredictable instruction is to be executed. Implementation-defined behaviour should now happen.
|
|
||||||
/// This behaviour is up to the user of this library to define.
|
|
||||||
UnpredictableInstruction,
|
|
||||||
/// A decode error occurred when decoding this instruction. This should never happen.
|
|
||||||
DecodeError,
|
|
||||||
/// A SEV instruction was executed. The event register of all PEs should be set. (Hint instruction.)
|
|
||||||
SendEvent,
|
|
||||||
/// A SEVL instruction was executed. The event register of the current PE should be set. (Hint instruction.)
|
|
||||||
SendEventLocal,
|
|
||||||
/// A WFI instruction was executed. You may now enter a low-power state. (Hint instruction.)
|
|
||||||
WaitForInterrupt,
|
|
||||||
/// A WFE instruction was executed. You may now enter a low-power state if the event register is clear. (Hint instruction.)
|
|
||||||
WaitForEvent,
|
|
||||||
/// A YIELD instruction was executed. (Hint instruction.)
|
|
||||||
Yield,
|
|
||||||
/// A BKPT instruction was executed.
|
|
||||||
Breakpoint,
|
|
||||||
/// A PLD instruction was executed. (Hint instruction.)
|
|
||||||
PreloadData,
|
|
||||||
/// A PLDW instruction was executed. (Hint instruction.)
|
|
||||||
PreloadDataWithIntentToWrite,
|
|
||||||
/// A PLI instruction was executed. (Hint instruction.)
|
|
||||||
PreloadInstruction,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// These function pointers may be inserted into compiled code.
|
|
||||||
struct UserCallbacks {
|
|
||||||
virtual ~UserCallbacks() = default;
|
|
||||||
|
|
||||||
// All reads through this callback are 4-byte aligned.
|
|
||||||
// Memory must be interpreted as little endian.
|
|
||||||
virtual std::uint32_t MemoryReadCode(VAddr vaddr) { return MemoryRead32(vaddr); }
|
|
||||||
|
|
||||||
// Reads through these callbacks may not be aligned.
|
|
||||||
// Memory must be interpreted as if ENDIANSTATE == 0, endianness will be corrected by the JIT.
|
|
||||||
virtual std::uint8_t MemoryRead8(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint16_t MemoryRead16(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint32_t MemoryRead32(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint64_t MemoryRead64(VAddr vaddr) = 0;
|
|
||||||
|
|
||||||
// Writes through these callbacks may not be aligned.
|
|
||||||
virtual void MemoryWrite8(VAddr vaddr, std::uint8_t value) = 0;
|
|
||||||
virtual void MemoryWrite16(VAddr vaddr, std::uint16_t value) = 0;
|
|
||||||
virtual void MemoryWrite32(VAddr vaddr, std::uint32_t value) = 0;
|
|
||||||
virtual void MemoryWrite64(VAddr vaddr, std::uint64_t value) = 0;
|
|
||||||
|
|
||||||
// Writes through these callbacks may not be aligned.
|
|
||||||
virtual bool MemoryWriteExclusive8(VAddr /*vaddr*/, std::uint8_t /*value*/, std::uint8_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive16(VAddr /*vaddr*/, std::uint16_t /*value*/, std::uint16_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive32(VAddr /*vaddr*/, std::uint32_t /*value*/, std::uint32_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive64(VAddr /*vaddr*/, std::uint64_t /*value*/, std::uint64_t /*expected*/) { return false; }
|
|
||||||
|
|
||||||
// If this callback returns true, the JIT will assume MemoryRead* callbacks will always
|
|
||||||
// return the same value at any point in time for this vaddr. The JIT may use this information
|
|
||||||
// in optimizations.
|
|
||||||
// A conservative implementation that always returns false is safe.
|
|
||||||
virtual bool IsReadOnlyMemory(VAddr /* vaddr */) { return false; }
|
|
||||||
|
|
||||||
/// The interpreter must execute exactly num_instructions starting from PC.
|
|
||||||
virtual void InterpreterFallback(VAddr pc, size_t num_instructions) = 0;
|
|
||||||
|
|
||||||
// This callback is called whenever a SVC instruction is executed.
|
|
||||||
virtual void CallSVC(std::uint32_t swi) = 0;
|
|
||||||
|
|
||||||
virtual void ExceptionRaised(VAddr pc, Exception exception) = 0;
|
|
||||||
|
|
||||||
virtual void InstructionSynchronizationBarrierRaised() {}
|
|
||||||
|
|
||||||
// Timing-related callbacks
|
|
||||||
// ticks ticks have passed
|
|
||||||
virtual void AddTicks(std::uint64_t ticks) = 0;
|
|
||||||
// How many more ticks am I allowed to execute?
|
|
||||||
virtual std::uint64_t GetTicksRemaining() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UserConfig {
|
|
||||||
UserCallbacks* callbacks;
|
|
||||||
|
|
||||||
size_t processor_id = 0;
|
|
||||||
ExclusiveMonitor* global_monitor = nullptr;
|
|
||||||
|
|
||||||
/// Select the architecture version to use.
|
|
||||||
/// There are minor behavioural differences between versions.
|
|
||||||
ArchVersion arch_version = ArchVersion::v8;
|
|
||||||
|
|
||||||
/// This selects other optimizations than can't otherwise be disabled by setting other
|
|
||||||
/// configuration options. This includes:
|
|
||||||
/// - IR optimizations
|
|
||||||
/// - Block linking optimizations
|
|
||||||
/// - RSB optimizations
|
|
||||||
/// This is intended to be used for debugging.
|
|
||||||
OptimizationFlag optimizations = all_safe_optimizations;
|
|
||||||
|
|
||||||
bool HasOptimization(OptimizationFlag f) const {
|
|
||||||
if (!unsafe_optimizations) {
|
|
||||||
f &= all_safe_optimizations;
|
|
||||||
}
|
|
||||||
return (f & optimizations) != no_optimizations;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This enables unsafe optimizations that reduce emulation accuracy in favour of speed.
|
|
||||||
/// For safety, in order to enable unsafe optimizations you have to set BOTH this flag
|
|
||||||
/// AND the appropriate flag bits above.
|
|
||||||
/// The prefered and tested mode for this library is with unsafe optimizations disabled.
|
|
||||||
bool unsafe_optimizations = false;
|
|
||||||
|
|
||||||
// Page Table
|
|
||||||
// The page table is used for faster memory access. If an entry in the table is nullptr,
|
|
||||||
// the JIT will fallback to calling the MemoryRead*/MemoryWrite* callbacks.
|
|
||||||
static constexpr std::size_t PAGE_BITS = 12;
|
|
||||||
static constexpr std::size_t NUM_PAGE_TABLE_ENTRIES = 1 << (32 - PAGE_BITS);
|
|
||||||
std::array<std::uint8_t*, NUM_PAGE_TABLE_ENTRIES>* page_table = nullptr;
|
|
||||||
/// Determines if the pointer in the page_table shall be offseted locally or globally.
|
|
||||||
/// 'false' will access page_table[addr >> bits][addr & mask]
|
|
||||||
/// 'true' will access page_table[addr >> bits][addr]
|
|
||||||
/// Note: page_table[addr >> bits] will still be checked to verify active pages.
|
|
||||||
/// So there might be wrongly faulted pages which maps to nullptr.
|
|
||||||
/// This can be avoided by carefully allocating the memory region.
|
|
||||||
bool absolute_offset_page_table = false;
|
|
||||||
/// Masks out the first N bits in host pointers from the page table.
|
|
||||||
/// The intention behind this is to allow users of Dynarmic to pack attributes in the
|
|
||||||
/// same integer and update the pointer attribute pair atomically.
|
|
||||||
/// If the configured value is 3, all pointers will be forcefully aligned to 8 bytes.
|
|
||||||
int page_table_pointer_mask_bits = 0;
|
|
||||||
/// Determines if we should detect memory accesses via page_table that straddle are
|
|
||||||
/// misaligned. Accesses that straddle page boundaries will fallback to the relevant
|
|
||||||
/// memory callback.
|
|
||||||
/// This value should be the required access sizes this applies to ORed together.
|
|
||||||
/// To detect any access, use: 8 | 16 | 32 | 64.
|
|
||||||
std::uint8_t detect_misaligned_access_via_page_table = 0;
|
|
||||||
/// Determines if the above option only triggers when the misalignment straddles a
|
|
||||||
/// page boundary.
|
|
||||||
bool only_detect_misalignment_via_page_table_on_page_boundary = false;
|
|
||||||
|
|
||||||
// Fastmem Pointer
|
|
||||||
// This should point to the beginning of a 4GB address space which is in arranged just like
|
|
||||||
// what you wish for emulated memory to be. If the host page faults on an address, the JIT
|
|
||||||
// will fallback to calling the MemoryRead*/MemoryWrite* callbacks.
|
|
||||||
void* fastmem_pointer = nullptr;
|
|
||||||
/// Determines if instructions that pagefault should cause recompilation of that block
|
|
||||||
/// with fastmem disabled.
|
|
||||||
bool recompile_on_fastmem_failure = true;
|
|
||||||
|
|
||||||
// Coprocessors
|
|
||||||
std::array<std::shared_ptr<Coprocessor>, 16> coprocessors{};
|
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::InstructionSynchronizationBarrierRaised will be
|
|
||||||
/// called when an ISB instruction is executed.
|
|
||||||
/// When set to false, ISB will be treated as a NOP instruction.
|
|
||||||
bool hook_isb = false;
|
|
||||||
|
|
||||||
/// Hint instructions would cause ExceptionRaised to be called with the appropriate
|
|
||||||
/// argument.
|
|
||||||
bool hook_hint_instructions = false;
|
|
||||||
|
|
||||||
/// This option relates to translation. Generally when we run into an unpredictable
|
|
||||||
/// instruction the ExceptionRaised callback is called. If this is true, we define
|
|
||||||
/// definite behaviour for some unpredictable instructions.
|
|
||||||
bool define_unpredictable_behaviour = false;
|
|
||||||
|
|
||||||
/// HACK:
|
|
||||||
/// This tells the translator a wall clock will be used, thus allowing it
|
|
||||||
/// to avoid writting certain unnecessary code only needed for cycle timers.
|
|
||||||
bool wall_clock_cntpct = false;
|
|
||||||
|
|
||||||
/// This option relates to the CPSR.E flag. Enabling this option disables modification
|
|
||||||
/// of CPSR.E by the emulated program, forcing it to 0.
|
|
||||||
/// NOTE: Calling Jit::SetCpsr with CPSR.E=1 while this option is enabled may result
|
|
||||||
/// in unusual behavior.
|
|
||||||
bool always_little_endian = false;
|
|
||||||
|
|
||||||
// Minimum size is about 8MiB. Maximum size is about 2GiB. Maximum size is limited by
|
|
||||||
// the maximum length of a x64 jump.
|
|
||||||
size_t code_cache_size = 256 * 1024 * 1024; // bytes
|
|
||||||
// Determines the relative size of the near and far code caches. Must be smaller than
|
|
||||||
// code_cache_size.
|
|
||||||
size_t far_code_offset = 200 * 1024 * 1024; // bytes
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,45 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
struct Context {
|
|
||||||
public:
|
|
||||||
Context();
|
|
||||||
~Context();
|
|
||||||
Context(const Context&);
|
|
||||||
Context(Context&&) noexcept;
|
|
||||||
Context& operator=(const Context&);
|
|
||||||
Context& operator=(Context&&) noexcept;
|
|
||||||
|
|
||||||
/// View and modify registers.
|
|
||||||
std::array<std::uint32_t, 16>& Regs();
|
|
||||||
const std::array<std::uint32_t, 16>& Regs() const;
|
|
||||||
std::array<std::uint32_t, 64>& ExtRegs();
|
|
||||||
const std::array<std::uint32_t, 64>& ExtRegs() const;
|
|
||||||
|
|
||||||
/// View and modify CPSR.
|
|
||||||
std::uint32_t Cpsr() const;
|
|
||||||
void SetCpsr(std::uint32_t value);
|
|
||||||
|
|
||||||
/// View and modify FPSCR.
|
|
||||||
std::uint32_t Fpscr() const;
|
|
||||||
void SetFpscr(std::uint32_t value);
|
|
||||||
|
|
||||||
private:
|
|
||||||
friend class Jit;
|
|
||||||
struct Impl;
|
|
||||||
std::unique_ptr<Impl> impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,110 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <optional>
|
|
||||||
#include <variant>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/coprocessor_util.h>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
class Jit;
|
|
||||||
|
|
||||||
class Coprocessor {
|
|
||||||
public:
|
|
||||||
virtual ~Coprocessor() = default;
|
|
||||||
|
|
||||||
struct Callback {
|
|
||||||
/**
|
|
||||||
* @param jit CPU state
|
|
||||||
* @param user_arg Set to Callback::user_arg at runtime
|
|
||||||
* @param arg0 Purpose of this argument depends on type of callback.
|
|
||||||
* @param arg1 Purpose of this argument depends on type of callback.
|
|
||||||
* @return Purpose of return value depends on type of callback.
|
|
||||||
*/
|
|
||||||
std::uint64_t (*function)(Jit* jit, void* user_arg, std::uint32_t arg0, std::uint32_t arg1);
|
|
||||||
/// If std::nullopt, function will be called with a user_arg parameter containing garbage.
|
|
||||||
std::optional<void*> user_arg;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* std::monostate: coprocessor exception will be compiled
|
|
||||||
* Callback: a call to the Callback will be compiled
|
|
||||||
* std::uint32_t*: a write/read to that memory address will be compiled
|
|
||||||
*/
|
|
||||||
using CallbackOrAccessOneWord = std::variant<std::monostate, Callback, std::uint32_t*>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* std::monostate: coprocessor exception will be compiled
|
|
||||||
* Callback: a call to the Callback will be compiled
|
|
||||||
* std::array<std::uint32_t*, 2>: a write/read to those memory addresses will be compiled
|
|
||||||
*/
|
|
||||||
using CallbackOrAccessTwoWords = std::variant<std::monostate, Callback, std::array<std::uint32_t*, 2>>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling CDP or CDP2 for this coprocessor.
|
|
||||||
* A return value of std::nullopt will cause a coprocessor exception to be compiled.
|
|
||||||
* arg0, arg1 and return value of callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual std::optional<Callback> CompileInternalOperation(bool two, unsigned opc1, CoprocReg CRd, CoprocReg CRn, CoprocReg CRm, unsigned opc2) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling MCR or MCR2 for this coprocessor.
|
|
||||||
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
|
||||||
* arg0 of the callback will contain the word sent to the coprocessor.
|
|
||||||
* arg1 and return value of the callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual CallbackOrAccessOneWord CompileSendOneWord(bool two, unsigned opc1, CoprocReg CRn, CoprocReg CRm, unsigned opc2) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling MCRR or MCRR2 for this coprocessor.
|
|
||||||
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
|
||||||
* arg0 and arg1 of the callback will contain the words sent to the coprocessor.
|
|
||||||
* The return value of the callback is ignored.
|
|
||||||
*/
|
|
||||||
virtual CallbackOrAccessTwoWords CompileSendTwoWords(bool two, unsigned opc, CoprocReg CRm) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling MRC or MRC2 for this coprocessor.
|
|
||||||
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
|
||||||
* The return value of the callback should contain word from coprocessor.
|
|
||||||
* The low word of the return value will be stored in Rt.
|
|
||||||
* arg0 and arg1 of the callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual CallbackOrAccessOneWord CompileGetOneWord(bool two, unsigned opc1, CoprocReg CRn, CoprocReg CRm, unsigned opc2) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling MRRC or MRRC2 for this coprocessor.
|
|
||||||
* A return value of std::monostate will cause a coprocessor exception to be compiled.
|
|
||||||
* The return value of the callback should contain words from coprocessor.
|
|
||||||
* The low word of the return value will be stored in Rt.
|
|
||||||
* The high word of the return value will be stored in Rt2.
|
|
||||||
* arg0 and arg1 of the callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual CallbackOrAccessTwoWords CompileGetTwoWords(bool two, unsigned opc, CoprocReg CRm) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling LDC or LDC2 for this coprocessor.
|
|
||||||
* A return value of std::nullopt will cause a coprocessor exception to be compiled.
|
|
||||||
* arg0 of the callback will contain the start address.
|
|
||||||
* arg1 and return value of the callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual std::optional<Callback> CompileLoadWords(bool two, bool long_transfer, CoprocReg CRd, std::optional<std::uint8_t> option) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when compiling STC or STC2 for this coprocessor.
|
|
||||||
* A return value of std::nullopt will cause a coprocessor exception to be compiled.
|
|
||||||
* arg0 of the callback will contain the start address.
|
|
||||||
* arg1 and return value of the callback are ignored.
|
|
||||||
*/
|
|
||||||
virtual std::optional<Callback> CompileStoreWords(bool two, bool long_transfer, CoprocReg CRd, std::optional<std::uint8_t> option) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,16 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
enum class CoprocReg {
|
|
||||||
C0, C1, C2, C3, C4, C5, C6, C7, C8, C9, C10, C11, C12, C13, C14, C15
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,18 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A32 {
|
|
||||||
|
|
||||||
std::string DisassembleArm(std::uint32_t instruction);
|
|
||||||
std::string DisassembleThumb16(std::uint16_t instruction);
|
|
||||||
|
|
||||||
} // namespace A32
|
|
||||||
} // namespace Dynarmic
|
|
139
externals/dynarmic/include/dynarmic/A64/a64.h
vendored
|
@ -1,139 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <memory>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include <dynarmic/A64/config.h>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A64 {
|
|
||||||
|
|
||||||
struct Context;
|
|
||||||
|
|
||||||
class Jit final {
|
|
||||||
public:
|
|
||||||
explicit Jit(UserConfig conf);
|
|
||||||
~Jit();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the emulated CPU.
|
|
||||||
* Cannot be recursively called.
|
|
||||||
*/
|
|
||||||
void Run();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Step the emulated CPU for one instruction.
|
|
||||||
* Cannot be recursively called.
|
|
||||||
*/
|
|
||||||
void Step();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears the code cache of all compiled code.
|
|
||||||
* Can be called at any time. Halts execution if called within a callback.
|
|
||||||
*/
|
|
||||||
void ClearCache();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Invalidate the code cache at a range of addresses.
|
|
||||||
* @param start_address The starting address of the range to invalidate.
|
|
||||||
* @param length The length (in bytes) of the range to invalidate.
|
|
||||||
*/
|
|
||||||
void InvalidateCacheRange(std::uint64_t start_address, std::size_t length);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset CPU state to state at startup. Does not clear code cache.
|
|
||||||
* Cannot be called from a callback.
|
|
||||||
*/
|
|
||||||
void Reset();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops execution in Jit::Run.
|
|
||||||
* Can only be called from a callback.
|
|
||||||
*/
|
|
||||||
void HaltExecution();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HACK:
|
|
||||||
* Exits execution from a callback, the callback must rewind the stack or
|
|
||||||
* never return to dynarmic from it's current stack.
|
|
||||||
*/
|
|
||||||
void ExceptionalExit();
|
|
||||||
|
|
||||||
/// HACK: Change processor ID.
|
|
||||||
void ChangeProcessorID(std::size_t new_processor);
|
|
||||||
|
|
||||||
/// Read Stack Pointer
|
|
||||||
std::uint64_t GetSP() const;
|
|
||||||
/// Modify Stack Pointer
|
|
||||||
void SetSP(std::uint64_t value);
|
|
||||||
|
|
||||||
/// Read Program Counter
|
|
||||||
std::uint64_t GetPC() const;
|
|
||||||
/// Modify Program Counter
|
|
||||||
void SetPC(std::uint64_t value);
|
|
||||||
|
|
||||||
/// Read general-purpose register.
|
|
||||||
std::uint64_t GetRegister(std::size_t index) const;
|
|
||||||
/// Modify general-purpose register.
|
|
||||||
void SetRegister(size_t index, std::uint64_t value);
|
|
||||||
|
|
||||||
/// Read all general-purpose registers.
|
|
||||||
std::array<std::uint64_t, 31> GetRegisters() const;
|
|
||||||
/// Modify all general-purpose registers.
|
|
||||||
void SetRegisters(const std::array<std::uint64_t, 31>& value);
|
|
||||||
|
|
||||||
/// Read floating point and SIMD register.
|
|
||||||
Vector GetVector(std::size_t index) const;
|
|
||||||
/// Modify floating point and SIMD register.
|
|
||||||
void SetVector(std::size_t index, Vector value);
|
|
||||||
|
|
||||||
/// Read all floating point and SIMD registers.
|
|
||||||
std::array<Vector, 32> GetVectors() const;
|
|
||||||
/// Modify all floating point and SIMD registers.
|
|
||||||
void SetVectors(const std::array<Vector, 32>& value);
|
|
||||||
|
|
||||||
/// View FPCR.
|
|
||||||
std::uint32_t GetFpcr() const;
|
|
||||||
/// Modify FPCR.
|
|
||||||
void SetFpcr(std::uint32_t value);
|
|
||||||
|
|
||||||
/// View FPSR.
|
|
||||||
std::uint32_t GetFpsr() const;
|
|
||||||
/// Modify FPSR.
|
|
||||||
void SetFpsr(std::uint32_t value);
|
|
||||||
|
|
||||||
/// View PSTATE
|
|
||||||
std::uint32_t GetPstate() const;
|
|
||||||
/// Modify PSTATE
|
|
||||||
void SetPstate(std::uint32_t value);
|
|
||||||
|
|
||||||
/// Clears exclusive state for this core.
|
|
||||||
void ClearExclusiveState();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if Jit::Run was called but hasn't returned yet.
|
|
||||||
* i.e.: We're in a callback.
|
|
||||||
*/
|
|
||||||
bool IsExecuting() const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Debugging: Disassemble all of compiled code.
|
|
||||||
* @return A string containing disassembly of all host machine code produced.
|
|
||||||
*/
|
|
||||||
std::string Disassemble() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
struct Impl;
|
|
||||||
std::unique_ptr<Impl> impl;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A64
|
|
||||||
} // namespace Dynarmic
|
|
258
externals/dynarmic/include/dynarmic/A64/config.h
vendored
|
@ -1,258 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <dynarmic/optimization_flags.h>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
class ExclusiveMonitor;
|
|
||||||
} // namespace Dynarmic
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace A64 {
|
|
||||||
|
|
||||||
using VAddr = std::uint64_t;
|
|
||||||
|
|
||||||
using Vector = std::array<std::uint64_t, 2>;
|
|
||||||
static_assert(sizeof(Vector) == sizeof(std::uint64_t) * 2, "Vector must be 128 bits in size");
|
|
||||||
|
|
||||||
enum class Exception {
|
|
||||||
/// An UndefinedFault occured due to executing instruction with an unallocated encoding
|
|
||||||
UnallocatedEncoding,
|
|
||||||
/// An UndefinedFault occured due to executing instruction containing a reserved value
|
|
||||||
ReservedValue,
|
|
||||||
/// An unpredictable instruction is to be executed. Implementation-defined behaviour should now happen.
|
|
||||||
/// This behaviour is up to the user of this library to define.
|
|
||||||
/// Note: Constraints on unpredictable behaviour are specified in the ARMv8 ARM.
|
|
||||||
UnpredictableInstruction,
|
|
||||||
/// A WFI instruction was executed. You may now enter a low-power state. (Hint instruction.)
|
|
||||||
WaitForInterrupt,
|
|
||||||
/// A WFE instruction was executed. You may now enter a low-power state if the event register is clear. (Hint instruction.)
|
|
||||||
WaitForEvent,
|
|
||||||
/// A SEV instruction was executed. The event register of all PEs should be set. (Hint instruction.)
|
|
||||||
SendEvent,
|
|
||||||
/// A SEVL instruction was executed. The event register of the current PE should be set. (Hint instruction.)
|
|
||||||
SendEventLocal,
|
|
||||||
/// A YIELD instruction was executed. (Hint instruction.)
|
|
||||||
Yield,
|
|
||||||
/// A BRK instruction was executed. (Hint instruction.)
|
|
||||||
Breakpoint,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DataCacheOperation {
|
|
||||||
/// DC CISW
|
|
||||||
CleanAndInvalidateBySetWay,
|
|
||||||
/// DC CIVAC
|
|
||||||
CleanAndInvalidateByVAToPoC,
|
|
||||||
/// DC CSW
|
|
||||||
CleanBySetWay,
|
|
||||||
/// DC CVAC
|
|
||||||
CleanByVAToPoC,
|
|
||||||
/// DC CVAU
|
|
||||||
CleanByVAToPoU,
|
|
||||||
/// DC CVAP
|
|
||||||
CleanByVAToPoP,
|
|
||||||
/// DC ISW
|
|
||||||
InvalidateBySetWay,
|
|
||||||
/// DC IVAC
|
|
||||||
InvalidateByVAToPoC,
|
|
||||||
/// DC ZVA
|
|
||||||
ZeroByVA,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class InstructionCacheOperation {
|
|
||||||
/// IC IVAU
|
|
||||||
InvalidateByVAToPoU,
|
|
||||||
/// IC IALLU
|
|
||||||
InvalidateAllToPoU,
|
|
||||||
/// IC IALLUIS
|
|
||||||
InvalidateAllToPoUInnerSharable
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UserCallbacks {
|
|
||||||
virtual ~UserCallbacks() = default;
|
|
||||||
|
|
||||||
// All reads through this callback are 4-byte aligned.
|
|
||||||
// Memory must be interpreted as little endian.
|
|
||||||
virtual std::uint32_t MemoryReadCode(VAddr vaddr) { return MemoryRead32(vaddr); }
|
|
||||||
|
|
||||||
// Reads through these callbacks may not be aligned.
|
|
||||||
virtual std::uint8_t MemoryRead8(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint16_t MemoryRead16(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint32_t MemoryRead32(VAddr vaddr) = 0;
|
|
||||||
virtual std::uint64_t MemoryRead64(VAddr vaddr) = 0;
|
|
||||||
virtual Vector MemoryRead128(VAddr vaddr) = 0;
|
|
||||||
|
|
||||||
// Writes through these callbacks may not be aligned.
|
|
||||||
virtual void MemoryWrite8(VAddr vaddr, std::uint8_t value) = 0;
|
|
||||||
virtual void MemoryWrite16(VAddr vaddr, std::uint16_t value) = 0;
|
|
||||||
virtual void MemoryWrite32(VAddr vaddr, std::uint32_t value) = 0;
|
|
||||||
virtual void MemoryWrite64(VAddr vaddr, std::uint64_t value) = 0;
|
|
||||||
virtual void MemoryWrite128(VAddr vaddr, Vector value) = 0;
|
|
||||||
|
|
||||||
// Writes through these callbacks may not be aligned.
|
|
||||||
virtual bool MemoryWriteExclusive8(VAddr /*vaddr*/, std::uint8_t /*value*/, std::uint8_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive16(VAddr /*vaddr*/, std::uint16_t /*value*/, std::uint16_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive32(VAddr /*vaddr*/, std::uint32_t /*value*/, std::uint32_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive64(VAddr /*vaddr*/, std::uint64_t /*value*/, std::uint64_t /*expected*/) { return false; }
|
|
||||||
virtual bool MemoryWriteExclusive128(VAddr /*vaddr*/, Vector /*value*/, Vector /*expected*/) { return false; }
|
|
||||||
|
|
||||||
// If this callback returns true, the JIT will assume MemoryRead* callbacks will always
|
|
||||||
// return the same value at any point in time for this vaddr. The JIT may use this information
|
|
||||||
// in optimizations.
|
|
||||||
// A conservative implementation that always returns false is safe.
|
|
||||||
virtual bool IsReadOnlyMemory(VAddr /*vaddr*/) { return false; }
|
|
||||||
|
|
||||||
/// The interpreter must execute exactly num_instructions starting from PC.
|
|
||||||
virtual void InterpreterFallback(VAddr pc, size_t num_instructions) = 0;
|
|
||||||
|
|
||||||
// This callback is called whenever a SVC instruction is executed.
|
|
||||||
virtual void CallSVC(std::uint32_t swi) = 0;
|
|
||||||
|
|
||||||
virtual void ExceptionRaised(VAddr pc, Exception exception) = 0;
|
|
||||||
virtual void DataCacheOperationRaised(DataCacheOperation /*op*/, VAddr /*value*/) {}
|
|
||||||
virtual void InstructionCacheOperationRaised(InstructionCacheOperation /*op*/, VAddr /*value*/) {}
|
|
||||||
virtual void InstructionSynchronizationBarrierRaised() {}
|
|
||||||
|
|
||||||
// Timing-related callbacks
|
|
||||||
// ticks ticks have passed
|
|
||||||
virtual void AddTicks(std::uint64_t ticks) = 0;
|
|
||||||
// How many more ticks am I allowed to execute?
|
|
||||||
virtual std::uint64_t GetTicksRemaining() = 0;
|
|
||||||
// Get value in the emulated counter-timer physical count register.
|
|
||||||
virtual std::uint64_t GetCNTPCT() = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct UserConfig {
|
|
||||||
UserCallbacks* callbacks;
|
|
||||||
|
|
||||||
size_t processor_id = 0;
|
|
||||||
ExclusiveMonitor* global_monitor = nullptr;
|
|
||||||
|
|
||||||
/// This selects other optimizations than can't otherwise be disabled by setting other
|
|
||||||
/// configuration options. This includes:
|
|
||||||
/// - IR optimizations
|
|
||||||
/// - Block linking optimizations
|
|
||||||
/// - RSB optimizations
|
|
||||||
/// This is intended to be used for debugging.
|
|
||||||
OptimizationFlag optimizations = all_safe_optimizations;
|
|
||||||
|
|
||||||
bool HasOptimization(OptimizationFlag f) const {
|
|
||||||
if (!unsafe_optimizations) {
|
|
||||||
f &= all_safe_optimizations;
|
|
||||||
}
|
|
||||||
return (f & optimizations) != no_optimizations;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// This enables unsafe optimizations that reduce emulation accuracy in favour of speed.
|
|
||||||
/// For safety, in order to enable unsafe optimizations you have to set BOTH this flag
|
|
||||||
/// AND the appropriate flag bits above.
|
|
||||||
/// The prefered and tested mode for this library is with unsafe optimizations disabled.
|
|
||||||
bool unsafe_optimizations = false;
|
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::DataCacheOperationRaised will be called when any
|
|
||||||
/// data cache instruction is executed. Notably DC ZVA will not implicitly do anything.
|
|
||||||
/// When set to false, UserCallbacks::DataCacheOperationRaised will never be called.
|
|
||||||
/// Executing DC ZVA in this mode will result in zeros being written to memory.
|
|
||||||
bool hook_data_cache_operations = false;
|
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::InstructionSynchronizationBarrierRaised will be
|
|
||||||
/// called when an ISB instruction is executed.
|
|
||||||
/// When set to false, ISB will be treated as a NOP instruction.
|
|
||||||
bool hook_isb = false;
|
|
||||||
|
|
||||||
/// When set to true, UserCallbacks::ExceptionRaised will be called when any hint
|
|
||||||
/// instruction is executed.
|
|
||||||
bool hook_hint_instructions = false;
|
|
||||||
|
|
||||||
/// Counter-timer frequency register. The value of the register is not interpreted by
|
|
||||||
/// dynarmic.
|
|
||||||
std::uint32_t cntfrq_el0 = 600000000;
|
|
||||||
|
|
||||||
/// CTR_EL0<27:24> is log2 of the cache writeback granule in words.
|
|
||||||
/// CTR_EL0<23:20> is log2 of the exclusives reservation granule in words.
|
|
||||||
/// CTR_EL0<19:16> is log2 of the smallest data/unified cacheline in words.
|
|
||||||
/// CTR_EL0<15:14> is the level 1 instruction cache policy.
|
|
||||||
/// CTR_EL0<3:0> is log2 of the smallest instruction cacheline in words.
|
|
||||||
std::uint32_t ctr_el0 = 0x8444c004;
|
|
||||||
|
|
||||||
/// DCZID_EL0<3:0> is log2 of the block size in words
|
|
||||||
/// DCZID_EL0<4> is 0 if the DC ZVA instruction is permitted.
|
|
||||||
std::uint32_t dczid_el0 = 4;
|
|
||||||
|
|
||||||
/// Pointer to where TPIDRRO_EL0 is stored. This pointer will be inserted into
|
|
||||||
/// emitted code.
|
|
||||||
const std::uint64_t* tpidrro_el0 = nullptr;
|
|
||||||
|
|
||||||
/// Pointer to where TPIDR_EL0 is stored. This pointer will be inserted into
|
|
||||||
/// emitted code.
|
|
||||||
const std::uint64_t* tpidr_el0 = nullptr;
|
|
||||||
|
|
||||||
/// Pointer to the page table which we can use for direct page table access.
|
|
||||||
/// If an entry in page_table is null, the relevant memory callback will be called.
|
|
||||||
/// If page_table is nullptr, all memory accesses hit the memory callbacks.
|
|
||||||
void** page_table = nullptr;
|
|
||||||
/// Declares how many valid address bits are there in virtual addresses.
|
|
||||||
/// Determines the size of page_table. Valid values are between 12 and 64 inclusive.
|
|
||||||
/// This is only used if page_table is not nullptr.
|
|
||||||
size_t page_table_address_space_bits = 36;
|
|
||||||
/// Masks out the first N bits in host pointers from the page table.
|
|
||||||
/// The intention behind this is to allow users of Dynarmic to pack attributes in the
|
|
||||||
/// same integer and update the pointer attribute pair atomically.
|
|
||||||
/// If the configured value is 3, all pointers will be forcefully aligned to 8 bytes.
|
|
||||||
int page_table_pointer_mask_bits = 0;
|
|
||||||
/// Determines what happens if the guest accesses an entry that is off the end of the
|
|
||||||
/// page table. If true, Dynarmic will silently mirror page_table's address space. If
|
|
||||||
/// false, accessing memory outside of page_table bounds will result in a call to the
|
|
||||||
/// relevant memory callback.
|
|
||||||
/// This is only used if page_table is not nullptr.
|
|
||||||
bool silently_mirror_page_table = true;
|
|
||||||
/// Determines if the pointer in the page_table shall be offseted locally or globally.
|
|
||||||
/// 'false' will access page_table[addr >> bits][addr & mask]
|
|
||||||
/// 'true' will access page_table[addr >> bits][addr]
|
|
||||||
/// Note: page_table[addr >> bits] will still be checked to verify active pages.
|
|
||||||
/// So there might be wrongly faulted pages which maps to nullptr.
|
|
||||||
/// This can be avoided by carefully allocating the memory region.
|
|
||||||
bool absolute_offset_page_table = false;
|
|
||||||
/// Determines if we should detect memory accesses via page_table that straddle are
|
|
||||||
/// misaligned. Accesses that straddle page boundaries will fallback to the relevant
|
|
||||||
/// memory callback.
|
|
||||||
/// This value should be the required access sizes this applies to ORed together.
|
|
||||||
/// To detect any access, use: 8 | 16 | 32 | 64 | 128.
|
|
||||||
std::uint8_t detect_misaligned_access_via_page_table = 0;
|
|
||||||
/// Determines if the above option only triggers when the misalignment straddles a
|
|
||||||
/// page boundary.
|
|
||||||
bool only_detect_misalignment_via_page_table_on_page_boundary = false;
|
|
||||||
|
|
||||||
/// This option relates to translation. Generally when we run into an unpredictable
|
|
||||||
/// instruction the ExceptionRaised callback is called. If this is true, we define
|
|
||||||
/// definite behaviour for some unpredictable instructions.
|
|
||||||
bool define_unpredictable_behaviour = false;
|
|
||||||
|
|
||||||
/// HACK:
|
|
||||||
/// This tells the translator a wall clock will be used, thus allowing it
|
|
||||||
/// to avoid writting certain unnecessary code only needed for cycle timers.
|
|
||||||
bool wall_clock_cntpct = false;
|
|
||||||
|
|
||||||
// Determines whether AddTicks and GetTicksRemaining are called.
|
|
||||||
// If false, execution will continue until soon after Jit::HaltExecution is called.
|
|
||||||
// bool enable_ticks = true; // TODO
|
|
||||||
|
|
||||||
// Minimum size is about 8MiB. Maximum size is about 2GiB. Maximum size is limited by
|
|
||||||
// the maximum length of a x64 jump.
|
|
||||||
size_t code_cache_size = 256 * 1024 * 1024; // bytes
|
|
||||||
// Determines the relative size of the near and far code caches. Must be smaller than
|
|
||||||
// code_cache_size.
|
|
||||||
size_t far_code_offset = 200 * 1024 * 1024; // bytes
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace A64
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,81 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <array>
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <cstring>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
|
|
||||||
using VAddr = std::uint64_t;
|
|
||||||
using Vector = std::array<std::uint64_t, 2>;
|
|
||||||
|
|
||||||
class ExclusiveMonitor {
|
|
||||||
public:
|
|
||||||
/// @param processor_count Maximum number of processors using this global
|
|
||||||
/// exclusive monitor. Each processor must have a
|
|
||||||
/// unique id.
|
|
||||||
explicit ExclusiveMonitor(size_t processor_count);
|
|
||||||
|
|
||||||
size_t GetProcessorCount() const;
|
|
||||||
|
|
||||||
/// Marks a region containing [address, address+size) to be exclusive to
|
|
||||||
/// processor processor_id.
|
|
||||||
template <typename T, typename Function>
|
|
||||||
T ReadAndMark(size_t processor_id, VAddr address, Function op) {
|
|
||||||
static_assert(std::is_trivially_copyable_v<T>);
|
|
||||||
const VAddr masked_address = address & RESERVATION_GRANULE_MASK;
|
|
||||||
|
|
||||||
Lock();
|
|
||||||
exclusive_addresses[processor_id] = masked_address;
|
|
||||||
const T value = op();
|
|
||||||
std::memcpy(exclusive_values[processor_id].data(), &value, sizeof(T));
|
|
||||||
Unlock();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Checks to see if processor processor_id has exclusive access to the
|
|
||||||
/// specified region. If it does, executes the operation then clears
|
|
||||||
/// the exclusive state for processors if their exclusive region(s)
|
|
||||||
/// contain [address, address+size).
|
|
||||||
template <typename T, typename Function>
|
|
||||||
bool DoExclusiveOperation(size_t processor_id, VAddr address, Function op) {
|
|
||||||
static_assert(std::is_trivially_copyable_v<T>);
|
|
||||||
if (!CheckAndClear(processor_id, address)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
T saved_value;
|
|
||||||
std::memcpy(&saved_value, exclusive_values[processor_id].data(), sizeof(T));
|
|
||||||
const bool result = op(saved_value);
|
|
||||||
|
|
||||||
Unlock();
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Unmark everything.
|
|
||||||
void Clear();
|
|
||||||
/// Unmark processor id
|
|
||||||
void ClearProcessor(size_t processor_id);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool CheckAndClear(size_t processor_id, VAddr address);
|
|
||||||
|
|
||||||
void Lock();
|
|
||||||
void Unlock();
|
|
||||||
|
|
||||||
static constexpr VAddr RESERVATION_GRANULE_MASK = 0xFFFF'FFFF'FFFF'FFFFull;
|
|
||||||
static constexpr VAddr INVALID_EXCLUSIVE_ADDRESS = 0xDEAD'DEAD'DEAD'DEADull;
|
|
||||||
std::atomic_flag is_locked;
|
|
||||||
std::vector<VAddr> exclusive_addresses;
|
|
||||||
std::vector<Vector> exclusive_values;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2020 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
|
|
||||||
enum class OptimizationFlag : std::uint32_t {
|
|
||||||
/// This optimization avoids dispatcher lookups by allowing emitted basic blocks to jump
|
|
||||||
/// directly to other basic blocks if the destination PC is predictable at JIT-time.
|
|
||||||
/// This is a safe optimization.
|
|
||||||
BlockLinking = 0x00000001,
|
|
||||||
/// This optimization avoids dispatcher lookups by emulating a return stack buffer. This
|
|
||||||
/// allows for function returns and syscall returns to be predicted at runtime.
|
|
||||||
/// This is a safe optimization.
|
|
||||||
ReturnStackBuffer = 0x00000002,
|
|
||||||
/// This optimization enables a two-tiered dispatch system.
|
|
||||||
/// A fast dispatcher (written in assembly) first does a look-up in a small MRU cache.
|
|
||||||
/// If this fails, it falls back to the usual slower dispatcher.
|
|
||||||
/// This is a safe optimization.
|
|
||||||
FastDispatch = 0x00000004,
|
|
||||||
/// This is an IR optimization. This optimization eliminates unnecessary emulated CPU state
|
|
||||||
/// context lookups.
|
|
||||||
/// This is a safe optimization.
|
|
||||||
GetSetElimination = 0x00000008,
|
|
||||||
/// This is an IR optimization. This optimization does constant propagation.
|
|
||||||
/// This is a safe optimization.
|
|
||||||
ConstProp = 0x00000010,
|
|
||||||
/// This is enables miscellaneous safe IR optimizations.
|
|
||||||
MiscIROpt = 0x00000020,
|
|
||||||
|
|
||||||
/// This is an UNSAFE optimization that reduces accuracy of fused multiply-add operations.
|
|
||||||
/// This unfuses fused instructions to improve performance on host CPUs without FMA support.
|
|
||||||
Unsafe_UnfuseFMA = 0x00010000,
|
|
||||||
/// This is an UNSAFE optimization that reduces accuracy of certain floating-point instructions.
|
|
||||||
/// This allows results of FRECPE and FRSQRTE to have **less** error than spec allows.
|
|
||||||
Unsafe_ReducedErrorFP = 0x00020000,
|
|
||||||
/// This is an UNSAFE optimization that causes floating-point instructions to not produce correct NaNs.
|
|
||||||
/// This may also result in inaccurate results when instructions are given certain special values.
|
|
||||||
Unsafe_InaccurateNaN = 0x00040000,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr OptimizationFlag no_optimizations = static_cast<OptimizationFlag>(0);
|
|
||||||
constexpr OptimizationFlag all_safe_optimizations = static_cast<OptimizationFlag>(0x0000FFFF);
|
|
||||||
|
|
||||||
constexpr OptimizationFlag operator~(OptimizationFlag f) {
|
|
||||||
return static_cast<OptimizationFlag>(~static_cast<std::uint32_t>(f));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr OptimizationFlag operator|(OptimizationFlag f1, OptimizationFlag f2) {
|
|
||||||
return static_cast<OptimizationFlag>(static_cast<std::uint32_t>(f1) | static_cast<std::uint32_t>(f2));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr OptimizationFlag operator&(OptimizationFlag f1, OptimizationFlag f2) {
|
|
||||||
return static_cast<OptimizationFlag>(static_cast<std::uint32_t>(f1) & static_cast<std::uint32_t>(f2));
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr OptimizationFlag operator|=(OptimizationFlag& result, OptimizationFlag f) {
|
|
||||||
return result = (result | f);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr OptimizationFlag operator&=(OptimizationFlag& result, OptimizationFlag f) {
|
|
||||||
return result = (result & f);
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr bool operator!(OptimizationFlag f) {
|
|
||||||
return f == no_optimizations;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic
|
|
383
externals/dynarmic/src/CMakeLists.txt
vendored
|
@ -1,383 +0,0 @@
|
||||||
add_library(dynarmic
|
|
||||||
../include/dynarmic/A32/a32.h
|
|
||||||
../include/dynarmic/A32/arch_version.h
|
|
||||||
../include/dynarmic/A32/config.h
|
|
||||||
../include/dynarmic/A32/coprocessor.h
|
|
||||||
../include/dynarmic/A32/coprocessor_util.h
|
|
||||||
../include/dynarmic/A32/disassembler.h
|
|
||||||
../include/dynarmic/A64/a64.h
|
|
||||||
../include/dynarmic/A64/config.h
|
|
||||||
../include/dynarmic/exclusive_monitor.h
|
|
||||||
../include/dynarmic/optimization_flags.h
|
|
||||||
common/assert.cpp
|
|
||||||
common/assert.h
|
|
||||||
common/bit_util.h
|
|
||||||
common/cast_util.h
|
|
||||||
common/common_types.h
|
|
||||||
common/crypto/aes.cpp
|
|
||||||
common/crypto/aes.h
|
|
||||||
common/crypto/crc32.cpp
|
|
||||||
common/crypto/crc32.h
|
|
||||||
common/crypto/sm4.cpp
|
|
||||||
common/crypto/sm4.h
|
|
||||||
common/fp/fpcr.h
|
|
||||||
common/fp/fpsr.h
|
|
||||||
common/fp/fused.cpp
|
|
||||||
common/fp/fused.h
|
|
||||||
common/fp/info.h
|
|
||||||
common/fp/mantissa_util.h
|
|
||||||
common/fp/op.h
|
|
||||||
common/fp/op/FPCompare.cpp
|
|
||||||
common/fp/op/FPCompare.h
|
|
||||||
common/fp/op/FPConvert.cpp
|
|
||||||
common/fp/op/FPConvert.h
|
|
||||||
common/fp/op/FPMulAdd.cpp
|
|
||||||
common/fp/op/FPMulAdd.h
|
|
||||||
common/fp/op/FPNeg.h
|
|
||||||
common/fp/op/FPRecipEstimate.cpp
|
|
||||||
common/fp/op/FPRecipEstimate.h
|
|
||||||
common/fp/op/FPRecipExponent.cpp
|
|
||||||
common/fp/op/FPRecipExponent.h
|
|
||||||
common/fp/op/FPRecipStepFused.cpp
|
|
||||||
common/fp/op/FPRecipStepFused.h
|
|
||||||
common/fp/op/FPRoundInt.cpp
|
|
||||||
common/fp/op/FPRoundInt.h
|
|
||||||
common/fp/op/FPRSqrtEstimate.cpp
|
|
||||||
common/fp/op/FPRSqrtEstimate.h
|
|
||||||
common/fp/op/FPRSqrtStepFused.cpp
|
|
||||||
common/fp/op/FPRSqrtStepFused.h
|
|
||||||
common/fp/op/FPToFixed.cpp
|
|
||||||
common/fp/op/FPToFixed.h
|
|
||||||
common/fp/process_exception.cpp
|
|
||||||
common/fp/process_exception.h
|
|
||||||
common/fp/process_nan.cpp
|
|
||||||
common/fp/process_nan.h
|
|
||||||
common/fp/rounding_mode.h
|
|
||||||
common/fp/unpacked.cpp
|
|
||||||
common/fp/unpacked.h
|
|
||||||
common/fp/util.h
|
|
||||||
common/intrusive_list.h
|
|
||||||
common/iterator_util.h
|
|
||||||
common/llvm_disassemble.cpp
|
|
||||||
common/llvm_disassemble.h
|
|
||||||
common/lut_from_list.h
|
|
||||||
common/macro_util.h
|
|
||||||
common/math_util.cpp
|
|
||||||
common/math_util.h
|
|
||||||
common/memory_pool.cpp
|
|
||||||
common/memory_pool.h
|
|
||||||
common/safe_ops.h
|
|
||||||
common/scope_exit.h
|
|
||||||
common/string_util.h
|
|
||||||
common/u128.cpp
|
|
||||||
common/u128.h
|
|
||||||
common/variant_util.h
|
|
||||||
frontend/A32/types.cpp
|
|
||||||
frontend/A32/types.h
|
|
||||||
frontend/A64/types.cpp
|
|
||||||
frontend/A64/types.h
|
|
||||||
frontend/decoder/decoder_detail.h
|
|
||||||
frontend/decoder/matcher.h
|
|
||||||
frontend/imm.cpp
|
|
||||||
frontend/imm.h
|
|
||||||
frontend/ir/basic_block.cpp
|
|
||||||
frontend/ir/basic_block.h
|
|
||||||
frontend/ir/cond.h
|
|
||||||
frontend/ir/ir_emitter.cpp
|
|
||||||
frontend/ir/ir_emitter.h
|
|
||||||
frontend/ir/location_descriptor.cpp
|
|
||||||
frontend/ir/location_descriptor.h
|
|
||||||
frontend/ir/microinstruction.cpp
|
|
||||||
frontend/ir/microinstruction.h
|
|
||||||
frontend/ir/opcodes.cpp
|
|
||||||
frontend/ir/opcodes.h
|
|
||||||
frontend/ir/opcodes.inc
|
|
||||||
frontend/ir/terminal.h
|
|
||||||
frontend/ir/type.cpp
|
|
||||||
frontend/ir/type.h
|
|
||||||
frontend/ir/value.cpp
|
|
||||||
frontend/ir/value.h
|
|
||||||
ir_opt/constant_propagation_pass.cpp
|
|
||||||
ir_opt/dead_code_elimination_pass.cpp
|
|
||||||
ir_opt/identity_removal_pass.cpp
|
|
||||||
ir_opt/ir_matcher.h
|
|
||||||
ir_opt/passes.h
|
|
||||||
ir_opt/verification_pass.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
if ("A32" IN_LIST DYNARMIC_FRONTENDS)
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
frontend/A32/decoder/arm.h
|
|
||||||
frontend/A32/decoder/arm.inc
|
|
||||||
frontend/A32/decoder/asimd.h
|
|
||||||
frontend/A32/decoder/asimd.inc
|
|
||||||
frontend/A32/decoder/thumb16.h
|
|
||||||
frontend/A32/decoder/thumb16.inc
|
|
||||||
frontend/A32/decoder/thumb32.h
|
|
||||||
frontend/A32/decoder/thumb32.inc
|
|
||||||
frontend/A32/decoder/vfp.h
|
|
||||||
frontend/A32/decoder/vfp.inc
|
|
||||||
frontend/A32/disassembler/disassembler.h
|
|
||||||
frontend/A32/disassembler/disassembler_arm.cpp
|
|
||||||
frontend/A32/disassembler/disassembler_thumb.cpp
|
|
||||||
frontend/A32/FPSCR.h
|
|
||||||
frontend/A32/ir_emitter.cpp
|
|
||||||
frontend/A32/ir_emitter.h
|
|
||||||
frontend/A32/ITState.h
|
|
||||||
frontend/A32/location_descriptor.cpp
|
|
||||||
frontend/A32/location_descriptor.h
|
|
||||||
frontend/A32/PSR.h
|
|
||||||
frontend/A32/translate/conditional_state.cpp
|
|
||||||
frontend/A32/translate/conditional_state.h
|
|
||||||
frontend/A32/translate/impl/asimd_load_store_structures.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_misc.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_one_reg_modified_immediate.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_three_regs.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_two_regs_misc.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_two_regs_scalar.cpp
|
|
||||||
frontend/A32/translate/impl/asimd_two_regs_shift.cpp
|
|
||||||
frontend/A32/translate/impl/barrier.cpp
|
|
||||||
frontend/A32/translate/impl/branch.cpp
|
|
||||||
frontend/A32/translate/impl/coprocessor.cpp
|
|
||||||
frontend/A32/translate/impl/crc32.cpp
|
|
||||||
frontend/A32/translate/impl/data_processing.cpp
|
|
||||||
frontend/A32/translate/impl/divide.cpp
|
|
||||||
frontend/A32/translate/impl/exception_generating.cpp
|
|
||||||
frontend/A32/translate/impl/extension.cpp
|
|
||||||
frontend/A32/translate/impl/hint.cpp
|
|
||||||
frontend/A32/translate/impl/load_store.cpp
|
|
||||||
frontend/A32/translate/impl/misc.cpp
|
|
||||||
frontend/A32/translate/impl/multiply.cpp
|
|
||||||
frontend/A32/translate/impl/packing.cpp
|
|
||||||
frontend/A32/translate/impl/parallel.cpp
|
|
||||||
frontend/A32/translate/impl/reversal.cpp
|
|
||||||
frontend/A32/translate/impl/saturated.cpp
|
|
||||||
frontend/A32/translate/impl/status_register_access.cpp
|
|
||||||
frontend/A32/translate/impl/synchronization.cpp
|
|
||||||
frontend/A32/translate/impl/thumb16.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_branch.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_control.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_data_processing_modified_immediate.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_data_processing_plain_binary_immediate.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_data_processing_register.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_data_processing_shifted_register.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_load_byte.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_load_halfword.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_load_store_dual.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_load_store_multiple.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_load_word.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_long_multiply.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_misc.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_multiply.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_parallel.cpp
|
|
||||||
frontend/A32/translate/impl/thumb32_store_single_data_item.cpp
|
|
||||||
frontend/A32/translate/impl/translate_arm.h
|
|
||||||
frontend/A32/translate/impl/translate_thumb.h
|
|
||||||
frontend/A32/translate/impl/vfp.cpp
|
|
||||||
frontend/A32/translate/translate.cpp
|
|
||||||
frontend/A32/translate/translate.h
|
|
||||||
frontend/A32/translate/translate_arm.cpp
|
|
||||||
frontend/A32/translate/translate_thumb.cpp
|
|
||||||
ir_opt/a32_constant_memory_reads_pass.cpp
|
|
||||||
ir_opt/a32_get_set_elimination_pass.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("A64" IN_LIST DYNARMIC_FRONTENDS)
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
frontend/A64/decoder/a64.h
|
|
||||||
frontend/A64/decoder/a64.inc
|
|
||||||
frontend/A64/ir_emitter.cpp
|
|
||||||
frontend/A64/ir_emitter.h
|
|
||||||
frontend/A64/location_descriptor.cpp
|
|
||||||
frontend/A64/location_descriptor.h
|
|
||||||
frontend/A64/translate/impl/branch.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_addsub.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_bitfield.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_conditional_compare.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_conditional_select.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_crc32.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_logical.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_multiply.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_pcrel.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_register.cpp
|
|
||||||
frontend/A64/translate/impl/data_processing_shift.cpp
|
|
||||||
frontend/A64/translate/impl/exception_generating.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_compare.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_conditional_compare.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_conditional_select.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_conversion_fixed_point.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_conversion_integer.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_data_processing_one_register.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_data_processing_three_register.cpp
|
|
||||||
frontend/A64/translate/impl/floating_point_data_processing_two_register.cpp
|
|
||||||
frontend/A64/translate/impl/impl.cpp
|
|
||||||
frontend/A64/translate/impl/impl.h
|
|
||||||
frontend/A64/translate/impl/load_store_exclusive.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_load_literal.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_multiple_structures.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_no_allocate_pair.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_register_immediate.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_register_pair.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_register_register_offset.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_register_unprivileged.cpp
|
|
||||||
frontend/A64/translate/impl/load_store_single_structure.cpp
|
|
||||||
frontend/A64/translate/impl/move_wide.cpp
|
|
||||||
frontend/A64/translate/impl/simd_across_lanes.cpp
|
|
||||||
frontend/A64/translate/impl/simd_aes.cpp
|
|
||||||
frontend/A64/translate/impl/simd_copy.cpp
|
|
||||||
frontend/A64/translate/impl/simd_crypto_four_register.cpp
|
|
||||||
frontend/A64/translate/impl/simd_crypto_three_register.cpp
|
|
||||||
frontend/A64/translate/impl/simd_extract.cpp
|
|
||||||
frontend/A64/translate/impl/simd_modified_immediate.cpp
|
|
||||||
frontend/A64/translate/impl/simd_permute.cpp
|
|
||||||
frontend/A64/translate/impl/simd_scalar_pairwise.cpp
|
|
||||||
frontend/A64/translate/impl/simd_scalar_shift_by_immediate.cpp
|
|
||||||
frontend/A64/translate/impl/simd_scalar_three_same.cpp
|
|
||||||
frontend/A64/translate/impl/simd_scalar_two_register_misc.cpp
|
|
||||||
frontend/A64/translate/impl/simd_scalar_x_indexed_element.cpp
|
|
||||||
frontend/A64/translate/impl/simd_sha.cpp
|
|
||||||
frontend/A64/translate/impl/simd_sha512.cpp
|
|
||||||
frontend/A64/translate/impl/simd_shift_by_immediate.cpp
|
|
||||||
frontend/A64/translate/impl/simd_table_lookup.cpp
|
|
||||||
frontend/A64/translate/impl/simd_three_different.cpp
|
|
||||||
frontend/A64/translate/impl/simd_three_same.cpp
|
|
||||||
frontend/A64/translate/impl/simd_three_same_extra.cpp
|
|
||||||
frontend/A64/translate/impl/simd_two_register_misc.cpp
|
|
||||||
frontend/A64/translate/impl/simd_vector_x_indexed_element.cpp
|
|
||||||
frontend/A64/translate/impl/sys_dc.cpp
|
|
||||||
frontend/A64/translate/impl/sys_ic.cpp
|
|
||||||
frontend/A64/translate/impl/system.cpp
|
|
||||||
frontend/A64/translate/impl/system_flag_format.cpp
|
|
||||||
frontend/A64/translate/impl/system_flag_manipulation.cpp
|
|
||||||
frontend/A64/translate/translate.cpp
|
|
||||||
frontend/A64/translate/translate.h
|
|
||||||
ir_opt/a64_callback_config_pass.cpp
|
|
||||||
ir_opt/a64_get_set_elimination_pass.cpp
|
|
||||||
ir_opt/a64_merge_interpret_blocks.cpp
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (ARCHITECTURE STREQUAL "x86_64")
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
backend/x64/abi.cpp
|
|
||||||
backend/x64/abi.h
|
|
||||||
backend/x64/block_of_code.cpp
|
|
||||||
backend/x64/block_of_code.h
|
|
||||||
backend/x64/block_range_information.cpp
|
|
||||||
backend/x64/block_range_information.h
|
|
||||||
backend/x64/callback.cpp
|
|
||||||
backend/x64/callback.h
|
|
||||||
backend/x64/constant_pool.cpp
|
|
||||||
backend/x64/constant_pool.h
|
|
||||||
backend/x64/devirtualize.h
|
|
||||||
backend/x64/emit_x64.cpp
|
|
||||||
backend/x64/emit_x64.h
|
|
||||||
backend/x64/emit_x64_aes.cpp
|
|
||||||
backend/x64/emit_x64_crc32.cpp
|
|
||||||
backend/x64/emit_x64_data_processing.cpp
|
|
||||||
backend/x64/emit_x64_floating_point.cpp
|
|
||||||
backend/x64/emit_x64_packed.cpp
|
|
||||||
backend/x64/emit_x64_saturation.cpp
|
|
||||||
backend/x64/emit_x64_sm4.cpp
|
|
||||||
backend/x64/emit_x64_vector.cpp
|
|
||||||
backend/x64/emit_x64_vector_floating_point.cpp
|
|
||||||
backend/x64/emit_x64_vector_saturation.cpp
|
|
||||||
backend/x64/exception_handler.h
|
|
||||||
backend/x64/exclusive_monitor.cpp
|
|
||||||
backend/x64/hostloc.cpp
|
|
||||||
backend/x64/hostloc.h
|
|
||||||
backend/x64/jitstate_info.h
|
|
||||||
backend/x64/oparg.h
|
|
||||||
backend/x64/perf_map.cpp
|
|
||||||
backend/x64/perf_map.h
|
|
||||||
backend/x64/reg_alloc.cpp
|
|
||||||
backend/x64/reg_alloc.h
|
|
||||||
)
|
|
||||||
|
|
||||||
if ("A32" IN_LIST DYNARMIC_FRONTENDS)
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
backend/x64/a32_emit_x64.cpp
|
|
||||||
backend/x64/a32_emit_x64.h
|
|
||||||
backend/x64/a32_interface.cpp
|
|
||||||
backend/x64/a32_jitstate.cpp
|
|
||||||
backend/x64/a32_jitstate.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if ("A64" IN_LIST DYNARMIC_FRONTENDS)
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
backend/x64/a64_emit_x64.cpp
|
|
||||||
backend/x64/a64_emit_x64.h
|
|
||||||
backend/x64/a64_interface.cpp
|
|
||||||
backend/x64/a64_jitstate.cpp
|
|
||||||
backend/x64/a64_jitstate.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_sources(dynarmic PRIVATE backend/x64/exception_handler_windows.cpp)
|
|
||||||
elseif (APPLE)
|
|
||||||
find_path(MACH_EXC_DEFS_DIR "mach/mach_exc.defs")
|
|
||||||
if (NOT MACH_EXC_DEFS_DIR)
|
|
||||||
message(WARNING "macOS fastmem disabled: unable to find mach/mach_exc.defs")
|
|
||||||
target_sources(dynarmic PRIVATE backend/x64/exception_handler_generic.cpp)
|
|
||||||
else()
|
|
||||||
message(STATUS "mach/mach_exc.defs location: ${MACH_EXC_DEFS_DIR}")
|
|
||||||
execute_process(
|
|
||||||
COMMAND
|
|
||||||
mkdir -p "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig"
|
|
||||||
COMMAND
|
|
||||||
mig
|
|
||||||
-arch x86_64
|
|
||||||
-user "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_user.c"
|
|
||||||
-header "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_user.h"
|
|
||||||
-server "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_server.c"
|
|
||||||
-sheader "${CMAKE_CURRENT_SOURCE_DIR}/backend/x64/mig/mach_exc_server.h"
|
|
||||||
"${MACH_EXC_DEFS_DIR}/mach/mach_exc.defs"
|
|
||||||
)
|
|
||||||
target_sources(dynarmic PRIVATE
|
|
||||||
backend/x64/exception_handler_macos.cpp
|
|
||||||
backend/x64/mig/mach_exc_server.c
|
|
||||||
backend/x64/mig/mach_exc_server.h
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
elseif (UNIX)
|
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
||||||
target_link_libraries(dynarmic PUBLIC rt)
|
|
||||||
endif()
|
|
||||||
target_sources(dynarmic PRIVATE backend/x64/exception_handler_posix.cpp)
|
|
||||||
else()
|
|
||||||
target_sources(dynarmic PRIVATE backend/x64/exception_handler_generic.cpp)
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Unsupported architecture")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include(CreateDirectoryGroups)
|
|
||||||
create_target_directory_groups(dynarmic)
|
|
||||||
|
|
||||||
target_include_directories(dynarmic
|
|
||||||
PUBLIC ../include
|
|
||||||
PRIVATE .)
|
|
||||||
target_compile_options(dynarmic PRIVATE ${DYNARMIC_CXX_FLAGS})
|
|
||||||
target_link_libraries(dynarmic
|
|
||||||
PRIVATE
|
|
||||||
boost
|
|
||||||
fmt::fmt
|
|
||||||
mp
|
|
||||||
tsl::robin_map
|
|
||||||
xbyak
|
|
||||||
$<$<BOOL:DYNARMIC_USE_LLVM>:${llvm_libs}>
|
|
||||||
)
|
|
||||||
if (DYNARMIC_ENABLE_CPU_FEATURE_DETECTION)
|
|
||||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_CPU_FEATURE_DETECTION=1)
|
|
||||||
endif()
|
|
||||||
if (DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT)
|
|
||||||
target_compile_definitions(dynarmic PRIVATE DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT=1)
|
|
||||||
endif()
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
||||||
target_compile_definitions(dynarmic PRIVATE FMT_USE_WINDOWS_H=0)
|
|
||||||
endif()
|
|
||||||
# Disable this as it relies on a non-standard feature
|
|
||||||
target_compile_definitions(dynarmic PRIVATE FMT_USE_USER_DEFINED_LITERALS=0)
|
|
1655
externals/dynarmic/src/backend/x64/a32_emit_x64.cpp
vendored
141
externals/dynarmic/src/backend/x64/a32_emit_x64.h
vendored
|
@ -1,141 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <optional>
|
|
||||||
#include <set>
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include <tsl/robin_map.h>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/a32.h>
|
|
||||||
#include <dynarmic/A32/config.h>
|
|
||||||
|
|
||||||
#include "backend/x64/a32_jitstate.h"
|
|
||||||
#include "backend/x64/block_range_information.h"
|
|
||||||
#include "backend/x64/emit_x64.h"
|
|
||||||
#include "frontend/A32/location_descriptor.h"
|
|
||||||
#include "frontend/ir/terminal.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class RegAlloc;
|
|
||||||
|
|
||||||
struct A32EmitContext final : public EmitContext {
|
|
||||||
A32EmitContext(const A32::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block);
|
|
||||||
|
|
||||||
A32::LocationDescriptor Location() const;
|
|
||||||
A32::LocationDescriptor EndLocation() const;
|
|
||||||
bool IsSingleStep() const;
|
|
||||||
FP::FPCR FPCR(bool fpcr_controlled = true) const override;
|
|
||||||
|
|
||||||
bool HasOptimization(OptimizationFlag flag) const override {
|
|
||||||
return conf.HasOptimization(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
const A32::UserConfig& conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
class A32EmitX64 final : public EmitX64 {
|
|
||||||
public:
|
|
||||||
A32EmitX64(BlockOfCode& code, A32::UserConfig conf, A32::Jit* jit_interface);
|
|
||||||
~A32EmitX64() override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emit host machine code for a basic block with intermediate representation `block`.
|
|
||||||
* @note block is modified.
|
|
||||||
*/
|
|
||||||
BlockDescriptor Emit(IR::Block& block);
|
|
||||||
|
|
||||||
void ClearCache() override;
|
|
||||||
|
|
||||||
void InvalidateCacheRanges(const boost::icl::interval_set<u32>& ranges);
|
|
||||||
|
|
||||||
void ChangeProcessorID(size_t value) {
|
|
||||||
conf.processor_id = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
A32::UserConfig conf;
|
|
||||||
A32::Jit* jit_interface;
|
|
||||||
BlockRangeInformation<u32> block_ranges;
|
|
||||||
|
|
||||||
void EmitCondPrelude(const A32EmitContext& ctx);
|
|
||||||
|
|
||||||
struct FastDispatchEntry {
|
|
||||||
u64 location_descriptor = 0xFFFF'FFFF'FFFF'FFFFull;
|
|
||||||
const void* code_ptr = nullptr;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(FastDispatchEntry) == 0x10);
|
|
||||||
static constexpr u64 fast_dispatch_table_mask = 0xFFFF0;
|
|
||||||
static constexpr size_t fast_dispatch_table_size = 0x10000;
|
|
||||||
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
|
||||||
void ClearFastDispatchTable();
|
|
||||||
|
|
||||||
std::map<std::tuple<size_t, int, int>, void(*)()> read_fallbacks;
|
|
||||||
std::map<std::tuple<size_t, int, int>, void(*)()> write_fallbacks;
|
|
||||||
void GenFastmemFallbacks();
|
|
||||||
|
|
||||||
const void* terminal_handler_pop_rsb_hint;
|
|
||||||
const void* terminal_handler_fast_dispatch_hint = nullptr;
|
|
||||||
FastDispatchEntry& (*fast_dispatch_table_lookup)(u64) = nullptr;
|
|
||||||
void GenTerminalHandlers();
|
|
||||||
|
|
||||||
// Microinstruction emitters
|
|
||||||
#define OPCODE(...)
|
|
||||||
#define A32OPC(name, type, ...) void EmitA32##name(A32EmitContext& ctx, IR::Inst* inst);
|
|
||||||
#define A64OPC(...)
|
|
||||||
#include "frontend/ir/opcodes.inc"
|
|
||||||
#undef OPCODE
|
|
||||||
#undef A32OPC
|
|
||||||
#undef A64OPC
|
|
||||||
|
|
||||||
// Helpers
|
|
||||||
std::string LocationDescriptorToFriendlyName(const IR::LocationDescriptor&) const override;
|
|
||||||
|
|
||||||
// Fastmem information
|
|
||||||
using DoNotFastmemMarker = std::tuple<IR::LocationDescriptor, std::ptrdiff_t>;
|
|
||||||
struct FastmemPatchInfo {
|
|
||||||
u64 resume_rip;
|
|
||||||
u64 callback;
|
|
||||||
DoNotFastmemMarker marker;
|
|
||||||
};
|
|
||||||
tsl::robin_map<u64, FastmemPatchInfo> fastmem_patch_info;
|
|
||||||
std::set<DoNotFastmemMarker> do_not_fastmem;
|
|
||||||
std::optional<DoNotFastmemMarker> ShouldFastmem(A32EmitContext& ctx, IR::Inst* inst) const;
|
|
||||||
FakeCall FastmemCallback(u64 rip);
|
|
||||||
|
|
||||||
// Memory access helpers
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void ReadMemory(A32EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void WriteMemory(A32EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void ExclusiveReadMemory(A32EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void ExclusiveWriteMemory(A32EmitContext& ctx, IR::Inst* inst);
|
|
||||||
|
|
||||||
// Terminal instruction emitters
|
|
||||||
void EmitSetUpperLocationDescriptor(IR::LocationDescriptor new_location, IR::LocationDescriptor old_location);
|
|
||||||
void EmitTerminalImpl(IR::Term::Interpret terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::ReturnToDispatch terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::PopRSBHint terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::FastDispatchHint terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::If terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::CheckBit terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::CheckHalt terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
|
|
||||||
// Patching
|
|
||||||
void Unpatch(const IR::LocationDescriptor& target_desc) override;
|
|
||||||
void EmitPatchJg(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr) override;
|
|
||||||
void EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr) override;
|
|
||||||
void EmitPatchMovRcx(CodePtr target_code_ptr = nullptr) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
350
externals/dynarmic/src/backend/x64/a32_interface.cpp
vendored
|
@ -1,350 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <boost/icl/interval_set.hpp>
|
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
#include <dynarmic/A32/a32.h>
|
|
||||||
#include <dynarmic/A32/context.h>
|
|
||||||
|
|
||||||
#include "backend/x64/a32_emit_x64.h"
|
|
||||||
#include "backend/x64/a32_jitstate.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/callback.h"
|
|
||||||
#include "backend/x64/devirtualize.h"
|
|
||||||
#include "backend/x64/jitstate_info.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/cast_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "common/llvm_disassemble.h"
|
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "frontend/A32/translate/translate.h"
|
|
||||||
#include "frontend/ir/basic_block.h"
|
|
||||||
#include "frontend/ir/location_descriptor.h"
|
|
||||||
#include "ir_opt/passes.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::A32 {
|
|
||||||
|
|
||||||
using namespace Backend::X64;
|
|
||||||
|
|
||||||
static RunCodeCallbacks GenRunCodeCallbacks(A32::UserCallbacks* cb, CodePtr (*LookupBlock)(void* lookup_block_arg), void* arg) {
|
|
||||||
return RunCodeCallbacks{
|
|
||||||
std::make_unique<ArgCallback>(LookupBlock, reinterpret_cast<u64>(arg)),
|
|
||||||
std::make_unique<ArgCallback>(Devirtualize<&A32::UserCallbacks::AddTicks>(cb)),
|
|
||||||
std::make_unique<ArgCallback>(Devirtualize<&A32::UserCallbacks::GetTicksRemaining>(cb)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::function<void(BlockOfCode&)> GenRCP(const A32::UserConfig& conf) {
|
|
||||||
return [conf](BlockOfCode& code) {
|
|
||||||
if (conf.page_table) {
|
|
||||||
code.mov(code.r14, Common::BitCast<u64>(conf.page_table));
|
|
||||||
}
|
|
||||||
if (conf.fastmem_pointer) {
|
|
||||||
code.mov(code.r13, Common::BitCast<u64>(conf.fastmem_pointer));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Jit::Impl {
|
|
||||||
Impl(Jit* jit, A32::UserConfig conf)
|
|
||||||
: block_of_code(GenRunCodeCallbacks(conf.callbacks, &GetCurrentBlockThunk, this), JitStateInfo{jit_state}, conf.code_cache_size, conf.far_code_offset, GenRCP(conf))
|
|
||||||
, emitter(block_of_code, conf, jit)
|
|
||||||
, conf(std::move(conf))
|
|
||||||
, jit_interface(jit)
|
|
||||||
{}
|
|
||||||
|
|
||||||
A32JitState jit_state;
|
|
||||||
BlockOfCode block_of_code;
|
|
||||||
A32EmitX64 emitter;
|
|
||||||
|
|
||||||
A32::UserConfig conf;
|
|
||||||
|
|
||||||
// Requests made during execution to invalidate the cache are queued up here.
|
|
||||||
size_t invalid_cache_generation = 0;
|
|
||||||
boost::icl::interval_set<u32> invalid_cache_ranges;
|
|
||||||
bool invalidate_entire_cache = false;
|
|
||||||
|
|
||||||
void Execute() {
|
|
||||||
const CodePtr current_codeptr = [this]{
|
|
||||||
// RSB optimization
|
|
||||||
const u32 new_rsb_ptr = (jit_state.rsb_ptr - 1) & A32JitState::RSBPtrMask;
|
|
||||||
if (jit_state.GetUniqueHash() == jit_state.rsb_location_descriptors[new_rsb_ptr]) {
|
|
||||||
jit_state.rsb_ptr = new_rsb_ptr;
|
|
||||||
return reinterpret_cast<CodePtr>(jit_state.rsb_codeptrs[new_rsb_ptr]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetCurrentBlock();
|
|
||||||
}();
|
|
||||||
|
|
||||||
block_of_code.RunCode(&jit_state, current_codeptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Step() {
|
|
||||||
block_of_code.StepCode(&jit_state, GetCurrentSingleStep());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExceptionalExit() {
|
|
||||||
ClearExclusiveState();
|
|
||||||
if (!conf.wall_clock_cntpct) {
|
|
||||||
const s64 ticks = jit_state.cycles_to_run - jit_state.cycles_remaining;
|
|
||||||
conf.callbacks->AddTicks(ticks);
|
|
||||||
}
|
|
||||||
PerformCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChangeProcessorID(size_t value) {
|
|
||||||
conf.processor_id = value;
|
|
||||||
emitter.ChangeProcessorID(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearExclusiveState() {
|
|
||||||
jit_state.exclusive_state = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Disassemble(const IR::LocationDescriptor& descriptor) {
|
|
||||||
auto block = GetBasicBlock(descriptor);
|
|
||||||
std::string result = fmt::format("address: {}\nsize: {} bytes\n", block.entrypoint, block.size);
|
|
||||||
result += Common::DisassembleX64(block.entrypoint, reinterpret_cast<const char*>(block.entrypoint) + block.size);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerformCacheInvalidation() {
|
|
||||||
if (invalidate_entire_cache) {
|
|
||||||
jit_state.ResetRSB();
|
|
||||||
block_of_code.ClearCache();
|
|
||||||
emitter.ClearCache();
|
|
||||||
|
|
||||||
invalid_cache_ranges.clear();
|
|
||||||
invalidate_entire_cache = false;
|
|
||||||
invalid_cache_generation++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (invalid_cache_ranges.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
jit_state.ResetRSB();
|
|
||||||
emitter.InvalidateCacheRanges(invalid_cache_ranges);
|
|
||||||
invalid_cache_ranges.clear();
|
|
||||||
invalid_cache_generation++;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RequestCacheInvalidation() {
|
|
||||||
if (jit_interface->is_executing) {
|
|
||||||
jit_state.halt_requested = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PerformCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
Jit* jit_interface;
|
|
||||||
|
|
||||||
static CodePtr GetCurrentBlockThunk(void* this_voidptr) {
|
|
||||||
Jit::Impl& this_ = *static_cast<Jit::Impl*>(this_voidptr);
|
|
||||||
return this_.GetCurrentBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
IR::LocationDescriptor GetCurrentLocation() const {
|
|
||||||
return IR::LocationDescriptor{jit_state.GetUniqueHash()};
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr GetCurrentBlock() {
|
|
||||||
return GetBasicBlock(GetCurrentLocation()).entrypoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr GetCurrentSingleStep() {
|
|
||||||
return GetBasicBlock(A32::LocationDescriptor{GetCurrentLocation()}.SetSingleStepping(true)).entrypoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
A32EmitX64::BlockDescriptor GetBasicBlock(IR::LocationDescriptor descriptor) {
|
|
||||||
auto block = emitter.GetBasicBlock(descriptor);
|
|
||||||
if (block)
|
|
||||||
return *block;
|
|
||||||
|
|
||||||
constexpr size_t MINIMUM_REMAINING_CODESIZE = 1 * 1024 * 1024;
|
|
||||||
if (block_of_code.SpaceRemaining() < MINIMUM_REMAINING_CODESIZE) {
|
|
||||||
invalidate_entire_cache = true;
|
|
||||||
PerformCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
IR::Block ir_block = A32::Translate(A32::LocationDescriptor{descriptor}, [this](u32 vaddr) { return conf.callbacks->MemoryReadCode(vaddr); }, {conf.arch_version, conf.define_unpredictable_behaviour, conf.hook_hint_instructions});
|
|
||||||
if (conf.HasOptimization(OptimizationFlag::GetSetElimination)) {
|
|
||||||
Optimization::A32GetSetElimination(ir_block);
|
|
||||||
Optimization::DeadCodeElimination(ir_block);
|
|
||||||
}
|
|
||||||
if (conf.HasOptimization(OptimizationFlag::ConstProp)) {
|
|
||||||
Optimization::A32ConstantMemoryReads(ir_block, conf.callbacks);
|
|
||||||
Optimization::ConstantPropagation(ir_block);
|
|
||||||
Optimization::DeadCodeElimination(ir_block);
|
|
||||||
}
|
|
||||||
Optimization::VerificationPass(ir_block);
|
|
||||||
return emitter.Emit(ir_block);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Jit::Jit(UserConfig conf) : impl(std::make_unique<Impl>(this, std::move(conf))) {}
|
|
||||||
|
|
||||||
Jit::~Jit() = default;
|
|
||||||
|
|
||||||
void Jit::Run() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
is_executing = true;
|
|
||||||
SCOPE_EXIT { this->is_executing = false; };
|
|
||||||
|
|
||||||
impl->jit_state.halt_requested = false;
|
|
||||||
|
|
||||||
impl->Execute();
|
|
||||||
|
|
||||||
impl->PerformCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::Step() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
is_executing = true;
|
|
||||||
SCOPE_EXIT { this->is_executing = false; };
|
|
||||||
|
|
||||||
impl->jit_state.halt_requested = true;
|
|
||||||
|
|
||||||
impl->Step();
|
|
||||||
|
|
||||||
impl->PerformCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ClearCache() {
|
|
||||||
impl->invalidate_entire_cache = true;
|
|
||||||
impl->RequestCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::InvalidateCacheRange(std::uint32_t start_address, std::size_t length) {
|
|
||||||
impl->invalid_cache_ranges.add(boost::icl::discrete_interval<u32>::closed(start_address, static_cast<u32>(start_address + length - 1)));
|
|
||||||
impl->RequestCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::Reset() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
impl->jit_state = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::HaltExecution() {
|
|
||||||
impl->jit_state.halt_requested = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ExceptionalExit() {
|
|
||||||
impl->ExceptionalExit();
|
|
||||||
is_executing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ClearExclusiveState() {
|
|
||||||
impl->ClearExclusiveState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ChangeProcessorID(size_t new_processor) {
|
|
||||||
impl->ChangeProcessorID(new_processor);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<u32, 16>& Jit::Regs() {
|
|
||||||
return impl->jit_state.Reg;
|
|
||||||
}
|
|
||||||
const std::array<u32, 16>& Jit::Regs() const {
|
|
||||||
return impl->jit_state.Reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<u32, 64>& Jit::ExtRegs() {
|
|
||||||
return impl->jit_state.ExtReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::array<u32, 64>& Jit::ExtRegs() const {
|
|
||||||
return impl->jit_state.ExtReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Jit::Cpsr() const {
|
|
||||||
return impl->jit_state.Cpsr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetCpsr(u32 value) {
|
|
||||||
return impl->jit_state.SetCpsr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Jit::Fpscr() const {
|
|
||||||
return impl->jit_state.Fpscr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetFpscr(u32 value) {
|
|
||||||
return impl->jit_state.SetFpscr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Context Jit::SaveContext() const {
|
|
||||||
Context ctx;
|
|
||||||
SaveContext(ctx);
|
|
||||||
return ctx;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Context::Impl {
|
|
||||||
A32JitState jit_state;
|
|
||||||
size_t invalid_cache_generation;
|
|
||||||
};
|
|
||||||
|
|
||||||
Context::Context() : impl(std::make_unique<Context::Impl>()) { impl->jit_state.ResetRSB(); }
|
|
||||||
Context::~Context() = default;
|
|
||||||
Context::Context(const Context& ctx) : impl(std::make_unique<Context::Impl>(*ctx.impl)) {}
|
|
||||||
Context::Context(Context&& ctx) noexcept : impl(std::move(ctx.impl)) {}
|
|
||||||
Context& Context::operator=(const Context& ctx) {
|
|
||||||
*impl = *ctx.impl;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
Context& Context::operator=(Context&& ctx) noexcept {
|
|
||||||
impl = std::move(ctx.impl);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<std::uint32_t, 16>& Context::Regs() {
|
|
||||||
return impl->jit_state.Reg;
|
|
||||||
}
|
|
||||||
const std::array<std::uint32_t, 16>& Context::Regs() const {
|
|
||||||
return impl->jit_state.Reg;
|
|
||||||
}
|
|
||||||
std::array<std::uint32_t, 64>& Context::ExtRegs() {
|
|
||||||
return impl->jit_state.ExtReg;
|
|
||||||
}
|
|
||||||
const std::array<std::uint32_t, 64>& Context::ExtRegs() const {
|
|
||||||
return impl->jit_state.ExtReg;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::uint32_t Context::Cpsr() const {
|
|
||||||
return impl->jit_state.Cpsr();
|
|
||||||
}
|
|
||||||
void Context::SetCpsr(std::uint32_t value) {
|
|
||||||
impl->jit_state.SetCpsr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::uint32_t Context::Fpscr() const {
|
|
||||||
return impl->jit_state.Fpscr();
|
|
||||||
}
|
|
||||||
void Context::SetFpscr(std::uint32_t value) {
|
|
||||||
return impl->jit_state.SetFpscr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SaveContext(Context& ctx) const {
|
|
||||||
ctx.impl->jit_state.TransferJitState(impl->jit_state, false);
|
|
||||||
ctx.impl->invalid_cache_generation = impl->invalid_cache_generation;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::LoadContext(const Context& ctx) {
|
|
||||||
bool reset_rsb = ctx.impl->invalid_cache_generation != impl->invalid_cache_generation;
|
|
||||||
impl->jit_state.TransferJitState(ctx.impl->jit_state, reset_rsb);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Jit::Disassemble() const {
|
|
||||||
return Common::DisassembleX64(impl->block_of_code.GetCodeBegin(), impl->block_of_code.getCurr());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::A32
|
|
204
externals/dynarmic/src/backend/x64/a32_jitstate.cpp
vendored
|
@ -1,204 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "backend/x64/a32_jitstate.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/nzcv_util.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/bit_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "frontend/A32/location_descriptor.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CPSR Bits
|
|
||||||
* =========
|
|
||||||
*
|
|
||||||
* ARM CPSR flags
|
|
||||||
* --------------
|
|
||||||
* N bit 31 Negative flag
|
|
||||||
* Z bit 30 Zero flag
|
|
||||||
* C bit 29 Carry flag
|
|
||||||
* V bit 28 oVerflow flag
|
|
||||||
* Q bit 27 Saturation flag
|
|
||||||
* IT[1:0] bits 25-26 If-Then execution state (lower 2 bits)
|
|
||||||
* J bit 24 Jazelle instruction set flag
|
|
||||||
* GE bits 16-19 Greater than or Equal flags
|
|
||||||
* IT[7:2] bits 10-15 If-Then execution state (upper 6 bits)
|
|
||||||
* E bit 9 Data Endianness flag
|
|
||||||
* A bit 8 Disable imprecise Aborts
|
|
||||||
* I bit 7 Disable IRQ interrupts
|
|
||||||
* F bit 6 Disable FIQ interrupts
|
|
||||||
* T bit 5 Thumb instruction set flag
|
|
||||||
* M bits 0-4 Processor Mode bits
|
|
||||||
*
|
|
||||||
* x64 LAHF+SETO flags
|
|
||||||
* -------------------
|
|
||||||
* SF bit 15 Sign flag
|
|
||||||
* ZF bit 14 Zero flag
|
|
||||||
* AF bit 12 Auxiliary flag
|
|
||||||
* PF bit 10 Parity flag
|
|
||||||
* CF bit 8 Carry flag
|
|
||||||
* OF bit 0 Overflow flag
|
|
||||||
*/
|
|
||||||
|
|
||||||
u32 A32JitState::Cpsr() const {
|
|
||||||
DEBUG_ASSERT((cpsr_q & ~1) == 0);
|
|
||||||
DEBUG_ASSERT((cpsr_jaifm & ~0x010001DF) == 0);
|
|
||||||
|
|
||||||
u32 cpsr = 0;
|
|
||||||
|
|
||||||
// NZCV flags
|
|
||||||
cpsr |= NZCV::FromX64(cpsr_nzcv);
|
|
||||||
// Q flag
|
|
||||||
cpsr |= cpsr_q ? 1 << 27 : 0;
|
|
||||||
// GE flags
|
|
||||||
cpsr |= Common::Bit<31>(cpsr_ge) ? 1 << 19 : 0;
|
|
||||||
cpsr |= Common::Bit<23>(cpsr_ge) ? 1 << 18 : 0;
|
|
||||||
cpsr |= Common::Bit<15>(cpsr_ge) ? 1 << 17 : 0;
|
|
||||||
cpsr |= Common::Bit<7>(cpsr_ge) ? 1 << 16 : 0;
|
|
||||||
// E flag, T flag
|
|
||||||
cpsr |= Common::Bit<1>(upper_location_descriptor) ? 1 << 9 : 0;
|
|
||||||
cpsr |= Common::Bit<0>(upper_location_descriptor) ? 1 << 5 : 0;
|
|
||||||
// IT state
|
|
||||||
cpsr |= static_cast<u32>(upper_location_descriptor & 0b11111100'00000000);
|
|
||||||
cpsr |= static_cast<u32>(upper_location_descriptor & 0b00000011'00000000) << 17;
|
|
||||||
// Other flags
|
|
||||||
cpsr |= cpsr_jaifm;
|
|
||||||
|
|
||||||
return cpsr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void A32JitState::SetCpsr(u32 cpsr) {
|
|
||||||
// NZCV flags
|
|
||||||
cpsr_nzcv = NZCV::ToX64(cpsr);
|
|
||||||
// Q flag
|
|
||||||
cpsr_q = Common::Bit<27>(cpsr) ? 1 : 0;
|
|
||||||
// GE flags
|
|
||||||
cpsr_ge = 0;
|
|
||||||
cpsr_ge |= Common::Bit<19>(cpsr) ? 0xFF000000 : 0;
|
|
||||||
cpsr_ge |= Common::Bit<18>(cpsr) ? 0x00FF0000 : 0;
|
|
||||||
cpsr_ge |= Common::Bit<17>(cpsr) ? 0x0000FF00 : 0;
|
|
||||||
cpsr_ge |= Common::Bit<16>(cpsr) ? 0x000000FF : 0;
|
|
||||||
|
|
||||||
upper_location_descriptor &= 0xFFFF0000;
|
|
||||||
// E flag, T flag
|
|
||||||
upper_location_descriptor |= Common::Bit<9>(cpsr) ? 2 : 0;
|
|
||||||
upper_location_descriptor |= Common::Bit<5>(cpsr) ? 1 : 0;
|
|
||||||
// IT state
|
|
||||||
upper_location_descriptor |= (cpsr >> 0) & 0b11111100'00000000;
|
|
||||||
upper_location_descriptor |= (cpsr >> 17) & 0b00000011'00000000;
|
|
||||||
|
|
||||||
// Other flags
|
|
||||||
cpsr_jaifm = cpsr & 0x010001DF;
|
|
||||||
}
|
|
||||||
|
|
||||||
void A32JitState::ResetRSB() {
|
|
||||||
rsb_location_descriptors.fill(0xFFFFFFFFFFFFFFFFull);
|
|
||||||
rsb_codeptrs.fill(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comparing MXCSR and FPSCR
|
|
||||||
* =========================
|
|
||||||
*
|
|
||||||
* SSE MXCSR exception flags
|
|
||||||
* -------------------------
|
|
||||||
* PE bit 5 Precision Flag
|
|
||||||
* UE bit 4 Underflow Flag
|
|
||||||
* OE bit 3 Overflow Flag
|
|
||||||
* ZE bit 2 Divide By Zero Flag
|
|
||||||
* DE bit 1 Denormal Flag // Appears to only be set when MXCSR.DAZ = 0
|
|
||||||
* IE bit 0 Invalid Operation Flag
|
|
||||||
*
|
|
||||||
* VFP FPSCR cumulative exception bits
|
|
||||||
* -----------------------------------
|
|
||||||
* IDC bit 7 Input Denormal cumulative exception bit // Only ever set when FPSCR.FTZ = 1
|
|
||||||
* IXC bit 4 Inexact cumulative exception bit
|
|
||||||
* UFC bit 3 Underflow cumulative exception bit
|
|
||||||
* OFC bit 2 Overflow cumulative exception bit
|
|
||||||
* DZC bit 1 Division by Zero cumulative exception bit
|
|
||||||
* IOC bit 0 Invalid Operation cumulative exception bit
|
|
||||||
*
|
|
||||||
* SSE MSCSR exception masks
|
|
||||||
* -------------------------
|
|
||||||
* PM bit 12 Precision Mask
|
|
||||||
* UM bit 11 Underflow Mask
|
|
||||||
* OM bit 10 Overflow Mask
|
|
||||||
* ZM bit 9 Divide By Zero Mask
|
|
||||||
* DM bit 8 Denormal Mask
|
|
||||||
* IM bit 7 Invalid Operation Mask
|
|
||||||
*
|
|
||||||
* VFP FPSCR exception trap enables
|
|
||||||
* --------------------------------
|
|
||||||
* IDE bit 15 Input Denormal exception trap enable
|
|
||||||
* IXE bit 12 Inexact exception trap enable
|
|
||||||
* UFE bit 11 Underflow exception trap enable
|
|
||||||
* OFE bit 10 Overflow exception trap enable
|
|
||||||
* DZE bit 9 Division by Zero exception trap enable
|
|
||||||
* IOE bit 8 Invalid Operation exception trap enable
|
|
||||||
*
|
|
||||||
* SSE MXCSR mode bits
|
|
||||||
* -------------------
|
|
||||||
* FZ bit 15 Flush To Zero
|
|
||||||
* DAZ bit 6 Denormals Are Zero
|
|
||||||
* RN bits 13-14 Round to {0 = Nearest, 1 = Negative, 2 = Positive, 3 = Zero}
|
|
||||||
*
|
|
||||||
* VFP FPSCR mode bits
|
|
||||||
* -------------------
|
|
||||||
* AHP bit 26 Alternate half-precision
|
|
||||||
* DN bit 25 Default NaN
|
|
||||||
* FZ bit 24 Flush to Zero
|
|
||||||
* RMode bits 22-23 Round to {0 = Nearest, 1 = Positive, 2 = Negative, 3 = Zero}
|
|
||||||
* Stride bits 20-21 Vector stride
|
|
||||||
* Len bits 16-18 Vector length
|
|
||||||
*/
|
|
||||||
|
|
||||||
// NZCV; QC (ASIMD only), AHP; DN, FZ, RMode, Stride; SBZP; Len; trap enables; cumulative bits
|
|
||||||
constexpr u32 FPSCR_MODE_MASK = A32::LocationDescriptor::FPSCR_MODE_MASK;
|
|
||||||
constexpr u32 FPSCR_NZCV_MASK = 0xF0000000;
|
|
||||||
|
|
||||||
u32 A32JitState::Fpscr() const {
|
|
||||||
DEBUG_ASSERT((fpsr_nzcv & ~FPSCR_NZCV_MASK) == 0);
|
|
||||||
|
|
||||||
const u32 fpcr_mode = static_cast<u32>(upper_location_descriptor) & FPSCR_MODE_MASK;
|
|
||||||
const u32 mxcsr = guest_MXCSR | asimd_MXCSR;
|
|
||||||
|
|
||||||
u32 FPSCR = fpcr_mode | fpsr_nzcv;
|
|
||||||
FPSCR |= (mxcsr & 0b0000000000001); // IOC = IE
|
|
||||||
FPSCR |= (mxcsr & 0b0000000111100) >> 1; // IXC, UFC, OFC, DZC = PE, UE, OE, ZE
|
|
||||||
FPSCR |= fpsr_exc;
|
|
||||||
|
|
||||||
return FPSCR;
|
|
||||||
}
|
|
||||||
|
|
||||||
void A32JitState::SetFpscr(u32 FPSCR) {
|
|
||||||
// Ensure that only upper half of upper_location_descriptor is used for FPSCR bits.
|
|
||||||
static_assert((FPSCR_MODE_MASK & 0xFFFF0000) == FPSCR_MODE_MASK);
|
|
||||||
|
|
||||||
upper_location_descriptor &= 0x0000FFFF;
|
|
||||||
upper_location_descriptor |= FPSCR & FPSCR_MODE_MASK;
|
|
||||||
|
|
||||||
fpsr_nzcv = FPSCR & FPSCR_NZCV_MASK;
|
|
||||||
|
|
||||||
guest_MXCSR = 0x00001f80;
|
|
||||||
asimd_MXCSR = 0x00009fc0;
|
|
||||||
|
|
||||||
// RMode
|
|
||||||
const std::array<u32, 4> MXCSR_RMode {0x0, 0x4000, 0x2000, 0x6000};
|
|
||||||
guest_MXCSR |= MXCSR_RMode[(FPSCR >> 22) & 0x3];
|
|
||||||
|
|
||||||
// Cumulative flags IDC, IOC, IXC, UFC, OFC, DZC
|
|
||||||
fpsr_exc = FPSCR & 0x9F;
|
|
||||||
|
|
||||||
if (Common::Bit<24>(FPSCR)) {
|
|
||||||
// VFP Flush to Zero
|
|
||||||
guest_MXCSR |= (1 << 15); // SSE Flush to Zero
|
|
||||||
guest_MXCSR |= (1 << 6); // SSE Denormals are Zero
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
110
externals/dynarmic/src/backend/x64/a32_jitstate.h
vendored
|
@ -1,110 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class BlockOfCode;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4324) // Structure was padded due to alignment specifier
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct A32JitState {
|
|
||||||
using ProgramCounterType = u32;
|
|
||||||
|
|
||||||
A32JitState() { ResetRSB(); }
|
|
||||||
|
|
||||||
std::array<u32, 16> Reg{}; // Current register file.
|
|
||||||
// TODO: Mode-specific register sets unimplemented.
|
|
||||||
|
|
||||||
u32 upper_location_descriptor = 0;
|
|
||||||
|
|
||||||
u32 cpsr_ge = 0;
|
|
||||||
u32 cpsr_q = 0;
|
|
||||||
u32 cpsr_nzcv = 0;
|
|
||||||
u32 cpsr_jaifm = 0;
|
|
||||||
u32 Cpsr() const;
|
|
||||||
void SetCpsr(u32 cpsr);
|
|
||||||
|
|
||||||
alignas(16) std::array<u32, 64> ExtReg{}; // Extension registers.
|
|
||||||
|
|
||||||
static constexpr size_t SpillCount = 64;
|
|
||||||
alignas(16) std::array<std::array<u64, 2>, SpillCount> spill{}; // Spill.
|
|
||||||
static Xbyak::Address GetSpillLocationFromIndex(size_t i) {
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
return xword[r15 + offsetof(A32JitState, spill) + i * sizeof(u64) * 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
// For internal use (See: BlockOfCode::RunCode)
|
|
||||||
u32 guest_MXCSR = 0x00001f80;
|
|
||||||
u32 asimd_MXCSR = 0x00009fc0;
|
|
||||||
u32 save_host_MXCSR = 0;
|
|
||||||
s64 cycles_to_run = 0;
|
|
||||||
s64 cycles_remaining = 0;
|
|
||||||
bool halt_requested = false;
|
|
||||||
bool check_bit = false;
|
|
||||||
|
|
||||||
// Exclusive state
|
|
||||||
u32 exclusive_state = 0;
|
|
||||||
|
|
||||||
static constexpr size_t RSBSize = 8; // MUST be a power of 2.
|
|
||||||
static constexpr size_t RSBPtrMask = RSBSize - 1;
|
|
||||||
u32 rsb_ptr = 0;
|
|
||||||
std::array<u64, RSBSize> rsb_location_descriptors;
|
|
||||||
std::array<u64, RSBSize> rsb_codeptrs;
|
|
||||||
void ResetRSB();
|
|
||||||
|
|
||||||
u32 fpsr_exc = 0;
|
|
||||||
u32 fpsr_qc = 0; // Dummy value
|
|
||||||
u32 fpsr_nzcv = 0;
|
|
||||||
u32 Fpscr() const;
|
|
||||||
void SetFpscr(u32 FPSCR);
|
|
||||||
|
|
||||||
u64 GetUniqueHash() const noexcept {
|
|
||||||
return (static_cast<u64>(upper_location_descriptor) << 32) | (static_cast<u64>(Reg[15]));
|
|
||||||
}
|
|
||||||
|
|
||||||
void TransferJitState(const A32JitState& src, bool reset_rsb) {
|
|
||||||
Reg = src.Reg;
|
|
||||||
upper_location_descriptor = src.upper_location_descriptor;
|
|
||||||
cpsr_ge = src.cpsr_ge;
|
|
||||||
cpsr_q = src.cpsr_q;
|
|
||||||
cpsr_nzcv = src.cpsr_nzcv;
|
|
||||||
cpsr_jaifm = src.cpsr_jaifm;
|
|
||||||
ExtReg = src.ExtReg;
|
|
||||||
guest_MXCSR = src.guest_MXCSR;
|
|
||||||
asimd_MXCSR = src.asimd_MXCSR;
|
|
||||||
fpsr_exc = src.fpsr_exc;
|
|
||||||
fpsr_qc = src.fpsr_qc;
|
|
||||||
fpsr_nzcv = src.fpsr_nzcv;
|
|
||||||
|
|
||||||
exclusive_state = 0;
|
|
||||||
|
|
||||||
if (reset_rsb) {
|
|
||||||
ResetRSB();
|
|
||||||
} else {
|
|
||||||
rsb_ptr = src.rsb_ptr;
|
|
||||||
rsb_location_descriptors = src.rsb_location_descriptors;
|
|
||||||
rsb_codeptrs = src.rsb_codeptrs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using CodePtr = const void*;
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
1355
externals/dynarmic/src/backend/x64/a64_emit_x64.cpp
vendored
126
externals/dynarmic/src/backend/x64/a64_emit_x64.h
vendored
|
@ -1,126 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <map>
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include <dynarmic/A64/a64.h>
|
|
||||||
#include <dynarmic/A64/config.h>
|
|
||||||
|
|
||||||
#include "backend/x64/a64_jitstate.h"
|
|
||||||
#include "backend/x64/block_range_information.h"
|
|
||||||
#include "backend/x64/emit_x64.h"
|
|
||||||
#include "frontend/A64/location_descriptor.h"
|
|
||||||
#include "frontend/ir/terminal.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class RegAlloc;
|
|
||||||
|
|
||||||
struct A64EmitContext final : public EmitContext {
|
|
||||||
A64EmitContext(const A64::UserConfig& conf, RegAlloc& reg_alloc, IR::Block& block);
|
|
||||||
|
|
||||||
A64::LocationDescriptor Location() const;
|
|
||||||
bool IsSingleStep() const;
|
|
||||||
FP::FPCR FPCR(bool fpcr_controlled = true) const override;
|
|
||||||
|
|
||||||
bool HasOptimization(OptimizationFlag flag) const override {
|
|
||||||
return conf.HasOptimization(flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
const A64::UserConfig& conf;
|
|
||||||
};
|
|
||||||
|
|
||||||
class A64EmitX64 final : public EmitX64 {
|
|
||||||
public:
|
|
||||||
A64EmitX64(BlockOfCode& code, A64::UserConfig conf, A64::Jit* jit_interface);
|
|
||||||
~A64EmitX64() override;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Emit host machine code for a basic block with intermediate representation `block`.
|
|
||||||
* @note block is modified.
|
|
||||||
*/
|
|
||||||
BlockDescriptor Emit(IR::Block& block);
|
|
||||||
|
|
||||||
void ClearCache() override;
|
|
||||||
|
|
||||||
void InvalidateCacheRanges(const boost::icl::interval_set<u64>& ranges);
|
|
||||||
|
|
||||||
void ChangeProcessorID(size_t value) {
|
|
||||||
conf.processor_id = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
A64::UserConfig conf;
|
|
||||||
A64::Jit* jit_interface;
|
|
||||||
BlockRangeInformation<u64> block_ranges;
|
|
||||||
|
|
||||||
struct FastDispatchEntry {
|
|
||||||
u64 location_descriptor = 0xFFFF'FFFF'FFFF'FFFFull;
|
|
||||||
const void* code_ptr = nullptr;
|
|
||||||
};
|
|
||||||
static_assert(sizeof(FastDispatchEntry) == 0x10);
|
|
||||||
static constexpr u64 fast_dispatch_table_mask = 0xFFFFF0;
|
|
||||||
static constexpr size_t fast_dispatch_table_size = 0x100000;
|
|
||||||
std::array<FastDispatchEntry, fast_dispatch_table_size> fast_dispatch_table;
|
|
||||||
void ClearFastDispatchTable();
|
|
||||||
|
|
||||||
void (*memory_read_128)();
|
|
||||||
void (*memory_write_128)();
|
|
||||||
void GenMemory128Accessors();
|
|
||||||
|
|
||||||
std::map<std::tuple<size_t, int, int>, void(*)()> read_fallbacks;
|
|
||||||
std::map<std::tuple<size_t, int, int>, void(*)()> write_fallbacks;
|
|
||||||
void GenFastmemFallbacks();
|
|
||||||
|
|
||||||
const void* terminal_handler_pop_rsb_hint;
|
|
||||||
const void* terminal_handler_fast_dispatch_hint = nullptr;
|
|
||||||
FastDispatchEntry& (*fast_dispatch_table_lookup)(u64) = nullptr;
|
|
||||||
void GenTerminalHandlers();
|
|
||||||
|
|
||||||
template<std::size_t bitsize>
|
|
||||||
void EmitDirectPageTableMemoryRead(A64EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize>
|
|
||||||
void EmitDirectPageTableMemoryWrite(A64EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void EmitExclusiveReadMemory(A64EmitContext& ctx, IR::Inst* inst);
|
|
||||||
template<std::size_t bitsize, auto callback>
|
|
||||||
void EmitExclusiveWriteMemory(A64EmitContext& ctx, IR::Inst* inst);
|
|
||||||
|
|
||||||
// Microinstruction emitters
|
|
||||||
void EmitPushRSB(EmitContext& ctx, IR::Inst* inst);
|
|
||||||
#define OPCODE(...)
|
|
||||||
#define A32OPC(...)
|
|
||||||
#define A64OPC(name, type, ...) void EmitA64##name(A64EmitContext& ctx, IR::Inst* inst);
|
|
||||||
#include "frontend/ir/opcodes.inc"
|
|
||||||
#undef OPCODE
|
|
||||||
#undef A32OPC
|
|
||||||
#undef A64OPC
|
|
||||||
|
|
||||||
// Helpers
|
|
||||||
std::string LocationDescriptorToFriendlyName(const IR::LocationDescriptor&) const override;
|
|
||||||
|
|
||||||
// Terminal instruction emitters
|
|
||||||
void EmitTerminalImpl(IR::Term::Interpret terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::ReturnToDispatch terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::LinkBlock terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::LinkBlockFast terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::PopRSBHint terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::FastDispatchHint terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::If terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::CheckBit terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
void EmitTerminalImpl(IR::Term::CheckHalt terminal, IR::LocationDescriptor initial_location, bool is_single_step) override;
|
|
||||||
|
|
||||||
// Patching
|
|
||||||
void Unpatch(const IR::LocationDescriptor& target_desc) override;
|
|
||||||
void EmitPatchJg(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr) override;
|
|
||||||
void EmitPatchJmp(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr = nullptr) override;
|
|
||||||
void EmitPatchMovRcx(CodePtr target_code_ptr = nullptr) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
425
externals/dynarmic/src/backend/x64/a64_interface.cpp
vendored
|
@ -1,425 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <boost/icl/interval_set.hpp>
|
|
||||||
#include <dynarmic/A64/a64.h>
|
|
||||||
|
|
||||||
#include "backend/x64/a64_emit_x64.h"
|
|
||||||
#include "backend/x64/a64_jitstate.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/devirtualize.h"
|
|
||||||
#include "backend/x64/jitstate_info.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/llvm_disassemble.h"
|
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "frontend/A64/translate/translate.h"
|
|
||||||
#include "frontend/ir/basic_block.h"
|
|
||||||
#include "ir_opt/passes.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::A64 {
|
|
||||||
|
|
||||||
using namespace Backend::X64;
|
|
||||||
|
|
||||||
static RunCodeCallbacks GenRunCodeCallbacks(A64::UserCallbacks* cb, CodePtr (*LookupBlock)(void* lookup_block_arg), void* arg) {
|
|
||||||
return RunCodeCallbacks{
|
|
||||||
std::make_unique<ArgCallback>(LookupBlock, reinterpret_cast<u64>(arg)),
|
|
||||||
std::make_unique<ArgCallback>(Devirtualize<&A64::UserCallbacks::AddTicks>(cb)),
|
|
||||||
std::make_unique<ArgCallback>(Devirtualize<&A64::UserCallbacks::GetTicksRemaining>(cb)),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::function<void(BlockOfCode&)> GenRCP(const A64::UserConfig& conf) {
|
|
||||||
return [conf](BlockOfCode& code) {
|
|
||||||
if (conf.page_table) {
|
|
||||||
code.mov(code.r14, Common::BitCast<u64>(conf.page_table));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
struct Jit::Impl final {
|
|
||||||
public:
|
|
||||||
Impl(Jit* jit, UserConfig conf)
|
|
||||||
: conf(conf)
|
|
||||||
, block_of_code(GenRunCodeCallbacks(conf.callbacks, &GetCurrentBlockThunk, this), JitStateInfo{jit_state}, conf.code_cache_size, conf.far_code_offset, GenRCP(conf))
|
|
||||||
, emitter(block_of_code, conf, jit)
|
|
||||||
{
|
|
||||||
ASSERT(conf.page_table_address_space_bits >= 12 && conf.page_table_address_space_bits <= 64);
|
|
||||||
}
|
|
||||||
|
|
||||||
~Impl() = default;
|
|
||||||
|
|
||||||
void Run() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
is_executing = true;
|
|
||||||
SCOPE_EXIT { this->is_executing = false; };
|
|
||||||
jit_state.halt_requested = false;
|
|
||||||
|
|
||||||
// TODO: Check code alignment
|
|
||||||
|
|
||||||
const CodePtr current_code_ptr = [this]{
|
|
||||||
// RSB optimization
|
|
||||||
const u32 new_rsb_ptr = (jit_state.rsb_ptr - 1) & A64JitState::RSBPtrMask;
|
|
||||||
if (jit_state.GetUniqueHash() == jit_state.rsb_location_descriptors[new_rsb_ptr]) {
|
|
||||||
jit_state.rsb_ptr = new_rsb_ptr;
|
|
||||||
return reinterpret_cast<CodePtr>(jit_state.rsb_codeptrs[new_rsb_ptr]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetCurrentBlock();
|
|
||||||
}();
|
|
||||||
block_of_code.RunCode(&jit_state, current_code_ptr);
|
|
||||||
|
|
||||||
PerformRequestedCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Step() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
is_executing = true;
|
|
||||||
SCOPE_EXIT { this->is_executing = false; };
|
|
||||||
jit_state.halt_requested = true;
|
|
||||||
|
|
||||||
block_of_code.StepCode(&jit_state, GetCurrentSingleStep());
|
|
||||||
|
|
||||||
PerformRequestedCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExceptionalExit() {
|
|
||||||
ClearExclusiveState();
|
|
||||||
if (!conf.wall_clock_cntpct) {
|
|
||||||
const s64 ticks = jit_state.cycles_to_run - jit_state.cycles_remaining;
|
|
||||||
conf.callbacks->AddTicks(ticks);
|
|
||||||
}
|
|
||||||
PerformRequestedCacheInvalidation();
|
|
||||||
is_executing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ChangeProcessorID(size_t value) {
|
|
||||||
conf.processor_id = value;
|
|
||||||
emitter.ChangeProcessorID(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearCache() {
|
|
||||||
invalidate_entire_cache = true;
|
|
||||||
RequestCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void InvalidateCacheRange(u64 start_address, size_t length) {
|
|
||||||
const auto end_address = static_cast<u64>(start_address + length - 1);
|
|
||||||
const auto range = boost::icl::discrete_interval<u64>::closed(start_address, end_address);
|
|
||||||
invalid_cache_ranges.add(range);
|
|
||||||
RequestCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Reset() {
|
|
||||||
ASSERT(!is_executing);
|
|
||||||
jit_state = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
void HaltExecution() {
|
|
||||||
jit_state.halt_requested = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 GetSP() const {
|
|
||||||
return jit_state.sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetSP(u64 value) {
|
|
||||||
jit_state.sp = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 GetPC() const {
|
|
||||||
return jit_state.pc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPC(u64 value) {
|
|
||||||
jit_state.pc = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 GetRegister(size_t index) const {
|
|
||||||
if (index == 31)
|
|
||||||
return GetSP();
|
|
||||||
return jit_state.reg.at(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetRegister(size_t index, u64 value) {
|
|
||||||
if (index == 31)
|
|
||||||
return SetSP(value);
|
|
||||||
jit_state.reg.at(index) = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<u64, 31> GetRegisters() const {
|
|
||||||
return jit_state.reg;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetRegisters(const std::array<u64, 31>& value) {
|
|
||||||
jit_state.reg = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector GetVector(size_t index) const {
|
|
||||||
return {jit_state.vec.at(index * 2), jit_state.vec.at(index * 2 + 1)};
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetVector(size_t index, Vector value) {
|
|
||||||
jit_state.vec.at(index * 2) = value[0];
|
|
||||||
jit_state.vec.at(index * 2 + 1) = value[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<Vector, 32> GetVectors() const {
|
|
||||||
std::array<Vector, 32> ret;
|
|
||||||
static_assert(sizeof(ret) == sizeof(jit_state.vec));
|
|
||||||
std::memcpy(ret.data(), jit_state.vec.data(), sizeof(jit_state.vec));
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetVectors(const std::array<Vector, 32>& value) {
|
|
||||||
static_assert(sizeof(value) == sizeof(jit_state.vec));
|
|
||||||
std::memcpy(jit_state.vec.data(), value.data(), sizeof(jit_state.vec));
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetFpcr() const {
|
|
||||||
return jit_state.GetFpcr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFpcr(u32 value) {
|
|
||||||
jit_state.SetFpcr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetFpsr() const {
|
|
||||||
return jit_state.GetFpsr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetFpsr(u32 value) {
|
|
||||||
jit_state.SetFpsr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 GetPstate() const {
|
|
||||||
return jit_state.GetPstate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPstate(u32 value) {
|
|
||||||
jit_state.SetPstate(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClearExclusiveState() {
|
|
||||||
jit_state.exclusive_state = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsExecuting() const {
|
|
||||||
return is_executing;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Disassemble() const {
|
|
||||||
return Common::DisassembleX64(block_of_code.GetCodeBegin(), block_of_code.getCurr());
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
static CodePtr GetCurrentBlockThunk(void* thisptr) {
|
|
||||||
Jit::Impl* this_ = static_cast<Jit::Impl*>(thisptr);
|
|
||||||
return this_->GetCurrentBlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
IR::LocationDescriptor GetCurrentLocation() const {
|
|
||||||
return IR::LocationDescriptor{jit_state.GetUniqueHash()};
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr GetCurrentBlock() {
|
|
||||||
return GetBlock(GetCurrentLocation());
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr GetCurrentSingleStep() {
|
|
||||||
return GetBlock(A64::LocationDescriptor{GetCurrentLocation()}.SetSingleStepping(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr GetBlock(IR::LocationDescriptor current_location) {
|
|
||||||
if (auto block = emitter.GetBasicBlock(current_location))
|
|
||||||
return block->entrypoint;
|
|
||||||
|
|
||||||
constexpr size_t MINIMUM_REMAINING_CODESIZE = 1 * 1024 * 1024;
|
|
||||||
if (block_of_code.SpaceRemaining() < MINIMUM_REMAINING_CODESIZE) {
|
|
||||||
// Immediately evacuate cache
|
|
||||||
invalidate_entire_cache = true;
|
|
||||||
PerformRequestedCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
// JIT Compile
|
|
||||||
const auto get_code = [this](u64 vaddr) { return conf.callbacks->MemoryReadCode(vaddr); };
|
|
||||||
IR::Block ir_block = A64::Translate(A64::LocationDescriptor{current_location}, get_code,
|
|
||||||
{conf.define_unpredictable_behaviour, conf.wall_clock_cntpct});
|
|
||||||
Optimization::A64CallbackConfigPass(ir_block, conf);
|
|
||||||
if (conf.HasOptimization(OptimizationFlag::GetSetElimination)) {
|
|
||||||
Optimization::A64GetSetElimination(ir_block);
|
|
||||||
Optimization::DeadCodeElimination(ir_block);
|
|
||||||
}
|
|
||||||
if (conf.HasOptimization(OptimizationFlag::ConstProp)) {
|
|
||||||
Optimization::ConstantPropagation(ir_block);
|
|
||||||
Optimization::DeadCodeElimination(ir_block);
|
|
||||||
}
|
|
||||||
if (conf.HasOptimization(OptimizationFlag::MiscIROpt)) {
|
|
||||||
Optimization::A64MergeInterpretBlocksPass(ir_block, conf.callbacks);
|
|
||||||
}
|
|
||||||
Optimization::VerificationPass(ir_block);
|
|
||||||
return emitter.Emit(ir_block).entrypoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RequestCacheInvalidation() {
|
|
||||||
if (is_executing) {
|
|
||||||
jit_state.halt_requested = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PerformRequestedCacheInvalidation();
|
|
||||||
}
|
|
||||||
|
|
||||||
void PerformRequestedCacheInvalidation() {
|
|
||||||
if (!invalidate_entire_cache && invalid_cache_ranges.empty()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
jit_state.ResetRSB();
|
|
||||||
if (invalidate_entire_cache) {
|
|
||||||
block_of_code.ClearCache();
|
|
||||||
emitter.ClearCache();
|
|
||||||
} else {
|
|
||||||
emitter.InvalidateCacheRanges(invalid_cache_ranges);
|
|
||||||
}
|
|
||||||
invalid_cache_ranges.clear();
|
|
||||||
invalidate_entire_cache = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_executing = false;
|
|
||||||
|
|
||||||
UserConfig conf;
|
|
||||||
A64JitState jit_state;
|
|
||||||
BlockOfCode block_of_code;
|
|
||||||
A64EmitX64 emitter;
|
|
||||||
|
|
||||||
bool invalidate_entire_cache = false;
|
|
||||||
boost::icl::interval_set<u64> invalid_cache_ranges;
|
|
||||||
};
|
|
||||||
|
|
||||||
Jit::Jit(UserConfig conf)
|
|
||||||
: impl(std::make_unique<Jit::Impl>(this, conf)) {}
|
|
||||||
|
|
||||||
Jit::~Jit() = default;
|
|
||||||
|
|
||||||
void Jit::Run() {
|
|
||||||
impl->Run();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::Step() {
|
|
||||||
impl->Step();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ClearCache() {
|
|
||||||
impl->ClearCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::InvalidateCacheRange(u64 start_address, size_t length) {
|
|
||||||
impl->InvalidateCacheRange(start_address, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::Reset() {
|
|
||||||
impl->Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::HaltExecution() {
|
|
||||||
impl->HaltExecution();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ExceptionalExit() {
|
|
||||||
impl->ExceptionalExit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ChangeProcessorID(size_t new_processor) {
|
|
||||||
impl->ChangeProcessorID(new_processor);
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 Jit::GetSP() const {
|
|
||||||
return impl->GetSP();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetSP(u64 value) {
|
|
||||||
impl->SetSP(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 Jit::GetPC() const {
|
|
||||||
return impl->GetPC();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetPC(u64 value) {
|
|
||||||
impl->SetPC(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u64 Jit::GetRegister(size_t index) const {
|
|
||||||
return impl->GetRegister(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetRegister(size_t index, u64 value) {
|
|
||||||
impl->SetRegister(index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<u64, 31> Jit::GetRegisters() const {
|
|
||||||
return impl->GetRegisters();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetRegisters(const std::array<u64, 31>& value) {
|
|
||||||
impl->SetRegisters(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector Jit::GetVector(size_t index) const {
|
|
||||||
return impl->GetVector(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetVector(size_t index, Vector value) {
|
|
||||||
impl->SetVector(index, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::array<Vector, 32> Jit::GetVectors() const {
|
|
||||||
return impl->GetVectors();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetVectors(const std::array<Vector, 32>& value) {
|
|
||||||
impl->SetVectors(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Jit::GetFpcr() const {
|
|
||||||
return impl->GetFpcr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetFpcr(u32 value) {
|
|
||||||
impl->SetFpcr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Jit::GetFpsr() const {
|
|
||||||
return impl->GetFpsr();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetFpsr(u32 value) {
|
|
||||||
impl->SetFpsr(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 Jit::GetPstate() const {
|
|
||||||
return impl->GetPstate();
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::SetPstate(u32 value) {
|
|
||||||
impl->SetPstate(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Jit::ClearExclusiveState() {
|
|
||||||
impl->ClearExclusiveState();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Jit::IsExecuting() const {
|
|
||||||
return impl->IsExecuting();
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string Jit::Disassemble() const {
|
|
||||||
return impl->Disassemble();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::A64
|
|
114
externals/dynarmic/src/backend/x64/a64_jitstate.cpp
vendored
|
@ -1,114 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "backend/x64/a64_jitstate.h"
|
|
||||||
#include "common/bit_util.h"
|
|
||||||
#include "frontend/A64/location_descriptor.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comparing MXCSR and FPCR
|
|
||||||
* ========================
|
|
||||||
*
|
|
||||||
* SSE MSCSR exception masks
|
|
||||||
* -------------------------
|
|
||||||
* PM bit 12 Precision Mask
|
|
||||||
* UM bit 11 Underflow Mask
|
|
||||||
* OM bit 10 Overflow Mask
|
|
||||||
* ZM bit 9 Divide By Zero Mask
|
|
||||||
* DM bit 8 Denormal Mask
|
|
||||||
* IM bit 7 Invalid Operation Mask
|
|
||||||
*
|
|
||||||
* A64 FPCR exception trap enables
|
|
||||||
* -------------------------------
|
|
||||||
* IDE bit 15 Input Denormal exception trap enable
|
|
||||||
* IXE bit 12 Inexact exception trap enable
|
|
||||||
* UFE bit 11 Underflow exception trap enable
|
|
||||||
* OFE bit 10 Overflow exception trap enable
|
|
||||||
* DZE bit 9 Division by Zero exception trap enable
|
|
||||||
* IOE bit 8 Invalid Operation exception trap enable
|
|
||||||
*
|
|
||||||
* SSE MXCSR mode bits
|
|
||||||
* -------------------
|
|
||||||
* FZ bit 15 Flush To Zero
|
|
||||||
* DAZ bit 6 Denormals Are Zero
|
|
||||||
* RN bits 13-14 Round to {0 = Nearest, 1 = Negative, 2 = Positive, 3 = Zero}
|
|
||||||
*
|
|
||||||
* A64 FPCR mode bits
|
|
||||||
* ------------------
|
|
||||||
* AHP bit 26 Alternative half-precision
|
|
||||||
* DN bit 25 Default NaN
|
|
||||||
* FZ bit 24 Flush to Zero
|
|
||||||
* RMode bits 22-23 Round to {0 = Nearest, 1 = Positive, 2 = Negative, 3 = Zero}
|
|
||||||
* FZ16 bit 19 Flush to Zero for half-precision
|
|
||||||
*/
|
|
||||||
|
|
||||||
constexpr u32 FPCR_MASK = 0x07C89F00;
|
|
||||||
|
|
||||||
u32 A64JitState::GetFpcr() const {
|
|
||||||
return fpcr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void A64JitState::SetFpcr(u32 value) {
|
|
||||||
fpcr = value & FPCR_MASK;
|
|
||||||
|
|
||||||
asimd_MXCSR &= 0x0000003D;
|
|
||||||
guest_MXCSR &= 0x0000003D;
|
|
||||||
asimd_MXCSR |= 0x00001f80;
|
|
||||||
guest_MXCSR |= 0x00001f80; // Mask all exceptions
|
|
||||||
|
|
||||||
// RMode
|
|
||||||
const std::array<u32, 4> MXCSR_RMode {0x0, 0x4000, 0x2000, 0x6000};
|
|
||||||
guest_MXCSR |= MXCSR_RMode[(value >> 22) & 0x3];
|
|
||||||
|
|
||||||
if (Common::Bit<24>(value)) {
|
|
||||||
guest_MXCSR |= (1 << 15); // SSE Flush to Zero
|
|
||||||
guest_MXCSR |= (1 << 6); // SSE Denormals are Zero
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Comparing MXCSR and FPSR
|
|
||||||
* ========================
|
|
||||||
*
|
|
||||||
* SSE MXCSR exception flags
|
|
||||||
* -------------------------
|
|
||||||
* PE bit 5 Precision Flag
|
|
||||||
* UE bit 4 Underflow Flag
|
|
||||||
* OE bit 3 Overflow Flag
|
|
||||||
* ZE bit 2 Divide By Zero Flag
|
|
||||||
* DE bit 1 Denormal Flag // Appears to only be set when MXCSR.DAZ = 0
|
|
||||||
* IE bit 0 Invalid Operation Flag
|
|
||||||
*
|
|
||||||
* A64 FPSR cumulative exception bits
|
|
||||||
* ----------------------------------
|
|
||||||
* QC bit 27 Cumulative saturation bit
|
|
||||||
* IDC bit 7 Input Denormal cumulative exception bit // Only ever set when FPCR.FTZ = 1
|
|
||||||
* IXC bit 4 Inexact cumulative exception bit
|
|
||||||
* UFC bit 3 Underflow cumulative exception bit
|
|
||||||
* OFC bit 2 Overflow cumulative exception bit
|
|
||||||
* DZC bit 1 Division by Zero cumulative exception bit
|
|
||||||
* IOC bit 0 Invalid Operation cumulative exception bit
|
|
||||||
*/
|
|
||||||
|
|
||||||
u32 A64JitState::GetFpsr() const {
|
|
||||||
const u32 mxcsr = guest_MXCSR | asimd_MXCSR;
|
|
||||||
u32 fpsr = 0;
|
|
||||||
fpsr |= (mxcsr & 0b0000000000001); // IOC = IE
|
|
||||||
fpsr |= (mxcsr & 0b0000000111100) >> 1; // IXC, UFC, OFC, DZC = PE, UE, OE, ZE
|
|
||||||
fpsr |= fpsr_exc;
|
|
||||||
fpsr |= (fpsr_qc == 0 ? 0 : 1) << 27;
|
|
||||||
return fpsr;
|
|
||||||
}
|
|
||||||
|
|
||||||
void A64JitState::SetFpsr(u32 value) {
|
|
||||||
guest_MXCSR &= ~0x0000003D;
|
|
||||||
asimd_MXCSR &= ~0x0000003D;
|
|
||||||
fpsr_qc = (value >> 27) & 1;
|
|
||||||
fpsr_exc = value & 0x9F;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,96 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "backend/x64/nzcv_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "frontend/A64/location_descriptor.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class BlockOfCode;
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable:4324) // Structure was padded due to alignment specifier
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct A64JitState {
|
|
||||||
using ProgramCounterType = u64;
|
|
||||||
|
|
||||||
A64JitState() { ResetRSB(); }
|
|
||||||
|
|
||||||
std::array<u64, 31> reg{};
|
|
||||||
u64 sp = 0;
|
|
||||||
u64 pc = 0;
|
|
||||||
|
|
||||||
u32 cpsr_nzcv = 0;
|
|
||||||
|
|
||||||
u32 GetPstate() const {
|
|
||||||
return NZCV::FromX64(cpsr_nzcv);
|
|
||||||
}
|
|
||||||
void SetPstate(u32 new_pstate) {
|
|
||||||
cpsr_nzcv = NZCV::ToX64(new_pstate);
|
|
||||||
}
|
|
||||||
|
|
||||||
alignas(16) std::array<u64, 64> vec{}; // Extension registers.
|
|
||||||
|
|
||||||
static constexpr size_t SpillCount = 64;
|
|
||||||
alignas(16) std::array<std::array<u64, 2>, SpillCount> spill{}; // Spill.
|
|
||||||
static Xbyak::Address GetSpillLocationFromIndex(size_t i) {
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
return xword[r15 + offsetof(A64JitState, spill) + i * sizeof(u64) * 2];
|
|
||||||
}
|
|
||||||
|
|
||||||
// For internal use (See: BlockOfCode::RunCode)
|
|
||||||
u32 guest_MXCSR = 0x00001f80;
|
|
||||||
u32 asimd_MXCSR = 0x00009fc0;
|
|
||||||
u32 save_host_MXCSR = 0;
|
|
||||||
s64 cycles_to_run = 0;
|
|
||||||
s64 cycles_remaining = 0;
|
|
||||||
bool halt_requested = false;
|
|
||||||
bool check_bit = false;
|
|
||||||
|
|
||||||
// Exclusive state
|
|
||||||
static constexpr u64 RESERVATION_GRANULE_MASK = 0xFFFF'FFFF'FFFF'FFF0ull;
|
|
||||||
u8 exclusive_state = 0;
|
|
||||||
|
|
||||||
static constexpr size_t RSBSize = 8; // MUST be a power of 2.
|
|
||||||
static constexpr size_t RSBPtrMask = RSBSize - 1;
|
|
||||||
u32 rsb_ptr = 0;
|
|
||||||
std::array<u64, RSBSize> rsb_location_descriptors;
|
|
||||||
std::array<u64, RSBSize> rsb_codeptrs;
|
|
||||||
void ResetRSB() {
|
|
||||||
rsb_location_descriptors.fill(0xFFFFFFFFFFFFFFFFull);
|
|
||||||
rsb_codeptrs.fill(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 fpsr_exc = 0;
|
|
||||||
u32 fpsr_qc = 0;
|
|
||||||
u32 fpcr = 0;
|
|
||||||
u32 GetFpcr() const;
|
|
||||||
u32 GetFpsr() const;
|
|
||||||
void SetFpcr(u32 value);
|
|
||||||
void SetFpsr(u32 value);
|
|
||||||
|
|
||||||
u64 GetUniqueHash() const noexcept {
|
|
||||||
const u64 fpcr_u64 = static_cast<u64>(fpcr & A64::LocationDescriptor::fpcr_mask) << A64::LocationDescriptor::fpcr_shift;
|
|
||||||
const u64 pc_u64 = pc & A64::LocationDescriptor::pc_mask;
|
|
||||||
return pc_u64 | fpcr_u64;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using CodePtr = const void*;
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
134
externals/dynarmic/src/backend/x64/abi.cpp
vendored
|
@ -1,134 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2020 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "backend/x64/abi.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "common/iterator_util.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
constexpr size_t XMM_SIZE = 16;
|
|
||||||
|
|
||||||
struct FrameInfo {
|
|
||||||
size_t stack_subtraction;
|
|
||||||
size_t xmm_offset;
|
|
||||||
size_t frame_offset;
|
|
||||||
};
|
|
||||||
|
|
||||||
static FrameInfo CalculateFrameInfo(size_t num_gprs, size_t num_xmms, size_t frame_size) {
|
|
||||||
// We are initially 8 byte aligned because the return value is pushed onto an aligned stack after a call.
|
|
||||||
const size_t rsp_alignment = (num_gprs % 2 == 0) ? 8 : 0;
|
|
||||||
const size_t total_xmm_size = num_xmms * XMM_SIZE;
|
|
||||||
|
|
||||||
if (frame_size & 0xF) {
|
|
||||||
frame_size += 0x10 - (frame_size & 0xF);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
rsp_alignment + total_xmm_size + frame_size + ABI_SHADOW_SPACE,
|
|
||||||
frame_size + ABI_SHADOW_SPACE,
|
|
||||||
ABI_SHADOW_SPACE,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename RegisterArrayT>
|
|
||||||
void ABI_PushRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size, const RegisterArrayT& regs) {
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
|
|
||||||
const size_t num_gprs = std::count_if(regs.begin(), regs.end(), HostLocIsGPR);
|
|
||||||
const size_t num_xmms = std::count_if(regs.begin(), regs.end(), HostLocIsXMM);
|
|
||||||
|
|
||||||
FrameInfo frame_info = CalculateFrameInfo(num_gprs, num_xmms, frame_size);
|
|
||||||
|
|
||||||
for (HostLoc gpr : regs) {
|
|
||||||
if (HostLocIsGPR(gpr)) {
|
|
||||||
code.push(HostLocToReg64(gpr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame_info.stack_subtraction != 0) {
|
|
||||||
code.sub(rsp, u32(frame_info.stack_subtraction));
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t xmm_offset = frame_info.xmm_offset;
|
|
||||||
for (HostLoc xmm : regs) {
|
|
||||||
if (HostLocIsXMM(xmm)) {
|
|
||||||
if (code.HasAVX()) {
|
|
||||||
code.vmovaps(code.xword[rsp + xmm_offset], HostLocToXmm(xmm));
|
|
||||||
} else {
|
|
||||||
code.movaps(code.xword[rsp + xmm_offset], HostLocToXmm(xmm));
|
|
||||||
}
|
|
||||||
xmm_offset += XMM_SIZE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename RegisterArrayT>
|
|
||||||
void ABI_PopRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size, const RegisterArrayT& regs) {
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
|
|
||||||
const size_t num_gprs = std::count_if(regs.begin(), regs.end(), HostLocIsGPR);
|
|
||||||
const size_t num_xmms = std::count_if(regs.begin(), regs.end(), HostLocIsXMM);
|
|
||||||
|
|
||||||
FrameInfo frame_info = CalculateFrameInfo(num_gprs, num_xmms, frame_size);
|
|
||||||
|
|
||||||
size_t xmm_offset = frame_info.xmm_offset;
|
|
||||||
for (HostLoc xmm : regs) {
|
|
||||||
if (HostLocIsXMM(xmm)) {
|
|
||||||
if (code.HasAVX()) {
|
|
||||||
code.vmovaps(HostLocToXmm(xmm), code.xword[rsp + xmm_offset]);
|
|
||||||
} else {
|
|
||||||
code.movaps(HostLocToXmm(xmm), code.xword[rsp + xmm_offset]);
|
|
||||||
}
|
|
||||||
xmm_offset += XMM_SIZE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (frame_info.stack_subtraction != 0) {
|
|
||||||
code.add(rsp, u32(frame_info.stack_subtraction));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (HostLoc gpr : Common::Reverse(regs)) {
|
|
||||||
if (HostLocIsGPR(gpr)) {
|
|
||||||
code.pop(HostLocToReg64(gpr));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PushCalleeSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size) {
|
|
||||||
ABI_PushRegistersAndAdjustStack(code, frame_size, ABI_ALL_CALLEE_SAVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PopCalleeSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size) {
|
|
||||||
ABI_PopRegistersAndAdjustStack(code, frame_size, ABI_ALL_CALLEE_SAVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PushCallerSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size) {
|
|
||||||
ABI_PushRegistersAndAdjustStack(code, frame_size, ABI_ALL_CALLER_SAVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PopCallerSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size) {
|
|
||||||
ABI_PopRegistersAndAdjustStack(code, frame_size, ABI_ALL_CALLER_SAVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PushCallerSaveRegistersAndAdjustStackExcept(BlockOfCode& code, HostLoc exception) {
|
|
||||||
std::vector<HostLoc> regs;
|
|
||||||
std::remove_copy(ABI_ALL_CALLER_SAVE.begin(), ABI_ALL_CALLER_SAVE.end(), std::back_inserter(regs), exception);
|
|
||||||
ABI_PushRegistersAndAdjustStack(code, 0, regs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ABI_PopCallerSaveRegistersAndAdjustStackExcept(BlockOfCode& code, HostLoc exception) {
|
|
||||||
std::vector<HostLoc> regs;
|
|
||||||
std::remove_copy(ABI_ALL_CALLER_SAVE.begin(), ABI_ALL_CALLER_SAVE.end(), std::back_inserter(regs), exception);
|
|
||||||
ABI_PopRegistersAndAdjustStack(code, 0, regs);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
123
externals/dynarmic/src/backend/x64/abi.h
vendored
|
@ -1,123 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
|
|
||||||
#include "backend/x64/hostloc.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class BlockOfCode;
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
|
|
||||||
constexpr HostLoc ABI_RETURN = HostLoc::RAX;
|
|
||||||
|
|
||||||
constexpr HostLoc ABI_PARAM1 = HostLoc::RCX;
|
|
||||||
constexpr HostLoc ABI_PARAM2 = HostLoc::RDX;
|
|
||||||
constexpr HostLoc ABI_PARAM3 = HostLoc::R8;
|
|
||||||
constexpr HostLoc ABI_PARAM4 = HostLoc::R9;
|
|
||||||
|
|
||||||
constexpr std::array<HostLoc, 13> ABI_ALL_CALLER_SAVE = {
|
|
||||||
HostLoc::RAX,
|
|
||||||
HostLoc::RCX,
|
|
||||||
HostLoc::RDX,
|
|
||||||
HostLoc::R8,
|
|
||||||
HostLoc::R9,
|
|
||||||
HostLoc::R10,
|
|
||||||
HostLoc::R11,
|
|
||||||
HostLoc::XMM0,
|
|
||||||
HostLoc::XMM1,
|
|
||||||
HostLoc::XMM2,
|
|
||||||
HostLoc::XMM3,
|
|
||||||
HostLoc::XMM4,
|
|
||||||
HostLoc::XMM5,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr std::array<HostLoc, 18> ABI_ALL_CALLEE_SAVE = {
|
|
||||||
HostLoc::RBX,
|
|
||||||
HostLoc::RSI,
|
|
||||||
HostLoc::RDI,
|
|
||||||
HostLoc::RBP,
|
|
||||||
HostLoc::R12,
|
|
||||||
HostLoc::R13,
|
|
||||||
HostLoc::R14,
|
|
||||||
HostLoc::R15,
|
|
||||||
HostLoc::XMM6,
|
|
||||||
HostLoc::XMM7,
|
|
||||||
HostLoc::XMM8,
|
|
||||||
HostLoc::XMM9,
|
|
||||||
HostLoc::XMM10,
|
|
||||||
HostLoc::XMM11,
|
|
||||||
HostLoc::XMM12,
|
|
||||||
HostLoc::XMM13,
|
|
||||||
HostLoc::XMM14,
|
|
||||||
HostLoc::XMM15,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr size_t ABI_SHADOW_SPACE = 32; // bytes
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
constexpr HostLoc ABI_RETURN = HostLoc::RAX;
|
|
||||||
|
|
||||||
constexpr HostLoc ABI_PARAM1 = HostLoc::RDI;
|
|
||||||
constexpr HostLoc ABI_PARAM2 = HostLoc::RSI;
|
|
||||||
constexpr HostLoc ABI_PARAM3 = HostLoc::RDX;
|
|
||||||
constexpr HostLoc ABI_PARAM4 = HostLoc::RCX;
|
|
||||||
|
|
||||||
constexpr std::array<HostLoc, 25> ABI_ALL_CALLER_SAVE = {
|
|
||||||
HostLoc::RAX,
|
|
||||||
HostLoc::RCX,
|
|
||||||
HostLoc::RDX,
|
|
||||||
HostLoc::RDI,
|
|
||||||
HostLoc::RSI,
|
|
||||||
HostLoc::R8,
|
|
||||||
HostLoc::R9,
|
|
||||||
HostLoc::R10,
|
|
||||||
HostLoc::R11,
|
|
||||||
HostLoc::XMM0,
|
|
||||||
HostLoc::XMM1,
|
|
||||||
HostLoc::XMM2,
|
|
||||||
HostLoc::XMM3,
|
|
||||||
HostLoc::XMM4,
|
|
||||||
HostLoc::XMM5,
|
|
||||||
HostLoc::XMM6,
|
|
||||||
HostLoc::XMM7,
|
|
||||||
HostLoc::XMM8,
|
|
||||||
HostLoc::XMM9,
|
|
||||||
HostLoc::XMM10,
|
|
||||||
HostLoc::XMM11,
|
|
||||||
HostLoc::XMM12,
|
|
||||||
HostLoc::XMM13,
|
|
||||||
HostLoc::XMM14,
|
|
||||||
HostLoc::XMM15,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr std::array<HostLoc, 6> ABI_ALL_CALLEE_SAVE = {
|
|
||||||
HostLoc::RBX,
|
|
||||||
HostLoc::RBP,
|
|
||||||
HostLoc::R12,
|
|
||||||
HostLoc::R13,
|
|
||||||
HostLoc::R14,
|
|
||||||
HostLoc::R15,
|
|
||||||
};
|
|
||||||
|
|
||||||
constexpr size_t ABI_SHADOW_SPACE = 0; // bytes
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static_assert(ABI_ALL_CALLER_SAVE.size() + ABI_ALL_CALLEE_SAVE.size() == 31, "Invalid total number of registers");
|
|
||||||
|
|
||||||
void ABI_PushCalleeSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size = 0);
|
|
||||||
void ABI_PopCalleeSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size = 0);
|
|
||||||
void ABI_PushCallerSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size = 0);
|
|
||||||
void ABI_PopCallerSaveRegistersAndAdjustStack(BlockOfCode& code, size_t frame_size = 0);
|
|
||||||
|
|
||||||
void ABI_PushCallerSaveRegistersAndAdjustStackExcept(BlockOfCode& code, HostLoc exception);
|
|
||||||
void ABI_PopCallerSaveRegistersAndAdjustStackExcept(BlockOfCode& code, HostLoc exception);
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
419
externals/dynarmic/src/backend/x64/block_of_code.cpp
vendored
|
@ -1,419 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "backend/x64/a32_jitstate.h"
|
|
||||||
#include "backend/x64/abi.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/perf_map.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/bit_util.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
#include <windows.h>
|
|
||||||
#else
|
|
||||||
#include <sys/mman.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_RETURN = Xbyak::util::rax;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM1 = Xbyak::util::rcx;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM2 = Xbyak::util::rdx;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM3 = Xbyak::util::r8;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM4 = Xbyak::util::r9;
|
|
||||||
const std::array<Xbyak::Reg64, 4> BlockOfCode::ABI_PARAMS = {BlockOfCode::ABI_PARAM1, BlockOfCode::ABI_PARAM2, BlockOfCode::ABI_PARAM3, BlockOfCode::ABI_PARAM4};
|
|
||||||
#else
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_RETURN = Xbyak::util::rax;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_RETURN2 = Xbyak::util::rdx;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM1 = Xbyak::util::rdi;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM2 = Xbyak::util::rsi;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM3 = Xbyak::util::rdx;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM4 = Xbyak::util::rcx;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM5 = Xbyak::util::r8;
|
|
||||||
const Xbyak::Reg64 BlockOfCode::ABI_PARAM6 = Xbyak::util::r9;
|
|
||||||
const std::array<Xbyak::Reg64, 6> BlockOfCode::ABI_PARAMS = {BlockOfCode::ABI_PARAM1, BlockOfCode::ABI_PARAM2, BlockOfCode::ABI_PARAM3, BlockOfCode::ABI_PARAM4, BlockOfCode::ABI_PARAM5, BlockOfCode::ABI_PARAM6};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
constexpr size_t CONSTANT_POOL_SIZE = 2 * 1024 * 1024;
|
|
||||||
|
|
||||||
class CustomXbyakAllocator : public Xbyak::Allocator {
|
|
||||||
public:
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
|
||||||
bool useProtect() const override { return false; }
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is threadsafe as Xbyak::Allocator does not contain any state; it is a pure interface.
|
|
||||||
CustomXbyakAllocator s_allocator;
|
|
||||||
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
|
||||||
void ProtectMemory(const void* base, size_t size, bool is_executable) {
|
|
||||||
#ifdef _WIN32
|
|
||||||
DWORD oldProtect = 0;
|
|
||||||
VirtualProtect(const_cast<void*>(base), size, is_executable ? PAGE_EXECUTE_READ : PAGE_READWRITE, &oldProtect);
|
|
||||||
#else
|
|
||||||
static const size_t pageSize = sysconf(_SC_PAGESIZE);
|
|
||||||
const size_t iaddr = reinterpret_cast<size_t>(base);
|
|
||||||
const size_t roundAddr = iaddr & ~(pageSize - static_cast<size_t>(1));
|
|
||||||
const int mode = is_executable ? (PROT_READ | PROT_EXEC) : (PROT_READ | PROT_WRITE);
|
|
||||||
mprotect(reinterpret_cast<void*>(roundAddr), size + (iaddr - roundAddr), mode);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
} // anonymous namespace
|
|
||||||
|
|
||||||
BlockOfCode::BlockOfCode(RunCodeCallbacks cb, JitStateInfo jsi, size_t total_code_size, size_t far_code_offset, std::function<void(BlockOfCode&)> rcp)
|
|
||||||
: Xbyak::CodeGenerator(total_code_size, nullptr, &s_allocator)
|
|
||||||
, cb(std::move(cb))
|
|
||||||
, jsi(jsi)
|
|
||||||
, far_code_offset(far_code_offset)
|
|
||||||
, constant_pool(*this, CONSTANT_POOL_SIZE)
|
|
||||||
{
|
|
||||||
EnableWriting();
|
|
||||||
GenRunCode(rcp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::PreludeComplete() {
|
|
||||||
prelude_complete = true;
|
|
||||||
near_code_begin = getCurr();
|
|
||||||
far_code_begin = getCurr() + far_code_offset;
|
|
||||||
ClearCache();
|
|
||||||
DisableWriting();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::EnableWriting() {
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
|
||||||
ProtectMemory(getCode(), maxSize_, false);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::DisableWriting() {
|
|
||||||
#ifdef DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT
|
|
||||||
ProtectMemory(getCode(), maxSize_, true);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::ClearCache() {
|
|
||||||
ASSERT(prelude_complete);
|
|
||||||
in_far_code = false;
|
|
||||||
near_code_ptr = near_code_begin;
|
|
||||||
far_code_ptr = far_code_begin;
|
|
||||||
SetCodePtr(near_code_begin);
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t BlockOfCode::SpaceRemaining() const {
|
|
||||||
ASSERT(prelude_complete);
|
|
||||||
const u8* current_near_ptr = in_far_code ? reinterpret_cast<const u8*>(near_code_ptr) : getCode<const u8*>();
|
|
||||||
const u8* current_far_ptr = in_far_code ? getCode<const u8*>() : reinterpret_cast<const u8*>(far_code_ptr);
|
|
||||||
if (current_near_ptr >= far_code_begin)
|
|
||||||
return 0;
|
|
||||||
if (current_far_ptr >= &top_[maxSize_])
|
|
||||||
return 0;
|
|
||||||
return std::min(reinterpret_cast<const u8*>(far_code_begin) - current_near_ptr, &top_[maxSize_] - current_far_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::RunCode(void* jit_state, CodePtr code_ptr) const {
|
|
||||||
run_code(jit_state, code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::StepCode(void* jit_state, CodePtr code_ptr) const {
|
|
||||||
step_code(jit_state, code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::ReturnFromRunCode(bool mxcsr_already_exited) {
|
|
||||||
size_t index = 0;
|
|
||||||
if (mxcsr_already_exited)
|
|
||||||
index |= MXCSR_ALREADY_EXITED;
|
|
||||||
jmp(return_from_run_code[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::ForceReturnFromRunCode(bool mxcsr_already_exited) {
|
|
||||||
size_t index = FORCE_RETURN;
|
|
||||||
if (mxcsr_already_exited)
|
|
||||||
index |= MXCSR_ALREADY_EXITED;
|
|
||||||
jmp(return_from_run_code[index]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::GenRunCode(std::function<void(BlockOfCode&)> rcp) {
|
|
||||||
align();
|
|
||||||
run_code = getCurr<RunCodeFuncType>();
|
|
||||||
|
|
||||||
// This serves two purposes:
|
|
||||||
// 1. It saves all the registers we as a callee need to save.
|
|
||||||
// 2. It aligns the stack so that the code the JIT emits can assume
|
|
||||||
// that the stack is appropriately aligned for CALLs.
|
|
||||||
ABI_PushCalleeSaveRegistersAndAdjustStack(*this);
|
|
||||||
|
|
||||||
mov(r15, ABI_PARAM1);
|
|
||||||
mov(rbx, ABI_PARAM2); // save temporarily in non-volatile register
|
|
||||||
|
|
||||||
cb.GetTicksRemaining->EmitCall(*this);
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_to_run], ABI_RETURN);
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_remaining], ABI_RETURN);
|
|
||||||
|
|
||||||
rcp(*this);
|
|
||||||
|
|
||||||
SwitchMxcsrOnEntry();
|
|
||||||
jmp(rbx);
|
|
||||||
|
|
||||||
align();
|
|
||||||
step_code = getCurr<RunCodeFuncType>();
|
|
||||||
|
|
||||||
ABI_PushCalleeSaveRegistersAndAdjustStack(*this);
|
|
||||||
|
|
||||||
mov(r15, ABI_PARAM1);
|
|
||||||
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_to_run], 1);
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_remaining], 1);
|
|
||||||
|
|
||||||
rcp(*this);
|
|
||||||
|
|
||||||
SwitchMxcsrOnEntry();
|
|
||||||
jmp(ABI_PARAM2);
|
|
||||||
|
|
||||||
align();
|
|
||||||
|
|
||||||
// Dispatcher loop
|
|
||||||
|
|
||||||
Xbyak::Label return_to_caller, return_to_caller_mxcsr_already_exited;
|
|
||||||
|
|
||||||
align();
|
|
||||||
return_from_run_code[0] = getCurr<const void*>();
|
|
||||||
|
|
||||||
cmp(qword[r15 + jsi.offsetof_cycles_remaining], 0);
|
|
||||||
jng(return_to_caller);
|
|
||||||
cb.LookupBlock->EmitCall(*this);
|
|
||||||
jmp(ABI_RETURN);
|
|
||||||
|
|
||||||
align();
|
|
||||||
return_from_run_code[MXCSR_ALREADY_EXITED] = getCurr<const void*>();
|
|
||||||
|
|
||||||
cmp(qword[r15 + jsi.offsetof_cycles_remaining], 0);
|
|
||||||
jng(return_to_caller_mxcsr_already_exited);
|
|
||||||
SwitchMxcsrOnEntry();
|
|
||||||
cb.LookupBlock->EmitCall(*this);
|
|
||||||
jmp(ABI_RETURN);
|
|
||||||
|
|
||||||
align();
|
|
||||||
return_from_run_code[FORCE_RETURN] = getCurr<const void*>();
|
|
||||||
L(return_to_caller);
|
|
||||||
|
|
||||||
SwitchMxcsrOnExit();
|
|
||||||
// fallthrough
|
|
||||||
|
|
||||||
return_from_run_code[MXCSR_ALREADY_EXITED | FORCE_RETURN] = getCurr<const void*>();
|
|
||||||
L(return_to_caller_mxcsr_already_exited);
|
|
||||||
|
|
||||||
cb.AddTicks->EmitCall(*this, [this](RegList param) {
|
|
||||||
mov(param[0], qword[r15 + jsi.offsetof_cycles_to_run]);
|
|
||||||
sub(param[0], qword[r15 + jsi.offsetof_cycles_remaining]);
|
|
||||||
});
|
|
||||||
|
|
||||||
ABI_PopCalleeSaveRegistersAndAdjustStack(*this);
|
|
||||||
ret();
|
|
||||||
|
|
||||||
PerfMapRegister(run_code, getCurr(), "dynarmic_dispatcher");
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::SwitchMxcsrOnEntry() {
|
|
||||||
stmxcsr(dword[r15 + jsi.offsetof_save_host_MXCSR]);
|
|
||||||
ldmxcsr(dword[r15 + jsi.offsetof_guest_MXCSR]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::SwitchMxcsrOnExit() {
|
|
||||||
stmxcsr(dword[r15 + jsi.offsetof_guest_MXCSR]);
|
|
||||||
ldmxcsr(dword[r15 + jsi.offsetof_save_host_MXCSR]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::EnterStandardASIMD() {
|
|
||||||
stmxcsr(dword[r15 + jsi.offsetof_guest_MXCSR]);
|
|
||||||
ldmxcsr(dword[r15 + jsi.offsetof_asimd_MXCSR]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::LeaveStandardASIMD() {
|
|
||||||
stmxcsr(dword[r15 + jsi.offsetof_asimd_MXCSR]);
|
|
||||||
ldmxcsr(dword[r15 + jsi.offsetof_guest_MXCSR]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::UpdateTicks() {
|
|
||||||
cb.AddTicks->EmitCall(*this, [this](RegList param) {
|
|
||||||
mov(param[0], qword[r15 + jsi.offsetof_cycles_to_run]);
|
|
||||||
sub(param[0], qword[r15 + jsi.offsetof_cycles_remaining]);
|
|
||||||
});
|
|
||||||
|
|
||||||
cb.GetTicksRemaining->EmitCall(*this);
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_to_run], ABI_RETURN);
|
|
||||||
mov(qword[r15 + jsi.offsetof_cycles_remaining], ABI_RETURN);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::LookupBlock() {
|
|
||||||
cb.LookupBlock->EmitCall(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
Xbyak::Address BlockOfCode::MConst(const Xbyak::AddressFrame& frame, u64 lower, u64 upper) {
|
|
||||||
return constant_pool.GetConstant(frame, lower, upper);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::SwitchToFarCode() {
|
|
||||||
ASSERT(prelude_complete);
|
|
||||||
ASSERT(!in_far_code);
|
|
||||||
in_far_code = true;
|
|
||||||
near_code_ptr = getCurr();
|
|
||||||
SetCodePtr(far_code_ptr);
|
|
||||||
|
|
||||||
ASSERT_MSG(near_code_ptr < far_code_begin, "Near code has overwritten far code!");
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::SwitchToNearCode() {
|
|
||||||
ASSERT(prelude_complete);
|
|
||||||
ASSERT(in_far_code);
|
|
||||||
in_far_code = false;
|
|
||||||
far_code_ptr = getCurr();
|
|
||||||
SetCodePtr(near_code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
CodePtr BlockOfCode::GetCodeBegin() const {
|
|
||||||
return near_code_begin;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t BlockOfCode::GetTotalCodeSize() const {
|
|
||||||
return maxSize_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void* BlockOfCode::AllocateFromCodeSpace(size_t alloc_size) {
|
|
||||||
if (size_ + alloc_size >= maxSize_) {
|
|
||||||
throw Xbyak::Error(Xbyak::ERR_CODE_IS_TOO_BIG);
|
|
||||||
}
|
|
||||||
|
|
||||||
void* ret = getCurr<void*>();
|
|
||||||
size_ += alloc_size;
|
|
||||||
memset(ret, 0, alloc_size);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::SetCodePtr(CodePtr code_ptr) {
|
|
||||||
// The "size" defines where top_, the insertion point, is.
|
|
||||||
size_t required_size = reinterpret_cast<const u8*>(code_ptr) - getCode();
|
|
||||||
setSize(required_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BlockOfCode::EnsurePatchLocationSize(CodePtr begin, size_t size) {
|
|
||||||
size_t current_size = getCurr<const u8*>() - reinterpret_cast<const u8*>(begin);
|
|
||||||
ASSERT(current_size <= size);
|
|
||||||
nop(size - current_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasSSSE3() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tSSSE3);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasSSE41() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tSSE41);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasSSE42() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tSSE42);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasPCLMULQDQ() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tPCLMULQDQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAVX() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAVX);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasF16C() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tF16C);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAESNI() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAESNI);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasLZCNT() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tLZCNT);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasBMI1() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tBMI1);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasBMI2() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tBMI2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasFastBMI2() const {
|
|
||||||
if (DoesCpuSupport(Xbyak::util::Cpu::tBMI2)) {
|
|
||||||
// BMI2 instructions such as pdep and pext have been very slow up until Zen 3.
|
|
||||||
// Check for Zen 3 or newer by its family (0x19).
|
|
||||||
// See also: https://en.wikichip.org/wiki/amd/cpuid
|
|
||||||
if (DoesCpuSupport(Xbyak::util::Cpu::tAMD)) {
|
|
||||||
std::array<u32, 4> data{};
|
|
||||||
cpu_info.getCpuid(1, data.data());
|
|
||||||
const u32 family_base = Common::Bits< 8, 11>(data[0]);
|
|
||||||
const u32 family_extended = Common::Bits<20, 27>(data[0]);
|
|
||||||
const u32 family = family_base + family_extended;
|
|
||||||
return family >= 0x19;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasFMA() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tFMA);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAVX2() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAVX2);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAVX512_Skylake() const {
|
|
||||||
// The feature set formerly known as AVX3.2. (Introduced with Skylake.)
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAVX512F)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512CD)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512BW)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512DQ)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512VL);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAVX512_Icelake() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAVX512F)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512CD)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512BW)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512DQ)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512VL)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512_VPOPCNTDQ)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512_VNNI)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tGFNI)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tVAES)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512_VBMI2)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tAVX512_BITALG)
|
|
||||||
&& DoesCpuSupport(Xbyak::util::Cpu::tVPCLMULQDQ);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::HasAVX512_BITALG() const {
|
|
||||||
return DoesCpuSupport(Xbyak::util::Cpu::tAVX512_BITALG);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool BlockOfCode::DoesCpuSupport([[maybe_unused]] Xbyak::util::Cpu::Type type) const {
|
|
||||||
#ifdef DYNARMIC_ENABLE_CPU_FEATURE_DETECTION
|
|
||||||
return cpu_info.has(type);
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
191
externals/dynarmic/src/backend/x64/block_of_code.h
vendored
|
@ -1,191 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <array>
|
|
||||||
#include <functional>
|
|
||||||
#include <memory>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
#include <xbyak_util.h>
|
|
||||||
|
|
||||||
#include "backend/x64/callback.h"
|
|
||||||
#include "backend/x64/constant_pool.h"
|
|
||||||
#include "backend/x64/jitstate_info.h"
|
|
||||||
#include "common/cast_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
using CodePtr = const void*;
|
|
||||||
|
|
||||||
struct RunCodeCallbacks {
|
|
||||||
std::unique_ptr<Callback> LookupBlock;
|
|
||||||
std::unique_ptr<Callback> AddTicks;
|
|
||||||
std::unique_ptr<Callback> GetTicksRemaining;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BlockOfCode final : public Xbyak::CodeGenerator {
|
|
||||||
public:
|
|
||||||
BlockOfCode(RunCodeCallbacks cb, JitStateInfo jsi, size_t total_code_size, size_t far_code_offset, std::function<void(BlockOfCode&)> rcp);
|
|
||||||
BlockOfCode(const BlockOfCode&) = delete;
|
|
||||||
|
|
||||||
/// Call when external emitters have finished emitting their preludes.
|
|
||||||
void PreludeComplete();
|
|
||||||
|
|
||||||
/// Change permissions to RW. This is required to support systems with W^X enforced.
|
|
||||||
void EnableWriting();
|
|
||||||
/// Change permissions to RX. This is required to support systems with W^X enforced.
|
|
||||||
void DisableWriting();
|
|
||||||
|
|
||||||
/// Clears this block of code and resets code pointer to beginning.
|
|
||||||
void ClearCache();
|
|
||||||
/// Calculates how much space is remaining to use. This is the minimum of near code and far code.
|
|
||||||
size_t SpaceRemaining() const;
|
|
||||||
|
|
||||||
/// Runs emulated code from code_ptr.
|
|
||||||
void RunCode(void* jit_state, CodePtr code_ptr) const;
|
|
||||||
/// Runs emulated code from code_ptr for a single cycle.
|
|
||||||
void StepCode(void* jit_state, CodePtr code_ptr) const;
|
|
||||||
/// Code emitter: Returns to dispatcher
|
|
||||||
void ReturnFromRunCode(bool mxcsr_already_exited = false);
|
|
||||||
/// Code emitter: Returns to dispatcher, forces return to host
|
|
||||||
void ForceReturnFromRunCode(bool mxcsr_already_exited = false);
|
|
||||||
/// Code emitter: Makes guest MXCSR the current MXCSR
|
|
||||||
void SwitchMxcsrOnEntry();
|
|
||||||
/// Code emitter: Makes saved host MXCSR the current MXCSR
|
|
||||||
void SwitchMxcsrOnExit();
|
|
||||||
/// Code emitter: Enter standard ASIMD MXCSR region
|
|
||||||
void EnterStandardASIMD();
|
|
||||||
/// Code emitter: Leave standard ASIMD MXCSR region
|
|
||||||
void LeaveStandardASIMD();
|
|
||||||
/// Code emitter: Updates cycles remaining my calling cb.AddTicks and cb.GetTicksRemaining
|
|
||||||
/// @note this clobbers ABI caller-save registers
|
|
||||||
void UpdateTicks();
|
|
||||||
/// Code emitter: Performs a block lookup based on current state
|
|
||||||
/// @note this clobbers ABI caller-save registers
|
|
||||||
void LookupBlock();
|
|
||||||
|
|
||||||
/// Code emitter: Calls the function
|
|
||||||
template <typename FunctionPointer>
|
|
||||||
void CallFunction(FunctionPointer fn) {
|
|
||||||
static_assert(std::is_pointer_v<FunctionPointer> && std::is_function_v<std::remove_pointer_t<FunctionPointer>>,
|
|
||||||
"Supplied type must be a pointer to a function");
|
|
||||||
|
|
||||||
const u64 address = reinterpret_cast<u64>(fn);
|
|
||||||
const u64 distance = address - (getCurr<u64>() + 5);
|
|
||||||
|
|
||||||
if (distance >= 0x0000000080000000ULL && distance < 0xFFFFFFFF80000000ULL) {
|
|
||||||
// Far call
|
|
||||||
mov(rax, address);
|
|
||||||
call(rax);
|
|
||||||
} else {
|
|
||||||
call(fn);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Code emitter: Calls the lambda. Lambda must not have any captures.
|
|
||||||
template <typename Lambda>
|
|
||||||
void CallLambda(Lambda l) {
|
|
||||||
CallFunction(Common::FptrCast(l));
|
|
||||||
}
|
|
||||||
|
|
||||||
Xbyak::Address MConst(const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
|
||||||
|
|
||||||
/// Far code sits far away from the near code. Execution remains primarily in near code.
|
|
||||||
/// "Cold" / Rarely executed instructions sit in far code, so the CPU doesn't fetch them unless necessary.
|
|
||||||
void SwitchToFarCode();
|
|
||||||
void SwitchToNearCode();
|
|
||||||
|
|
||||||
CodePtr GetCodeBegin() const;
|
|
||||||
size_t GetTotalCodeSize() const;
|
|
||||||
|
|
||||||
const void* GetReturnFromRunCodeAddress() const {
|
|
||||||
return return_from_run_code[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
const void* GetForceReturnFromRunCodeAddress() const {
|
|
||||||
return return_from_run_code[FORCE_RETURN];
|
|
||||||
}
|
|
||||||
|
|
||||||
void int3() { db(0xCC); }
|
|
||||||
|
|
||||||
/// Allocate memory of `size` bytes from the same block of memory the code is in.
|
|
||||||
/// This is useful for objects that need to be placed close to or within code.
|
|
||||||
/// The lifetime of this memory is the same as the code around it.
|
|
||||||
void* AllocateFromCodeSpace(size_t size);
|
|
||||||
|
|
||||||
void SetCodePtr(CodePtr code_ptr);
|
|
||||||
void EnsurePatchLocationSize(CodePtr begin, size_t size);
|
|
||||||
|
|
||||||
// ABI registers
|
|
||||||
#ifdef _WIN32
|
|
||||||
static const Xbyak::Reg64 ABI_RETURN;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM1;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM2;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM3;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM4;
|
|
||||||
static const std::array<Xbyak::Reg64, 4> ABI_PARAMS;
|
|
||||||
#else
|
|
||||||
static const Xbyak::Reg64 ABI_RETURN;
|
|
||||||
static const Xbyak::Reg64 ABI_RETURN2;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM1;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM2;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM3;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM4;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM5;
|
|
||||||
static const Xbyak::Reg64 ABI_PARAM6;
|
|
||||||
static const std::array<Xbyak::Reg64, 6> ABI_PARAMS;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
JitStateInfo GetJitStateInfo() const { return jsi; }
|
|
||||||
|
|
||||||
bool HasSSSE3() const;
|
|
||||||
bool HasSSE41() const;
|
|
||||||
bool HasSSE42() const;
|
|
||||||
bool HasPCLMULQDQ() const;
|
|
||||||
bool HasAVX() const;
|
|
||||||
bool HasF16C() const;
|
|
||||||
bool HasAESNI() const;
|
|
||||||
bool HasLZCNT() const;
|
|
||||||
bool HasBMI1() const;
|
|
||||||
bool HasBMI2() const;
|
|
||||||
bool HasFastBMI2() const;
|
|
||||||
bool HasFMA() const;
|
|
||||||
bool HasAVX2() const;
|
|
||||||
bool HasAVX512_Skylake() const;
|
|
||||||
bool HasAVX512_Icelake() const;
|
|
||||||
bool HasAVX512_BITALG() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
RunCodeCallbacks cb;
|
|
||||||
JitStateInfo jsi;
|
|
||||||
size_t far_code_offset;
|
|
||||||
|
|
||||||
bool prelude_complete = false;
|
|
||||||
CodePtr near_code_begin = nullptr;
|
|
||||||
CodePtr far_code_begin = nullptr;
|
|
||||||
|
|
||||||
ConstantPool constant_pool;
|
|
||||||
|
|
||||||
bool in_far_code = false;
|
|
||||||
CodePtr near_code_ptr;
|
|
||||||
CodePtr far_code_ptr;
|
|
||||||
|
|
||||||
using RunCodeFuncType = void(*)(void*, CodePtr);
|
|
||||||
RunCodeFuncType run_code = nullptr;
|
|
||||||
RunCodeFuncType step_code = nullptr;
|
|
||||||
static constexpr size_t MXCSR_ALREADY_EXITED = 1 << 0;
|
|
||||||
static constexpr size_t FORCE_RETURN = 1 << 1;
|
|
||||||
std::array<const void*, 4> return_from_run_code;
|
|
||||||
void GenRunCode(std::function<void(BlockOfCode&)> rcp);
|
|
||||||
|
|
||||||
Xbyak::util::Cpu cpu_info;
|
|
||||||
bool DoesCpuSupport(Xbyak::util::Cpu::Type type) const;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,43 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <boost/icl/interval_map.hpp>
|
|
||||||
#include <boost/icl/interval_set.hpp>
|
|
||||||
#include <tsl/robin_set.h>
|
|
||||||
|
|
||||||
#include "backend/x64/block_range_information.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
template <typename ProgramCounterType>
|
|
||||||
void BlockRangeInformation<ProgramCounterType>::AddRange(boost::icl::discrete_interval<ProgramCounterType> range, IR::LocationDescriptor location) {
|
|
||||||
block_ranges.add(std::make_pair(range, std::set<IR::LocationDescriptor>{location}));
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ProgramCounterType>
|
|
||||||
void BlockRangeInformation<ProgramCounterType>::ClearCache() {
|
|
||||||
block_ranges.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename ProgramCounterType>
|
|
||||||
tsl::robin_set<IR::LocationDescriptor> BlockRangeInformation<ProgramCounterType>::InvalidateRanges(const boost::icl::interval_set<ProgramCounterType>& ranges) {
|
|
||||||
tsl::robin_set<IR::LocationDescriptor> erase_locations;
|
|
||||||
for (auto invalidate_interval : ranges) {
|
|
||||||
auto pair = block_ranges.equal_range(invalidate_interval);
|
|
||||||
for (auto it = pair.first; it != pair.second; ++it) {
|
|
||||||
for (const auto &descriptor : it->second) {
|
|
||||||
erase_locations.insert(descriptor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO: EFFICIENCY: Remove ranges that are to be erased.
|
|
||||||
return erase_locations;
|
|
||||||
}
|
|
||||||
|
|
||||||
template class BlockRangeInformation<u32>;
|
|
||||||
template class BlockRangeInformation<u64>;
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,29 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <set>
|
|
||||||
|
|
||||||
#include <boost/icl/interval_map.hpp>
|
|
||||||
#include <boost/icl/interval_set.hpp>
|
|
||||||
#include <tsl/robin_set.h>
|
|
||||||
|
|
||||||
#include "frontend/ir/location_descriptor.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
template <typename ProgramCounterType>
|
|
||||||
class BlockRangeInformation {
|
|
||||||
public:
|
|
||||||
void AddRange(boost::icl::discrete_interval<ProgramCounterType> range, IR::LocationDescriptor location);
|
|
||||||
void ClearCache();
|
|
||||||
tsl::robin_set<IR::LocationDescriptor> InvalidateRanges(const boost::icl::interval_set<ProgramCounterType>& ranges);
|
|
||||||
|
|
||||||
private:
|
|
||||||
boost::icl::interval_map<ProgramCounterType, std::set<IR::LocationDescriptor>> block_ranges;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
40
externals/dynarmic/src/backend/x64/callback.cpp
vendored
|
@ -1,40 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "backend/x64/callback.h"
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
Callback::~Callback() = default;
|
|
||||||
|
|
||||||
void SimpleCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) const {
|
|
||||||
l({code.ABI_PARAM1, code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
|
||||||
code.CallFunction(fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SimpleCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) const {
|
|
||||||
l(code.ABI_PARAM1, {code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
|
||||||
code.CallFunction(fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArgCallback::EmitCall(BlockOfCode& code, std::function<void(RegList)> l) const {
|
|
||||||
l({code.ABI_PARAM2, code.ABI_PARAM3, code.ABI_PARAM4});
|
|
||||||
code.mov(code.ABI_PARAM1, arg);
|
|
||||||
code.CallFunction(fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ArgCallback::EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> l) const {
|
|
||||||
#if defined(WIN32) && !defined(__MINGW64__)
|
|
||||||
l(code.ABI_PARAM2, {code.ABI_PARAM3, code.ABI_PARAM4});
|
|
||||||
code.mov(code.ABI_PARAM1, arg);
|
|
||||||
#else
|
|
||||||
l(code.ABI_PARAM1, {code.ABI_PARAM3, code.ABI_PARAM4});
|
|
||||||
code.mov(code.ABI_PARAM2, arg);
|
|
||||||
#endif
|
|
||||||
code.CallFunction(fn);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
54
externals/dynarmic/src/backend/x64/callback.h
vendored
|
@ -1,54 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
using RegList = std::vector<Xbyak::Reg64>;
|
|
||||||
|
|
||||||
class BlockOfCode;
|
|
||||||
|
|
||||||
class Callback {
|
|
||||||
public:
|
|
||||||
virtual ~Callback();
|
|
||||||
|
|
||||||
virtual void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const = 0;
|
|
||||||
virtual void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
class SimpleCallback final : public Callback {
|
|
||||||
public:
|
|
||||||
template <typename Function>
|
|
||||||
SimpleCallback(Function fn) : fn(reinterpret_cast<void(*)()>(fn)) {}
|
|
||||||
|
|
||||||
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const override;
|
|
||||||
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void (*fn)();
|
|
||||||
};
|
|
||||||
|
|
||||||
class ArgCallback final : public Callback {
|
|
||||||
public:
|
|
||||||
template <typename Function>
|
|
||||||
ArgCallback(Function fn, u64 arg) : fn(reinterpret_cast<void(*)()>(fn)), arg(arg) {}
|
|
||||||
|
|
||||||
void EmitCall(BlockOfCode& code, std::function<void(RegList)> fn = [](RegList){}) const override;
|
|
||||||
void EmitCallWithReturnPointer(BlockOfCode& code, std::function<void(Xbyak::Reg64, RegList)> fn) const override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void (*fn)();
|
|
||||||
u64 arg;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,34 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/constant_pool.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
ConstantPool::ConstantPool(BlockOfCode& code, size_t size) : code(code), pool_size(size) {
|
|
||||||
code.int3();
|
|
||||||
code.align(align_size);
|
|
||||||
pool_begin = reinterpret_cast<u8*>(code.AllocateFromCodeSpace(size));
|
|
||||||
current_pool_ptr = pool_begin;
|
|
||||||
}
|
|
||||||
|
|
||||||
Xbyak::Address ConstantPool::GetConstant(const Xbyak::AddressFrame& frame, u64 lower, u64 upper) {
|
|
||||||
const auto constant = std::make_tuple(lower, upper);
|
|
||||||
auto iter = constant_info.find(constant);
|
|
||||||
if (iter == constant_info.end()) {
|
|
||||||
ASSERT(static_cast<size_t>(current_pool_ptr - pool_begin) < pool_size);
|
|
||||||
std::memcpy(current_pool_ptr, &lower, sizeof(u64));
|
|
||||||
std::memcpy(current_pool_ptr + sizeof(u64), &upper, sizeof(u64));
|
|
||||||
iter = constant_info.emplace(constant, current_pool_ptr).first;
|
|
||||||
current_pool_ptr += align_size;
|
|
||||||
}
|
|
||||||
return frame[code.rip + iter->second];
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,40 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <map>
|
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
#include <xbyak.h>
|
|
||||||
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
class BlockOfCode;
|
|
||||||
|
|
||||||
/// ConstantPool allocates a block of memory from BlockOfCode.
|
|
||||||
/// It places constants into this block of memory, returning the address
|
|
||||||
/// of the memory location where the constant is placed. If the constant
|
|
||||||
/// already exists, its memory location is reused.
|
|
||||||
class ConstantPool final {
|
|
||||||
public:
|
|
||||||
ConstantPool(BlockOfCode& code, size_t size);
|
|
||||||
|
|
||||||
Xbyak::Address GetConstant(const Xbyak::AddressFrame& frame, u64 lower, u64 upper = 0);
|
|
||||||
|
|
||||||
private:
|
|
||||||
static constexpr size_t align_size = 16; // bytes
|
|
||||||
|
|
||||||
std::map<std::tuple<u64, u64>, void*> constant_info;
|
|
||||||
|
|
||||||
BlockOfCode& code;
|
|
||||||
size_t pool_size;
|
|
||||||
u8* pool_begin;
|
|
||||||
u8* current_pool_ptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|
|
@ -1,81 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2018 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
#include <mp/traits/function_info.h>
|
|
||||||
|
|
||||||
#include "backend/x64/callback.h"
|
|
||||||
#include "common/cast_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
|
|
||||||
namespace Dynarmic {
|
|
||||||
namespace Backend::X64 {
|
|
||||||
|
|
||||||
namespace impl {
|
|
||||||
|
|
||||||
template <typename FunctionType, FunctionType mfp>
|
|
||||||
struct ThunkBuilder;
|
|
||||||
|
|
||||||
template <typename C, typename R, typename... Args, R(C::*mfp)(Args...)>
|
|
||||||
struct ThunkBuilder<R(C::*)(Args...), mfp> {
|
|
||||||
static R Thunk(C* this_, Args... args) {
|
|
||||||
return (this_->*mfp)(std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace impl
|
|
||||||
|
|
||||||
template<auto mfp>
|
|
||||||
ArgCallback DevirtualizeGeneric(mp::class_type<decltype(mfp)>* this_) {
|
|
||||||
return ArgCallback{&impl::ThunkBuilder<decltype(mfp), mfp>::Thunk, reinterpret_cast<u64>(this_)};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<auto mfp>
|
|
||||||
ArgCallback DevirtualizeWindows(mp::class_type<decltype(mfp)>* this_) {
|
|
||||||
static_assert(sizeof(mfp) == 8);
|
|
||||||
return ArgCallback{Common::BitCast<u64>(mfp), reinterpret_cast<u64>(this_)};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<auto mfp>
|
|
||||||
ArgCallback DevirtualizeItanium(mp::class_type<decltype(mfp)>* this_) {
|
|
||||||
struct MemberFunctionPointer {
|
|
||||||
/// For a non-virtual function, this is a simple function pointer.
|
|
||||||
/// For a virtual function, it is (1 + virtual table offset in bytes).
|
|
||||||
u64 ptr;
|
|
||||||
/// The required adjustment to `this`, prior to the call.
|
|
||||||
u64 adj;
|
|
||||||
} mfp_struct = Common::BitCast<MemberFunctionPointer>(mfp);
|
|
||||||
|
|
||||||
static_assert(sizeof(MemberFunctionPointer) == 16);
|
|
||||||
static_assert(sizeof(MemberFunctionPointer) == sizeof(mfp));
|
|
||||||
|
|
||||||
u64 fn_ptr = mfp_struct.ptr;
|
|
||||||
u64 this_ptr = reinterpret_cast<u64>(this_) + mfp_struct.adj;
|
|
||||||
if (mfp_struct.ptr & 1) {
|
|
||||||
u64 vtable = Common::BitCastPointee<u64>(this_ptr);
|
|
||||||
fn_ptr = Common::BitCastPointee<u64>(vtable + fn_ptr - 1);
|
|
||||||
}
|
|
||||||
return ArgCallback{fn_ptr, this_ptr};
|
|
||||||
}
|
|
||||||
|
|
||||||
template<auto mfp>
|
|
||||||
ArgCallback Devirtualize(mp::class_type<decltype(mfp)>* this_) {
|
|
||||||
#if defined(__APPLE__) || defined(linux) || defined(__linux) || defined(__linux__)
|
|
||||||
return DevirtualizeItanium<mfp>(this_);
|
|
||||||
#elif defined(__MINGW64__)
|
|
||||||
return DevirtualizeItanium<mfp>(this_);
|
|
||||||
#elif defined(_WIN32)
|
|
||||||
return DevirtualizeWindows<mfp>(this_);
|
|
||||||
#else
|
|
||||||
return DevirtualizeGeneric<mfp>(this_);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Backend::X64
|
|
||||||
} // namespace Dynarmic
|
|
340
externals/dynarmic/src/backend/x64/emit_x64.cpp
vendored
|
@ -1,340 +0,0 @@
|
||||||
/* This file is part of the dynarmic project.
|
|
||||||
* Copyright (c) 2016 MerryMage
|
|
||||||
* SPDX-License-Identifier: 0BSD
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
#include <tsl/robin_set.h>
|
|
||||||
|
|
||||||
#include "backend/x64/block_of_code.h"
|
|
||||||
#include "backend/x64/emit_x64.h"
|
|
||||||
#include "backend/x64/nzcv_util.h"
|
|
||||||
#include "backend/x64/perf_map.h"
|
|
||||||
#include "common/assert.h"
|
|
||||||
#include "common/bit_util.h"
|
|
||||||
#include "common/common_types.h"
|
|
||||||
#include "common/scope_exit.h"
|
|
||||||
#include "common/variant_util.h"
|
|
||||||
#include "frontend/ir/basic_block.h"
|
|
||||||
#include "frontend/ir/microinstruction.h"
|
|
||||||
#include "frontend/ir/opcodes.h"
|
|
||||||
|
|
||||||
// TODO: Have ARM flags in host flags and not have them use up GPR registers unless necessary.
|
|
||||||
// TODO: Actually implement that proper instruction selector you've always wanted to sweetheart.
|
|
||||||
|
|
||||||
namespace Dynarmic::Backend::X64 {
|
|
||||||
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
|
|
||||||
EmitContext::EmitContext(RegAlloc& reg_alloc, IR::Block& block)
|
|
||||||
: reg_alloc(reg_alloc), block(block) {}
|
|
||||||
|
|
||||||
size_t EmitContext::GetInstOffset(IR::Inst* inst) const {
|
|
||||||
return static_cast<size_t>(std::distance(block.begin(), IR::Block::iterator(inst)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitContext::EraseInstruction(IR::Inst* inst) {
|
|
||||||
block.Instructions().erase(inst);
|
|
||||||
inst->ClearArgs();
|
|
||||||
}
|
|
||||||
|
|
||||||
EmitX64::EmitX64(BlockOfCode& code) : code(code) {
|
|
||||||
exception_handler.Register(code);
|
|
||||||
}
|
|
||||||
|
|
||||||
EmitX64::~EmitX64() = default;
|
|
||||||
|
|
||||||
std::optional<EmitX64::BlockDescriptor> EmitX64::GetBasicBlock(IR::LocationDescriptor descriptor) const {
|
|
||||||
const auto iter = block_descriptors.find(descriptor);
|
|
||||||
if (iter == block_descriptors.end()) {
|
|
||||||
return std::nullopt;
|
|
||||||
}
|
|
||||||
return iter->second;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitVoid(EmitContext&, IR::Inst*) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitBreakpoint(EmitContext&, IR::Inst*) {
|
|
||||||
code.int3();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitIdentity(EmitContext& ctx, IR::Inst* inst) {
|
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
|
||||||
if (!args[0].IsImmediate()) {
|
|
||||||
ctx.reg_alloc.DefineValue(inst, args[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::PushRSBHelper(Xbyak::Reg64 loc_desc_reg, Xbyak::Reg64 index_reg, IR::LocationDescriptor target) {
|
|
||||||
using namespace Xbyak::util;
|
|
||||||
|
|
||||||
const auto iter = block_descriptors.find(target);
|
|
||||||
CodePtr target_code_ptr = iter != block_descriptors.end()
|
|
||||||
? iter->second.entrypoint
|
|
||||||
: code.GetReturnFromRunCodeAddress();
|
|
||||||
|
|
||||||
code.mov(index_reg.cvt32(), dword[r15 + code.GetJitStateInfo().offsetof_rsb_ptr]);
|
|
||||||
|
|
||||||
code.mov(loc_desc_reg, target.Value());
|
|
||||||
|
|
||||||
patch_information[target].mov_rcx.emplace_back(code.getCurr());
|
|
||||||
EmitPatchMovRcx(target_code_ptr);
|
|
||||||
|
|
||||||
code.mov(qword[r15 + index_reg * 8 + code.GetJitStateInfo().offsetof_rsb_location_descriptors], loc_desc_reg);
|
|
||||||
code.mov(qword[r15 + index_reg * 8 + code.GetJitStateInfo().offsetof_rsb_codeptrs], rcx);
|
|
||||||
|
|
||||||
code.add(index_reg.cvt32(), 1);
|
|
||||||
code.and_(index_reg.cvt32(), u32(code.GetJitStateInfo().rsb_ptr_mask));
|
|
||||||
code.mov(dword[r15 + code.GetJitStateInfo().offsetof_rsb_ptr], index_reg.cvt32());
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitPushRSB(EmitContext& ctx, IR::Inst* inst) {
|
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
|
||||||
ASSERT(args[0].IsImmediate());
|
|
||||||
const u64 unique_hash_of_target = args[0].GetImmediateU64();
|
|
||||||
|
|
||||||
ctx.reg_alloc.ScratchGpr(HostLoc::RCX);
|
|
||||||
const Xbyak::Reg64 loc_desc_reg = ctx.reg_alloc.ScratchGpr();
|
|
||||||
const Xbyak::Reg64 index_reg = ctx.reg_alloc.ScratchGpr();
|
|
||||||
|
|
||||||
PushRSBHelper(loc_desc_reg, index_reg, IR::LocationDescriptor{unique_hash_of_target});
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetCarryFromOp(EmitContext&, IR::Inst*) {
|
|
||||||
ASSERT_MSG(false, "should never happen");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetOverflowFromOp(EmitContext&, IR::Inst*) {
|
|
||||||
ASSERT_MSG(false, "should never happen");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetGEFromOp(EmitContext&, IR::Inst*) {
|
|
||||||
ASSERT_MSG(false, "should never happen");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetUpperFromOp(EmitContext&, IR::Inst*) {
|
|
||||||
ASSERT_MSG(false, "should never happen");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetLowerFromOp(EmitContext&, IR::Inst*) {
|
|
||||||
ASSERT_MSG(false, "should never happen");
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitGetNZCVFromOp(EmitContext& ctx, IR::Inst* inst) {
|
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
|
||||||
|
|
||||||
const int bitsize = [&]{
|
|
||||||
switch (args[0].GetType()) {
|
|
||||||
case IR::Type::U8:
|
|
||||||
return 8;
|
|
||||||
case IR::Type::U16:
|
|
||||||
return 16;
|
|
||||||
case IR::Type::U32:
|
|
||||||
return 32;
|
|
||||||
case IR::Type::U64:
|
|
||||||
return 64;
|
|
||||||
default:
|
|
||||||
UNREACHABLE();
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
const Xbyak::Reg64 nzcv = ctx.reg_alloc.ScratchGpr(HostLoc::RAX);
|
|
||||||
const Xbyak::Reg value = ctx.reg_alloc.UseGpr(args[0]).changeBit(bitsize);
|
|
||||||
code.cmp(value, 0);
|
|
||||||
code.lahf();
|
|
||||||
code.seto(code.al);
|
|
||||||
ctx.reg_alloc.DefineValue(inst, nzcv);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitNZCVFromPackedFlags(EmitContext& ctx, IR::Inst* inst) {
|
|
||||||
auto args = ctx.reg_alloc.GetArgumentInfo(inst);
|
|
||||||
|
|
||||||
if (args[0].IsImmediate()) {
|
|
||||||
const Xbyak::Reg32 nzcv = ctx.reg_alloc.ScratchGpr().cvt32();
|
|
||||||
u32 value = 0;
|
|
||||||
value |= Common::Bit<31>(args[0].GetImmediateU32()) ? (1 << 15) : 0;
|
|
||||||
value |= Common::Bit<30>(args[0].GetImmediateU32()) ? (1 << 14) : 0;
|
|
||||||
value |= Common::Bit<29>(args[0].GetImmediateU32()) ? (1 << 8) : 0;
|
|
||||||
value |= Common::Bit<28>(args[0].GetImmediateU32()) ? (1 << 0) : 0;
|
|
||||||
code.mov(nzcv, value);
|
|
||||||
ctx.reg_alloc.DefineValue(inst, nzcv);
|
|
||||||
} else if (code.HasFastBMI2()) {
|
|
||||||
const Xbyak::Reg32 nzcv = ctx.reg_alloc.UseScratchGpr(args[0]).cvt32();
|
|
||||||
const Xbyak::Reg32 tmp = ctx.reg_alloc.ScratchGpr().cvt32();
|
|
||||||
|
|
||||||
code.shr(nzcv, 28);
|
|
||||||
code.mov(tmp, NZCV::x64_mask);
|
|
||||||
code.pdep(nzcv, nzcv, tmp);
|
|
||||||
|
|
||||||
ctx.reg_alloc.DefineValue(inst, nzcv);
|
|
||||||
} else {
|
|
||||||
const Xbyak::Reg32 nzcv = ctx.reg_alloc.UseScratchGpr(args[0]).cvt32();
|
|
||||||
|
|
||||||
code.shr(nzcv, 28);
|
|
||||||
code.imul(nzcv, nzcv, NZCV::to_x64_multiplier);
|
|
||||||
code.and_(nzcv, NZCV::x64_mask);
|
|
||||||
|
|
||||||
ctx.reg_alloc.DefineValue(inst, nzcv);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitAddCycles(size_t cycles) {
|
|
||||||
ASSERT(cycles < std::numeric_limits<u32>::max());
|
|
||||||
code.sub(qword[r15 + code.GetJitStateInfo().offsetof_cycles_remaining], static_cast<u32>(cycles));
|
|
||||||
}
|
|
||||||
|
|
||||||
Xbyak::Label EmitX64::EmitCond(IR::Cond cond) {
|
|
||||||
Xbyak::Label pass;
|
|
||||||
|
|
||||||
code.mov(eax, dword[r15 + code.GetJitStateInfo().offsetof_cpsr_nzcv]);
|
|
||||||
|
|
||||||
// sahf restores SF, ZF, CF
|
|
||||||
// add al, 0x7F restores OF
|
|
||||||
|
|
||||||
switch (cond) {
|
|
||||||
case IR::Cond::EQ: //z
|
|
||||||
code.sahf();
|
|
||||||
code.jz(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::NE: //!z
|
|
||||||
code.sahf();
|
|
||||||
code.jnz(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::CS: //c
|
|
||||||
code.sahf();
|
|
||||||
code.jc(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::CC: //!c
|
|
||||||
code.sahf();
|
|
||||||
code.jnc(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::MI: //n
|
|
||||||
code.sahf();
|
|
||||||
code.js(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::PL: //!n
|
|
||||||
code.sahf();
|
|
||||||
code.jns(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::VS: //v
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.jo(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::VC: //!v
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.jno(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::HI: //c & !z
|
|
||||||
code.sahf();
|
|
||||||
code.cmc();
|
|
||||||
code.ja(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::LS: //!c | z
|
|
||||||
code.sahf();
|
|
||||||
code.cmc();
|
|
||||||
code.jna(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::GE: // n == v
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.sahf();
|
|
||||||
code.jge(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::LT: // n != v
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.sahf();
|
|
||||||
code.jl(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::GT: // !z & (n == v)
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.sahf();
|
|
||||||
code.jg(pass);
|
|
||||||
break;
|
|
||||||
case IR::Cond::LE: // z | (n != v)
|
|
||||||
code.add(al, 0x7F);
|
|
||||||
code.sahf();
|
|
||||||
code.jle(pass);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ASSERT_MSG(false, "Unknown cond {}", static_cast<size_t>(cond));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pass;
|
|
||||||
}
|
|
||||||
|
|
||||||
EmitX64::BlockDescriptor EmitX64::RegisterBlock(const IR::LocationDescriptor& descriptor, CodePtr entrypoint, CodePtr entrypoint_far, size_t size) {
|
|
||||||
PerfMapRegister(entrypoint, code.getCurr(), LocationDescriptorToFriendlyName(descriptor));
|
|
||||||
code.SwitchToFarCode();
|
|
||||||
PerfMapRegister(entrypoint_far, code.getCurr(), LocationDescriptorToFriendlyName(descriptor) + "_far");
|
|
||||||
code.SwitchToNearCode();
|
|
||||||
Patch(descriptor, entrypoint);
|
|
||||||
|
|
||||||
BlockDescriptor block_desc{entrypoint, size};
|
|
||||||
block_descriptors.emplace(descriptor.Value(), block_desc);
|
|
||||||
return block_desc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::EmitTerminal(IR::Terminal terminal, IR::LocationDescriptor initial_location, bool is_single_step) {
|
|
||||||
Common::VisitVariant<void>(terminal, [this, initial_location, is_single_step](auto x) {
|
|
||||||
using T = std::decay_t<decltype(x)>;
|
|
||||||
if constexpr (!std::is_same_v<T, IR::Term::Invalid>) {
|
|
||||||
this->EmitTerminalImpl(x, initial_location, is_single_step);
|
|
||||||
} else {
|
|
||||||
ASSERT_MSG(false, "Invalid terminal");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::Patch(const IR::LocationDescriptor& target_desc, CodePtr target_code_ptr) {
|
|
||||||
const CodePtr save_code_ptr = code.getCurr();
|
|
||||||
const PatchInformation& patch_info = patch_information[target_desc];
|
|
||||||
|
|
||||||
for (CodePtr location : patch_info.jg) {
|
|
||||||
code.SetCodePtr(location);
|
|
||||||
EmitPatchJg(target_desc, target_code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CodePtr location : patch_info.jmp) {
|
|
||||||
code.SetCodePtr(location);
|
|
||||||
EmitPatchJmp(target_desc, target_code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (CodePtr location : patch_info.mov_rcx) {
|
|
||||||
code.SetCodePtr(location);
|
|
||||||
EmitPatchMovRcx(target_code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
code.SetCodePtr(save_code_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::Unpatch(const IR::LocationDescriptor& target_desc) {
|
|
||||||
Patch(target_desc, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::ClearCache() {
|
|
||||||
block_descriptors.clear();
|
|
||||||
patch_information.clear();
|
|
||||||
|
|
||||||
PerfMapClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmitX64::InvalidateBasicBlocks(const tsl::robin_set<IR::LocationDescriptor>& locations) {
|
|
||||||
code.EnableWriting();
|
|
||||||
SCOPE_EXIT { code.DisableWriting(); };
|
|
||||||
|
|
||||||
for (const auto &descriptor : locations) {
|
|
||||||
const auto it = block_descriptors.find(descriptor);
|
|
||||||
if (it == block_descriptors.end()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (patch_information.count(descriptor)) {
|
|
||||||
Unpatch(descriptor);
|
|
||||||
}
|
|
||||||
block_descriptors.erase(it);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Dynarmic::Backend::X64
|
|