mirror of
https://github.com/dingusdev/dingusppc.git
synced 2026-12-01 06:23:18 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee838f0519 |
No files matched your search
+219
-239
@@ -4,282 +4,262 @@ on:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
permissions:
|
||||
contents: read
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
jobs:
|
||||
build-linux:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
|
||||
# You can convert this to a matrix build if you need cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache/linux
|
||||
key: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: linux-ccache-${{ runner.os }}-${{ env.BUILD_TYPE }}-
|
||||
- name: Install dependencies
|
||||
- uses: actions/checkout@v3
|
||||
- name: install_dependencies
|
||||
run: |
|
||||
sudo apt-get update -y -qq
|
||||
sudo apt-get install -y -qq libsdl2-dev ninja-build ccache
|
||||
sudo apt-get install libsdl2-dev
|
||||
- name: init_submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Configure CMake
|
||||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache/linux
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
run: cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON
|
||||
- name: Build
|
||||
# Build your program with the given configuration
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
||||
- name: ccache stats
|
||||
run: ccache --show-stats || true
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DingusPPC-LINUX
|
||||
path: ${{github.workspace}}/build/bin
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: logs-${{ github.job }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: DingusPPC-LINUX
|
||||
path: ${{github.workspace}}/build/bin
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
|
||||
build-macos:
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- runner: macos-latest
|
||||
arch: arm64
|
||||
brew_prefix: /opt/homebrew
|
||||
- runner: macos-15-intel
|
||||
arch: x86_64
|
||||
brew_prefix: /usr/local
|
||||
runs-on: ${{ matrix.runner }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
|
||||
key: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: macos-${{ matrix.runner }}-${{ matrix.arch }}-ccache-${{ env.BUILD_TYPE }}-
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
export HOMEBREW_NO_AUTO_UPDATE=1
|
||||
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
||||
brew install sdl2 ccache ninja
|
||||
- name: Configure CMake
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache/${{ matrix.arch }}
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
run: |
|
||||
export PATH="${{ matrix.brew_prefix }}/opt/ccache/libexec:$PATH"
|
||||
cmake -S . -B ${{github.workspace}}/build -GNinja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_ARCHITECTURES=${{ matrix.arch }}
|
||||
- name: Build
|
||||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
|
||||
- name: ccache stats
|
||||
run: ccache --show-stats || true
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: logs-${{ github.job }}-${{ matrix.arch }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: DingusPPC-macOS-${{ matrix.arch }}
|
||||
path: ${{github.workspace}}/build/bin
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
|
||||
build-windows-msys2:
|
||||
run: ctest -C ${{env.BUILD_TYPE}}
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
cache-name: [msys64-cache]
|
||||
env:
|
||||
MSYSTEM: MINGW64
|
||||
FF_SCRIPT_SECTIONS: '0'
|
||||
CONFIGURE_ARGS: '--target-list=x86_64-softmmu --without-default-devices -Ddebug=false -Doptimization=0'
|
||||
TEST_ARGS: '--no-suite qtest'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Cache ccache
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache/msys
|
||||
key: windows-msys-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: windows-msys-ccache-${{ env.BUILD_TYPE }}-
|
||||
- name: Setup MSYS2
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
msystem: MINGW64
|
||||
update: true
|
||||
install: >-
|
||||
cmake
|
||||
ninja
|
||||
git
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-gcc
|
||||
mingw-w64-x86_64-binutils
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-pkgconf
|
||||
mingw-w64-x86_64-SDL2
|
||||
mingw-w64-x86_64-ccache
|
||||
uses: actions/checkout@v2
|
||||
- name: Set up MSYS2
|
||||
run: |
|
||||
Write-Output "Acquiring msys2.exe installer at $(Get-Date -Format u)"
|
||||
If ( !(Test-Path -Path msys64\var\cache ) ) {
|
||||
mkdir msys64\var\cache
|
||||
}
|
||||
Invoke-WebRequest "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe.sig" -outfile "msys2.exe.sig"
|
||||
if ( Test-Path -Path msys64\var\cache\msys2.exe.sig ) {
|
||||
Write-Output "Cached installer sig" ;
|
||||
if ( ((Get-FileHash msys2.exe.sig).Hash -ne (Get-FileHash msys64\var\cache\msys2.exe.sig).Hash) ) {
|
||||
Write-Output "Mis-matched installer sig, new installer download required" ;
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe.sig ;
|
||||
if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe
|
||||
}
|
||||
} else {
|
||||
Write-Output "Matched installer sig, cached installer still valid"
|
||||
}
|
||||
} else {
|
||||
Write-Output "No cached installer sig, new installer download required" ;
|
||||
if ( Test-Path -Path msys64\var\cache\msys2.exe ) {
|
||||
Remove-Item -Path msys64\var\cache\msys2.exe
|
||||
}
|
||||
}
|
||||
if ( !(Test-Path -Path msys64\var\cache\msys2.exe ) ) {
|
||||
Write-Output "Fetching latest installer" ;
|
||||
Invoke-WebRequest "https://repo.msys2.org/distrib/msys2-x86_64-latest.sfx.exe" -outfile "msys64\var\cache\msys2.exe" ;
|
||||
Copy-Item -Path msys2.exe.sig -Destination msys64\var\cache\msys2.exe.sig
|
||||
} else {
|
||||
Write-Output "Using cached installer"
|
||||
}
|
||||
Write-Output "Invoking msys2.exe installer at $(Get-Date -Format u)"
|
||||
msys64\var\cache\msys2.exe -y
|
||||
((Get-Content -path .\msys64\etc\post-install\07-pacman-key.post -Raw) -replace '--refresh-keys', '--version') | Set-Content -Path .\msys64\etc\post-install\07-pacman-key.post
|
||||
.\msys64\usr\bin\bash -lc "sed -i 's/^CheckSpace/#CheckSpace/g' /etc/pacman.conf"
|
||||
.\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Core update
|
||||
.\msys64\usr\bin\bash -lc 'pacman --noconfirm -Syuu' # Normal update
|
||||
taskkill /F /FI "MODULES eq msys-2.0.dll"
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
Write-Output "Installing mingw packages at $(Get-Date -Format u)"
|
||||
.\msys64\usr\bin\bash -lc 'pacman -Sy --noconfirm --needed \
|
||||
bison \
|
||||
diffutils \
|
||||
flex \
|
||||
tar \
|
||||
doxygen \
|
||||
cmake \
|
||||
wget \
|
||||
git \
|
||||
grep \
|
||||
make \
|
||||
rsync \
|
||||
ninja \
|
||||
glib2-devel \
|
||||
patch \
|
||||
sed \
|
||||
mingw-w64-x86_64-cmake \
|
||||
mingw-w64-x86_64-binutils \
|
||||
mingw-w64-x86_64-doxygen \
|
||||
mingw-w64-x86_64-capstone \
|
||||
mingw-w64-x86_64-ccache \
|
||||
mingw-w64-x86_64-curl \
|
||||
mingw-w64-x86_64-cyrus-sasl \
|
||||
mingw-w64-x86_64-dtc \
|
||||
mingw-w64-x86_64-gcc \
|
||||
mingw-w64-x86_64-glib2 \
|
||||
mingw-w64-x86_64-gnutls \
|
||||
mingw-w64-x86_64-gtk3 \
|
||||
mingw-w64-x86_64-libgcrypt \
|
||||
mingw-w64-x86_64-libjpeg-turbo \
|
||||
mingw-w64-x86_64-libnfs \
|
||||
mingw-w64-x86_64-libpng \
|
||||
mingw-w64-x86_64-libssh \
|
||||
mingw-w64-x86_64-libtasn1 \
|
||||
mingw-w64-x86_64-libusb \
|
||||
mingw-w64-x86_64-lzo2 \
|
||||
mingw-w64-x86_64-libslirp \
|
||||
mingw-w64-x86_64-nettle \
|
||||
mingw-w64-x86_64-clang \
|
||||
mingw-w64-x86_64-ninja \
|
||||
mingw-w64-x86_64-pixman \
|
||||
mingw-w64-x86_64-pkgconf \
|
||||
mingw-w64-x86_64-python \
|
||||
mingw-w64-x86_64-SDL2 \
|
||||
mingw-w64-x86_64-SDL2_image \
|
||||
mingw-w64-x86_64-snappy \
|
||||
mingw-w64-x86_64-spice \
|
||||
mingw-w64-x86_64-usbredir \
|
||||
mingw-w64-x86_64-zstd \
|
||||
mingw-w64-x86_64-make'
|
||||
- name: init_submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Build
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
echo "Running build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
export CHERE_INVOKING=yes
|
||||
export MSYS=winsymlinks:native
|
||||
export CCACHE_BASEDIR="${GITHUB_WORKSPACE}"
|
||||
export CCACHE_DIR="${GITHUB_WORKSPACE}/.ccache/msys"
|
||||
export CCACHE_DEPEND=1
|
||||
ccache --zero-stats || true
|
||||
cmake -S . -B build -GNinja -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
|
||||
ccache --show-stats || true
|
||||
echo "Finished build at $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
|
||||
- name: Test
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
Write-Output "Running build at $(Get-Date -Format u)"
|
||||
$env:CHERE_INVOKING = 'yes' # Preserve the current working directory
|
||||
$env:MSYS = 'winsymlinks:native' # Enable native Windows symlink
|
||||
$env:CCACHE_BASEDIR = "$env:CI_PROJECT_DIR"
|
||||
$env:CCACHE_DIR = "$env:CCACHE_BASEDIR/ccache"
|
||||
$env:CCACHE_MAXSIZE = "500M"
|
||||
$env:CCACHE_DEPEND = 1 # cache misses are too expensive with preprocessor mode
|
||||
$env:CC = "ccache gcc"
|
||||
mkdir build
|
||||
cd build
|
||||
ctest --output-on-failure --parallel
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: logs-${{ github.job }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: DingusPPC-MSYS
|
||||
path: ${{github.workspace}}/build/bin
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
D:\a\dingusppc\dingusppc\msys64\usr\bin\bash -lc "ccache --zero-stats"
|
||||
D:\a\dingusppc\dingusppc\msys64\usr\bin\bash -lc "cmake -DCMAKE_BUILD_TYPE=Release -DPPC_BUILD_PPC_TESTS=True .. && ninja"
|
||||
D:\a\dingusppc\dingusppc\msys64\usr\bin\bash -lc "ccache --show-stats"
|
||||
Write-Output "Finished build at $(Get-Date -Format u)"
|
||||
|
||||
build-windows-vsbuild:
|
||||
|
||||
vsbuild-CLANG:
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 45
|
||||
env:
|
||||
VCPKG_FEATURE_FLAGS: binarycaching
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: clang
|
||||
generator: Ninja
|
||||
cmake_args: -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl
|
||||
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
upload_suffix: CLANG
|
||||
- name: msvc
|
||||
generator: Ninja
|
||||
cmake_args: ""
|
||||
ccache_args: -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
upload_suffix: MSVC
|
||||
- name: msbuild
|
||||
generator: "Visual Studio 17 2022"
|
||||
cmake_args: ""
|
||||
ccache_args: ""
|
||||
upload_suffix: MSBUILD
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup msbuild
|
||||
uses: microsoft/setup-msbuild@v3
|
||||
- name: Install vcpkg packages
|
||||
if: inputs.configuration != 'CMake'
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
- name: Setup VCPKG
|
||||
run: |
|
||||
vcpkg integrate install
|
||||
vcpkg install pthread:x64-windows
|
||||
vcpkg install pthreads:x64-windows
|
||||
vcpkg install pthread-stubs:x64-windows
|
||||
vcpkg install pthreadpool:x64-windows
|
||||
vcpkg install
|
||||
- name: init_submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: '"%VCPKG_INSTALLATION_ROOT%\vcpkg.exe" install --triplet x64-windows'
|
||||
- name: Install Ninja
|
||||
if: matrix.generator == 'Ninja'
|
||||
run: choco install ninja -y
|
||||
- name: Cache ccache
|
||||
if: matrix.generator == 'Ninja'
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
|
||||
key: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-${{ hashFiles('**/CMakeLists.txt') }}
|
||||
restore-keys: vsbuild-${{ matrix.name }}-ccache-${{ env.BUILD_TYPE }}-
|
||||
- name: Install ccache
|
||||
if: matrix.generator == 'Ninja'
|
||||
run: choco install ccache -y
|
||||
- name: Configure & Build
|
||||
shell: cmd
|
||||
env:
|
||||
CCACHE_DIR: ${{ github.workspace }}/.ccache/vsbuild-${{ matrix.name }}
|
||||
CCACHE_BASEDIR: ${{ github.workspace }}
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DDPPC_68K_DEBUGGER=ON -DDPPC_BUILD_PPC_TESTS=ON ${{ matrix.ccache_args }} -DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ${{ matrix.cmake_args }}
|
||||
cmake --build build --config ${{ env.BUILD_TYPE }} --parallel
|
||||
- name: ccache stats
|
||||
if: matrix.generator == 'Ninja'
|
||||
shell: cmd
|
||||
run: |
|
||||
ccache --show-stats
|
||||
if %errorlevel% neq 0 echo ccache stats unavailable
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure
|
||||
- name: Upload logs on failure
|
||||
if: failure()
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: logs-${{ github.job }}-${{ matrix.name }}
|
||||
path: |
|
||||
${{ github.workspace }}/build/Testing/Temporary/LastTest.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeOutput.log
|
||||
${{ github.workspace }}/build/CMakeFiles/CMakeError.log
|
||||
if-no-files-found: ignore
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DPPC_BUILD_PPC_TESTS=True -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
|
||||
nmake
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v6
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DingusPPC-${{ matrix.upload_suffix }}
|
||||
name: DingusPPC-CLANG
|
||||
path: ${{github.workspace}}/build/bin
|
||||
|
||||
|
||||
|
||||
vsbuild-MSVC:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup msbuild
|
||||
if: inputs.configuration != 'CMake'
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
- name: Setup VCPKG
|
||||
run: |
|
||||
vcpkg integrate install
|
||||
vcpkg install pthread:x64-windows
|
||||
vcpkg install pthreads:x64-windows
|
||||
vcpkg install pthread-stubs:x64-windows
|
||||
vcpkg install pthreadpool:x64-windows
|
||||
vcpkg install
|
||||
- name: init_submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DPPC_BUILD_PPC_TESTS=True -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
|
||||
nmake
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DingusPPC-MSVC
|
||||
path: ${{github.workspace}}/build/bin
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vsbuild-MSVC-MSBUILD:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup msbuild
|
||||
if: inputs.configuration != 'CMake'
|
||||
uses: microsoft/setup-msbuild@v1
|
||||
- name: Setup VCPKG
|
||||
run: |
|
||||
vcpkg integrate install
|
||||
vcpkg install pthread:x64-windows
|
||||
vcpkg install pthreads:x64-windows
|
||||
vcpkg install pthread-stubs:x64-windows
|
||||
vcpkg install pthreadpool:x64-windows
|
||||
vcpkg install
|
||||
- name: init_submodules
|
||||
run: git submodule update --init --recursive
|
||||
- name: Build
|
||||
shell: cmd
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
call "%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
|
||||
cmake -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release -DPPC_BUILD_PPC_TESTS=True -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows ..
|
||||
msbuild dingusppc.sln
|
||||
- name: Upload artifact
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: DingusPPC-MSBUILD
|
||||
path: ${{github.workspace}}/build/bin
|
||||
retention-days: ${{ github.event_name == 'pull_request' && 7 || 30 }}
|
||||
+6
-60
@@ -138,16 +138,6 @@ endif()
|
||||
|
||||
file(GLOB TEST_SOURCES "${PROJECT_SOURCE_DIR}/cpu/ppc/test/*.cpp")
|
||||
|
||||
if (APPLE)
|
||||
add_executable(dingusppc MACOSX_BUNDLE ${SOURCES}
|
||||
$<TARGET_OBJECTS:core>
|
||||
$<TARGET_OBJECTS:cpu_ppc>
|
||||
$<TARGET_OBJECTS:debugger>
|
||||
$<TARGET_OBJECTS:devices>
|
||||
$<TARGET_OBJECTS:machines>
|
||||
$<TARGET_OBJECTS:utils>
|
||||
$<TARGET_OBJECTS:loguru>)
|
||||
else()
|
||||
add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:core>
|
||||
$<TARGET_OBJECTS:cpu_ppc>
|
||||
$<TARGET_OBJECTS:debugger>
|
||||
@@ -155,49 +145,9 @@ add_executable(dingusppc ${SOURCES} $<TARGET_OBJECTS:core>
|
||||
$<TARGET_OBJECTS:machines>
|
||||
$<TARGET_OBJECTS:utils>
|
||||
$<TARGET_OBJECTS:loguru>)
|
||||
endif()
|
||||
|
||||
# 2. Configure Apple-specific Bundle Properties
|
||||
if (APPLE)
|
||||
# Identify if we are targeting iOS or macOS
|
||||
if (IOS)
|
||||
set(BUNDLE_ID "com.dingusdev.dingusppc-ios")
|
||||
message(STATUS "Configuring for iOS Bundle")
|
||||
else()
|
||||
set(BUNDLE_ID "com.dingusdev.dingusppc")
|
||||
message(STATUS "Configuring for macOS Bundle")
|
||||
endif()
|
||||
|
||||
set_target_properties(dingusppc PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER "${BUNDLE_ID}"
|
||||
MACOSX_BUNDLE_BUNDLE_NAME "DingusPPC"
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION "alpha 1.0.4"
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING "a1.0.4"
|
||||
MACOSX_BUNDLE_EXECUTABLE_NAME "DingusPPC"
|
||||
# Placeholder for the icon file:
|
||||
# MACOSX_BUNDLE_ICON_FILE "icon.icns"
|
||||
)
|
||||
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(COREAUDIO_LIBRARY CoreAudio)
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
|
||||
target_link_libraries(dingusppc PRIVATE
|
||||
${COCOA_LIBRARY}
|
||||
${IOKIT_LIBRARY}
|
||||
${COREAUDIO_LIBRARY}
|
||||
${AUDIOTOOLBOX_LIBRARY}
|
||||
)
|
||||
|
||||
if (IOS)
|
||||
target_link_libraries(dingusppc PRIVATE "-framework Foundation" "-framework UIKit")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(dingusppc PRIVATE SDL2::SDL2 cubeb)
|
||||
target_compile_definitions(dingusppc PRIVATE SDL_MAIN_HANDLED)
|
||||
target_link_libraries(dingusppc PRIVATE SDL2::SDL2 SDL2::SDL2main cubeb)
|
||||
elseif (EMSCRIPTEN)
|
||||
target_link_libraries(dingusppc PRIVATE
|
||||
${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT}
|
||||
@@ -209,7 +159,7 @@ elseif (EMSCRIPTEN)
|
||||
"-s EXPORT_NAME=emulator"
|
||||
"-s 'EXTRA_EXPORTED_RUNTIME_METHODS=[\"FS\"]'")
|
||||
else()
|
||||
target_link_libraries(dingusppc PRIVATE SDL2::SDL2main SDL2::SDL2 cubeb
|
||||
target_link_libraries(dingusppc PRIVATE SDL2::SDL2 SDL2::SDL2main cubeb
|
||||
${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
@@ -233,10 +183,9 @@ if (DPPC_BUILD_PPC_TESTS)
|
||||
$<TARGET_OBJECTS:loguru>)
|
||||
|
||||
if (WIN32)
|
||||
target_link_libraries(testppc PRIVATE SDL2::SDL2 cubeb)
|
||||
target_compile_definitions(testppc PRIVATE SDL_MAIN_HANDLED)
|
||||
target_link_libraries(testppc PRIVATE SDL2::SDL2 SDL2::SDL2main cubeb)
|
||||
else()
|
||||
target_link_libraries(testppc PRIVATE SDL2::SDL2main SDL2::SDL2 cubeb
|
||||
target_link_libraries(testppc PRIVATE SDL2::SDL2 SDL2::SDL2main cubeb
|
||||
${CMAKE_DL_LIBS} ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
@@ -259,11 +208,8 @@ if (DPPC_BUILD_BENCHMARKS)
|
||||
$<TARGET_OBJECTS:utils>
|
||||
$<TARGET_OBJECTS:loguru>)
|
||||
|
||||
target_link_libraries(bench1 PRIVATE cubeb SDL2::SDL2 ${CMAKE_DL_LIBS}
|
||||
target_link_libraries(bench1 PRIVATE cubeb SDL2::SDL2 SDL2::SDL2main ${CMAKE_DL_LIBS}
|
||||
${CMAKE_THREAD_LIBS_INIT})
|
||||
if (WIN32)
|
||||
target_compile_definitions(bench1 PRIVATE SDL_MAIN_HANDLED)
|
||||
endif()
|
||||
|
||||
if (DPPC_68K_DEBUGGER)
|
||||
target_link_libraries(bench1 PRIVATE capstone)
|
||||
@@ -277,7 +223,7 @@ if (DPPC_BUILD_PPC_TESTS)
|
||||
"${PROJECT_SOURCE_DIR}/cpu/ppc/test/ppcinttests.csv"
|
||||
"${PROJECT_SOURCE_DIR}/cpu/ppc/test/ppcfloattests.csv"
|
||||
"${PROJECT_SOURCE_DIR}/cpu/ppc/test/ppcdisasmtest.csv"
|
||||
"$<TARGET_FILE_DIR:$<TARGET_PROPERTY:NAME>>")
|
||||
$<TARGET_FILE_DIR:${PROJECT_NAME}>)
|
||||
endif()
|
||||
|
||||
install (TARGETS dingusppc DESTINATION ${PROJECT_SOURCE_DIR}/build)
|
||||
+15
-17
@@ -4,10 +4,10 @@
|
||||
## Developers
|
||||
|
||||
- divingkatae
|
||||
- joevt
|
||||
- kkaisershot
|
||||
- maximumspatium
|
||||
- joevt
|
||||
- mihaip
|
||||
- kkaisershot
|
||||
|
||||
## NT4/PPC fork
|
||||
|
||||
@@ -15,23 +15,21 @@
|
||||
|
||||
## DevOps
|
||||
|
||||
- alicela1n
|
||||
- Cacodemon345
|
||||
- dressupgeekout
|
||||
- dyharlan
|
||||
- erichelgeson
|
||||
- jarz
|
||||
- kth5
|
||||
- leap0x7b
|
||||
- lefp
|
||||
- mathstuf
|
||||
- mrpapersonic
|
||||
- Randrianasulu
|
||||
- roytam1
|
||||
- sdkmap
|
||||
- seanm
|
||||
- Waqar144
|
||||
- webspacecreations
|
||||
- leap0x7b
|
||||
- sdkmap
|
||||
- dressupgeekout
|
||||
- kth5
|
||||
- dyharlan
|
||||
- roytam1
|
||||
- mrpapersonic
|
||||
- Randrianasulu
|
||||
- lefp
|
||||
- mathstuf
|
||||
- seanm
|
||||
- erichelgeson
|
||||
- alicela1n
|
||||
|
||||
## Testing
|
||||
|
||||
|
||||
@@ -6,17 +6,13 @@ Be warned the program is highly unfinished and could use a lot of testing. Any f
|
||||
|
||||
## Philosophy of Use
|
||||
|
||||
While many other PowerPC emus exist (PearPC, Sheepshaver), none of them currently attempt emulation of PowerPC Macs
|
||||
accurately (except for QEMU).
|
||||
While many other PowerPC emus exist (PearPC, Sheepshaver), none of them currently attempt emulation of PowerPC Macs accurately (except for QEMU).
|
||||
|
||||
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but
|
||||
also to provide a better debugging environment. This currently is designed to work best with PowerPC NuBus and Old
|
||||
World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
|
||||
This program aims to not only improve upon what Sheepshaver, PearPC, and other PowerPC Mac emulators have done, but also to provide a better debugging environment. This currently is designed to work best with PowerPC NuBus and Old World ROMs, including those of the Power Mac 6100, 7200, and G3 Beige.
|
||||
|
||||
## Implemented Features
|
||||
|
||||
Several machines have been implemented to varying degrees, like many Old World PowerPC Macs, early New World
|
||||
PowerPC Macs, and the Pippin.
|
||||
Several machines have been implemented to varying degrees, like many Old World PowerPC Macs, early New World PowerPC Macs, and the Pippin.
|
||||
|
||||
This emulator has a debugging environment, complete with a disassembler.
|
||||
|
||||
@@ -69,7 +65,6 @@ git clone https://github.com/dingusdev/dingusppc
|
||||
If this is from a mirror, replace the argument with the source you want to use instead.
|
||||
|
||||
You will also have to recursive clone or run
|
||||
|
||||
```
|
||||
git submodule update --init --recursive
|
||||
```
|
||||
@@ -82,43 +77,27 @@ For SDL2, Linux users may also have to run:
|
||||
sudo apt install libsdl2-dev
|
||||
```
|
||||
|
||||
macOS users can use Homebrew or MacPorts to install SDL2.
|
||||
|
||||
CLI11 and loguru are already included in the thirdparty folder and compiled along with the rest of DingusPPC.
|
||||
|
||||
For Raspbian, you may also need the following command:
|
||||
|
||||
```
|
||||
sudo apt install doxygen graphviz
|
||||
```
|
||||
|
||||
To build the project in a Unix-like environment, create a build folder, change the directory to the build folder,
|
||||
and use `cmake` to create the `Makefile` files in that build folder.
|
||||
Use `make` to do the building. You don't need to execute `cmake` again unless you add/remove/change options or
|
||||
source files.
|
||||
CLI11 and loguru are already included in the thirdparty folder and compiled along with the rest of DingusPPC.
|
||||
|
||||
For example, to build the project in a Unix-like environment, you will need to run
|
||||
the following commands in the OS terminal:
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
make dingusppc
|
||||
```
|
||||
You may specify another build type using the variable CMAKE_BUILD_TYPE.
|
||||
|
||||
You may specify another build type using the variable `CMAKE_BUILD_TYPE`.
|
||||
Each build type should have its own build folder.
|
||||
|
||||
For Raspbian, you may also need the following command:
|
||||
```
|
||||
mkdir build-debug
|
||||
cd build-debug
|
||||
cmake -DCMAKE_BUILD_TYPE=Debug ..
|
||||
make
|
||||
sudo apt install doxygen graphviz
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
DingusPPC includes a test suite for verifying the correctness of its PowerPC CPU
|
||||
emulation. To build the tests, use the following terminal commands:
|
||||
|
||||
```
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+5
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
~MouseEvent() = default;
|
||||
|
||||
uint32_t flags;
|
||||
int32_t xrel;
|
||||
int32_t yrel;
|
||||
uint32_t xrel;
|
||||
uint32_t yrel;
|
||||
uint32_t xabs;
|
||||
uint32_t yabs;
|
||||
uint8_t buttons_state;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -492,8 +492,6 @@ static int get_sdl_event_key_code(const SDL_KeyboardEvent &event, uint32_t kbd_l
|
||||
case SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INTERNATIONAL3):
|
||||
if (kbd_locale == Jpn_JPN)
|
||||
return AdbKey_JIS_Yen;
|
||||
else
|
||||
return -1;
|
||||
case SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INTERNATIONAL1):
|
||||
return AdbKey_JIS_Underscore;
|
||||
case 0XBC:
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-22 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+3
-13
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -156,13 +156,3 @@ uint64_t TimerManager::process_timers()
|
||||
// return time slice in nanoseconds until next timer's expiry
|
||||
return cur_timer->timeout_ns - time_now;
|
||||
}
|
||||
|
||||
void TimerManager::cancel_all_timers()
|
||||
{
|
||||
std::shared_ptr<TimerInfo> cur_timer;
|
||||
while (!this->timer_queue.empty()) {
|
||||
cur_timer = this->timer_queue.top();
|
||||
LOG_F(WARNING, "Canceling timer id:%u ns:%llu", cur_timer->id, cur_timer->timeout_ns);
|
||||
this->timer_queue.pop();
|
||||
}
|
||||
}
|
||||
+3
-6
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -51,8 +51,6 @@ class my_priority_queue : public std::priority_queue<T, Container, Compare> {
|
||||
public:
|
||||
bool remove_by_id(const uint32_t id){
|
||||
std::lock_guard<std::recursive_mutex> lk(mtx);
|
||||
if (this->empty())
|
||||
return false;
|
||||
auto el = this->top();
|
||||
if (el->id == id) {
|
||||
std::priority_queue<T, Container, Compare>::pop();
|
||||
@@ -134,7 +132,6 @@ public:
|
||||
uint32_t add_cyclic_timer(uint64_t interval, timer_cb cb);
|
||||
uint32_t add_cyclic_timer(uint64_t interval, uint64_t delay, timer_cb cb);
|
||||
void cancel_timer(uint32_t id);
|
||||
void cancel_all_timers();
|
||||
|
||||
uint64_t process_timers();
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+12
-12
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -259,9 +259,9 @@ const char* spr_index0[32] = {"mq", "xer", "", "", "rtcu", "rtcl", "de
|
||||
"", "sdr1", "srr0", "srr1", "", "", "", ""};
|
||||
|
||||
const char* spr_index8[32] = {
|
||||
"", "", "", "", "", "", "", "", "", "", "",
|
||||
"", "tbl_u", "tbu_u", "", "", "sprg0", "sprg1", "sprg2", "sprg3", "sprg4", "sprg5",
|
||||
"sprg6", "sprg7", "", "", "ear", "", "tbl", "tbu", "", "pvr"};
|
||||
"", "", "", "", "", "", "", "", "", "", "",
|
||||
"", "", "", "", "", "sprg0", "sprg1", "sprg2", "sprg3", "sprg4", "sprg5",
|
||||
"sprg6", "sprg7", "", "", "ear", "", "tbl", "tbu", "", "pvr"};
|
||||
|
||||
const char* spr_index16[32] = {
|
||||
"", "", "", "", "", "", "", "",
|
||||
@@ -1176,14 +1176,14 @@ void opc_group31(PPCDisasmContext* ctx) {
|
||||
if (!rs && !ra)
|
||||
opc_illegal(ctx);
|
||||
else {
|
||||
ctx->instr_str = my_sprintf("%-7s r%d", "tlbld", rb);
|
||||
ctx->instr_str = my_sprintf("%-7s r%s", "tlbld", rb);
|
||||
add_reg_in(ctx, "r%d", rb);
|
||||
}
|
||||
} else if (index == 31) { /* tlbli - 603 only */
|
||||
} else if (index == 30) { /* tlbli - 603 only */
|
||||
if (!rs && !ra)
|
||||
opc_illegal(ctx);
|
||||
else {
|
||||
ctx->instr_str = my_sprintf("%-7s r%d", "tlbli", rb);
|
||||
ctx->instr_str = my_sprintf("%-7s r%s", "tlbli", rb);
|
||||
add_reg_in(ctx, "r%d", rb);
|
||||
}
|
||||
}
|
||||
@@ -1250,10 +1250,10 @@ void opc_group31(PPCDisasmContext* ctx) {
|
||||
add_reg_out(ctx, "cr");
|
||||
}
|
||||
} else {
|
||||
if (index >= 16 || !strlen(opc_logic[index])) {
|
||||
strcpy(opcode, opc_logic[index]);
|
||||
if (!strlen(opcode)) {
|
||||
opc_illegal(ctx);
|
||||
} else {
|
||||
strcpy(opcode, opc_logic[index]);
|
||||
if (rc_set) {
|
||||
strcat(opcode, ".");
|
||||
add_reg_out(ctx, "cr");
|
||||
@@ -1394,9 +1394,9 @@ void opc_group31(PPCDisasmContext* ctx) {
|
||||
break;
|
||||
}
|
||||
|
||||
auto ref_spr = (((ctx->instr_code >> 11) & 31) << 5) | ((ctx->instr_code >> 16) & 31);
|
||||
auto spr_high = (ctx->instr_code >> 11) & 31;
|
||||
auto spr_low = (ctx->instr_code >> 16) & 31;
|
||||
auto ref_spr = (spr_high << 5) | spr_low;
|
||||
|
||||
switch (ext_opc) {
|
||||
case 0: /* cmp */
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-21 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+3
-4
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -106,7 +106,6 @@ enum SPR : int {
|
||||
SPRG1 = 273,
|
||||
SPRG2 = 274,
|
||||
SPRG3 = 275,
|
||||
EAR = 282,
|
||||
TBL_S = 284, // supervisor TBL
|
||||
TBU_S = 285, // supervisor TBU
|
||||
PVR = 287,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -161,8 +161,6 @@ void ppc_exception_handler(Except_Type exception_type, uint32_t srr1_bits) {
|
||||
exc_descriptor = "DSI/ISI exception: unmapped memory access";
|
||||
else if (ppc_state.spr[SPR::DSISR] & 0x08000000)
|
||||
exc_descriptor = "DSI/ISI exception: access protection violation";
|
||||
else if (ppc_state.spr[SPR::DSISR] & 0x00100000)
|
||||
exc_descriptor = "DSI exception: External access is disabled";
|
||||
else {
|
||||
if (exception_type == Except_Type::EXC_DSI)
|
||||
exc_descriptor = "DSI exception";
|
||||
|
||||
+3
-5
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -901,8 +901,6 @@ static map<string, int> SPRName2Num = {
|
||||
{"MMCR0", SPR::MMCR0}, {"PMC1", SPR::PMC1}, {"PMC2", SPR::PMC2},
|
||||
{"SDA", SPR::SDA}, {"SIA", SPR::SIA}, {"MMCR1", SPR::MMCR1},
|
||||
{"PMC3", SPR::PMC3}, {"PMC4", SPR::PMC4},
|
||||
// get value from supervisor index same as we do for SPR268 and SPR269
|
||||
{"TBL_U", SPR::TBL_S}, {"TBU_U", SPR::TBU_S},
|
||||
};
|
||||
|
||||
static uint64_t reg_op(string& reg_name, uint64_t val, bool is_write) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+7
-7
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -72,7 +72,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a]; \
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
|
||||
#define ppc_grab_regssab(opcode) \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
@@ -87,13 +87,13 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
int reg_a = (opcode >> 16) & 31; \
|
||||
int reg_b = (opcode >> 11) & 31; \
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a]; \
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
|
||||
#define ppc_grab_regsab(opcode) \
|
||||
int reg_a = (opcode >> 16) & 31;\
|
||||
int reg_b = (opcode >> 11) & 31;\
|
||||
uint32_t ppc_result_a = ppc_state.gpr[reg_a];\
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
uint32_t ppc_result_b = ppc_state.gpr[reg_b];
|
||||
|
||||
#define ppc_grab_regssa(opcode) \
|
||||
int reg_s = (opcode >> 21) & 31; \
|
||||
@@ -151,7 +151,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
int reg_b = (opcode >> 11) & 31;
|
||||
|
||||
#define GET_FPR(reg) \
|
||||
ppc_state.fpr[(reg)].dbl64_r
|
||||
ppc_state.fpr[(reg)].dbl64_r
|
||||
|
||||
#define FPR_INT(reg) \
|
||||
ppc_state.fpr[reg].int64_r
|
||||
|
||||
+6
-6
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -171,9 +171,9 @@ static inline uint8_t* calc_pteg_addr(uint32_t hash)
|
||||
|
||||
sdr1_val = ppc_state.spr[SPR::SDR1];
|
||||
|
||||
pteg_addr = (sdr1_val & 0xFFFF0000) |
|
||||
(((sdr1_val & 0x1FF) << 16) & ((hash & 0x7FC00) << 6)) |
|
||||
((hash & 0x3FF) << 6);
|
||||
pteg_addr = sdr1_val & 0xFE000000;
|
||||
pteg_addr |= (sdr1_val & 0x01FF0000) | (((sdr1_val & 0x1FF) << 16) & ((hash & 0x7FC00) << 6));
|
||||
pteg_addr |= (hash & 0x3FF) << 6;
|
||||
|
||||
if (pteg_addr >= last_ptab_area.start && pteg_addr <= last_ptab_area.end) {
|
||||
return last_ptab_area.mem_ptr + (pteg_addr - last_ptab_area.start);
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-21 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+21
-53
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -879,11 +879,13 @@ static void update_timebase(uint64_t mask, uint64_t new_val)
|
||||
tbr_wr_timestamp = get_virt_time_ns();
|
||||
}
|
||||
|
||||
|
||||
static uint32_t decrementer_timer_id = 0;
|
||||
|
||||
static void update_decrementer(bool update_time_stamp, uint32_t oldval, uint32_t newval);
|
||||
|
||||
static void trigger_decrementer_exception() {
|
||||
decrementer_timer_id = 0;
|
||||
dec_wr_value = -1;
|
||||
dec_wr_timestamp = get_virt_time_ns();
|
||||
if (ppc_state.msr & MSR::EE) {
|
||||
dec_exception_pending = false;
|
||||
//LOG_F(WARNING, "decrementer exception triggered");
|
||||
@@ -895,58 +897,27 @@ static void trigger_decrementer_exception() {
|
||||
}
|
||||
}
|
||||
|
||||
static void trigger_timed_decrementer_exception() {
|
||||
decrementer_timer_id = 0;
|
||||
uint32_t new_val = calc_dec_value();
|
||||
if (new_val >= 0 && new_val != uint32_t(-1)) {
|
||||
new_val = -1;
|
||||
}
|
||||
update_decrementer(true, new_val, new_val);
|
||||
trigger_decrementer_exception();
|
||||
}
|
||||
|
||||
static void trigger_immediate_decrementer_exception() {
|
||||
decrementer_timer_id = 0;
|
||||
update_decrementer(false, ppc_state.spr[SPR::DEC_S], ppc_state.spr[SPR::DEC_S]);
|
||||
trigger_decrementer_exception();
|
||||
}
|
||||
|
||||
static void update_decrementer(bool update_time_stamp, uint32_t oldval, uint32_t newval) {
|
||||
if (update_time_stamp) {
|
||||
dec_wr_value = newval;
|
||||
dec_wr_timestamp = get_virt_time_ns();
|
||||
}
|
||||
static void update_decrementer(uint32_t val) {
|
||||
dec_wr_value = val;
|
||||
dec_wr_timestamp = get_virt_time_ns();
|
||||
|
||||
dec_exception_pending = false;
|
||||
|
||||
if (decrementer_timer_id) {
|
||||
TimerManager::get_instance()->cancel_timer(decrementer_timer_id);
|
||||
}
|
||||
|
||||
if (bit_changed(oldval, newval, 31) && bit_set(newval, 31)) {
|
||||
decrementer_timer_id = TimerManager::get_instance()->add_immediate_timer(
|
||||
trigger_immediate_decrementer_exception
|
||||
);
|
||||
if (is_601)
|
||||
return;
|
||||
}
|
||||
|
||||
// A count of zero should timeout after one tick so add one to the count
|
||||
// but make sure the count doesn't overflow.
|
||||
if (is_601) {
|
||||
if (newval < uint32_t(-0x80))
|
||||
newval += 0x80;
|
||||
} else {
|
||||
if (newval < uint32_t(-1))
|
||||
newval += 1;
|
||||
if (decrementer_timer_id) {
|
||||
//LOG_F(WARNING, "decrementer cancel timer");
|
||||
TimerManager::get_instance()->cancel_timer(decrementer_timer_id);
|
||||
}
|
||||
|
||||
uint64_t time_out;
|
||||
uint32_t time_out_lo;
|
||||
_u32xu64(newval, tbr_period_ns, time_out, time_out_lo);
|
||||
//LOG_F(WARNING, "new decrementer value: 0x%08X, interrupt after %llu ns", newval, time_out);
|
||||
_u32xu64(val, tbr_period_ns, time_out, time_out_lo);
|
||||
//LOG_F(WARNING, "decrementer:0x%08X ns:%llu", val, time_out);
|
||||
decrementer_timer_id = TimerManager::get_instance()->add_oneshot_timer(
|
||||
time_out,
|
||||
trigger_timed_decrementer_exception
|
||||
trigger_decrementer_exception
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1002,7 +973,6 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
|
||||
ppc_state.gpr[reg_d] = ppc_state.spr[SPR::DEC_S] = val;
|
||||
break;
|
||||
}
|
||||
case SPR::TBL_U:
|
||||
case SPR::TBL_S: {
|
||||
uint64_t tbr_value = calc_tbr_value();
|
||||
ppc_state.gpr[reg_d] =
|
||||
@@ -1010,7 +980,6 @@ void dppc_interpreter::ppc_mfspr(uint32_t opcode) {
|
||||
ppc_state.spr[TBU_S] = uint32_t(tbr_value >> 32);
|
||||
break;
|
||||
}
|
||||
case SPR::TBU_U:
|
||||
case SPR::TBU_S: {
|
||||
uint64_t tbr_value = calc_tbr_value();
|
||||
ppc_state.gpr[reg_d] =
|
||||
@@ -1076,8 +1045,8 @@ void dppc_interpreter::ppc_mtspr(uint32_t opcode) {
|
||||
case SPR::DEC_S:
|
||||
if (is_601)
|
||||
val &= ~0x7F;
|
||||
update_decrementer(true, calc_dec_value(), val);
|
||||
ppc_state.spr[SPR::DEC_S] = val;
|
||||
ppc_state.spr[DEC_S] = val;
|
||||
update_decrementer(val);
|
||||
break;
|
||||
case SPR::TBL_S:
|
||||
update_timebase(0xFFFFFFFF00000000ULL, val);
|
||||
@@ -2041,7 +2010,7 @@ void dppc_interpreter::ppc_eciwx(uint32_t opcode) {
|
||||
uint32_t ear_enable = 0x80000000;
|
||||
|
||||
// error if EAR[E] != 1
|
||||
if (!(ppc_state.spr[SPR::EAR] & ear_enable)) {
|
||||
if (!(ppc_state.spr[282] && ear_enable)) {
|
||||
ppc_exception_handler(Except_Type::EXC_DSI, 0x0);
|
||||
}
|
||||
|
||||
@@ -2061,8 +2030,7 @@ void dppc_interpreter::ppc_ecowx(uint32_t opcode) {
|
||||
uint32_t ear_enable = 0x80000000;
|
||||
|
||||
// error if EAR[E] != 1
|
||||
if (!(ppc_state.spr[SPR::EAR] & ear_enable)) {
|
||||
ppc_state.spr[SPR::DSISR] = 0x00100000;
|
||||
if (!(ppc_state.spr[282] && ear_enable)) {
|
||||
ppc_exception_handler(Except_Type::EXC_DSI, 0x0);
|
||||
}
|
||||
|
||||
|
||||
@@ -407,10 +407,6 @@
|
||||
0xFFF00100,0x7D453D2A,stswx,r10,r5,r7
|
||||
0xFFF00100,0x7C0002E4,tlbia
|
||||
0xFFF00100,0x7C004A64,tlbie,r9
|
||||
0xFFF00100,0x7C202FA4,tlbld,r5
|
||||
0xFFF00100,0x7C6007A4,tlbld,r0
|
||||
0xFFF00100,0x7C203FE4,tlbli,r7
|
||||
0xFFF00100,0x7C40FFE4,tlbli,r31
|
||||
|
||||
# various simplified (extended) mnemonics
|
||||
0xFFF00100,0x60000000,nop
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-21 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
+9
-48
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -425,54 +425,21 @@ static void patch_mem(string& params) {
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t disasm(PPCDisasmContext &ctx) {
|
||||
ctx.instr_code = READ_DWORD_BE_A(mmu_translate_imem(ctx.instr_addr));
|
||||
cout << COUT08X << ctx.instr_addr;
|
||||
cout << ": " << COUT08X << ctx.instr_code;
|
||||
cout << " " << disassemble_single(&ctx) << setfill(' ') << right << dec;
|
||||
return ctx.instr_addr;
|
||||
}
|
||||
|
||||
static uint32_t disasm(uint32_t count, uint32_t address) {
|
||||
PPCDisasmContext ctx;
|
||||
|
||||
ctx.instr_addr = address;
|
||||
ctx.simplified = true;
|
||||
|
||||
for (int i = 0; power_on && i < count; i++) {
|
||||
disasm(ctx);
|
||||
cout << endl;
|
||||
ctx.instr_code = READ_DWORD_BE_A(mmu_translate_imem(ctx.instr_addr));
|
||||
cout << COUT08X << ctx.instr_addr;
|
||||
cout << ": " << COUT08X << ctx.instr_code;
|
||||
cout << " " << disassemble_single(&ctx) << setfill(' ') << right << endl;
|
||||
}
|
||||
return ctx.instr_addr;
|
||||
}
|
||||
|
||||
static void disasm_in(PPCDisasmContext &ctx, uint32_t address) {
|
||||
ctx.instr_addr = address;
|
||||
ctx.simplified = true;
|
||||
disasm(ctx);
|
||||
if (ctx.regs_in.size() > 0 || ctx.regs_out.size() > 0) {
|
||||
if (ctx.instr_str.length() < 28)
|
||||
cout << setw(28 - (int)ctx.instr_str.length()) << " ";
|
||||
cout << " ;";
|
||||
if (ctx.regs_in.size() > 0) {
|
||||
cout << " in{" << COUTX;
|
||||
for (auto & reg_name : ctx.regs_in) {
|
||||
cout << " " << reg_name << ":" << get_reg(reg_name);
|
||||
}
|
||||
cout << " }" << dec;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void disasm_out(PPCDisasmContext &ctx) {
|
||||
if (ctx.regs_out.size() > 0) {
|
||||
cout << " out{" << COUTX;
|
||||
for (auto & reg_name : ctx.regs_out) {
|
||||
cout << " " << reg_name << ":" << get_reg(reg_name);
|
||||
}
|
||||
cout << " }" << dec;
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
static void print_gprs() {
|
||||
string reg_name;
|
||||
int i;
|
||||
@@ -786,9 +753,6 @@ void DppcDebugger::enter_debugger() {
|
||||
delete_prompt();
|
||||
}
|
||||
for (; --count >= 0;) {
|
||||
addr_str = "R24";
|
||||
addr = static_cast<uint32_t>(get_reg(addr_str) - 2);
|
||||
disasm_68k(1, addr);
|
||||
exec_single_68k();
|
||||
}
|
||||
#endif
|
||||
@@ -798,10 +762,7 @@ void DppcDebugger::enter_debugger() {
|
||||
}
|
||||
for (; --count >= 0;) {
|
||||
addr = ppc_state.pc;
|
||||
PPCDisasmContext ctx;
|
||||
disasm_in(ctx, addr);
|
||||
ppc_exec_single();
|
||||
disasm_out(ctx);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "next" || cmd == "ni") {
|
||||
|
||||
+3
-3
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -35,9 +35,9 @@ void AdbAppleJack::event_handler(const GamepadEvent& event) {
|
||||
uint32_t button_bit = 1 << event.button;
|
||||
|
||||
if (event.flags & GAMEPAD_EVENT_DOWN)
|
||||
this->aj_buttons_state |= button_bit;
|
||||
this->buttons_state |= button_bit;
|
||||
else if (event.flags & GAMEPAD_EVENT_UP)
|
||||
this->aj_buttons_state &= ~button_bit;
|
||||
this->buttons_state &= ~button_bit;
|
||||
|
||||
if (button_bit & ((1 << GamepadButton::LeftTrigger) | (1 << GamepadButton::RightTrigger)))
|
||||
this->triggers_changed = true;
|
||||
@@ -47,7 +47,7 @@ void AdbAppleJack::event_handler(const GamepadEvent& event) {
|
||||
|
||||
void AdbAppleJack::reset() {
|
||||
this->AdbMouse::reset();
|
||||
this->aj_buttons_state = 0;
|
||||
this->buttons_state = 0;
|
||||
this->triggers_changed = false;
|
||||
this->buttons_changed = false;
|
||||
LOG_F(INFO, "%s: reset; in mouse emulation mode", this->name.c_str());
|
||||
@@ -58,16 +58,16 @@ bool AdbAppleJack::get_register_0() {
|
||||
|
||||
uint8_t mouse_buttons = this->AdbMouse::get_buttons_state();
|
||||
// AppleJack triggers always affect the mouse button bits.
|
||||
mouse_buttons |= (this->aj_buttons_state >> (GamepadButton::LeftTrigger - 0)) & 1;
|
||||
mouse_buttons |= (this->aj_buttons_state >> (GamepadButton::RightTrigger - 1)) & 2;
|
||||
mouse_buttons |= (this->buttons_state >> (GamepadButton::LeftTrigger - 0)) & 1;
|
||||
mouse_buttons |= (this->buttons_state >> (GamepadButton::RightTrigger - 1)) & 2;
|
||||
changed |= this->AdbMouse::get_register_0(mouse_buttons, changed);
|
||||
this->triggers_changed = false;
|
||||
|
||||
if (this->dev_handler_id == APPLEJACK_HANDLER_ID && this->buttons_changed) {
|
||||
uint8_t* out_buf = this->host_obj->get_output_buf();
|
||||
|
||||
out_buf[2] = uint8_t(~this->aj_buttons_state >> 8);
|
||||
out_buf[3] = ~this->aj_buttons_state & 0xFF;
|
||||
out_buf[2] = ~this->buttons_state >> 8;
|
||||
out_buf[3] = ~this->buttons_state & 0xFF;
|
||||
|
||||
this->host_obj->set_output_count(4);
|
||||
this->buttons_changed = false;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
void set_register_3() override;
|
||||
|
||||
private:
|
||||
uint32_t aj_buttons_state = 0;
|
||||
uint32_t buttons_state = 0;
|
||||
bool triggers_changed = false;
|
||||
bool buttons_changed = false;
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -38,7 +38,6 @@ enum {
|
||||
ADB_STAT_SRQ_ACTIVE = 1 << 0,
|
||||
ADB_STAT_TIMEOUT = 1 << 1,
|
||||
ADB_STAT_AUTOPOLL = 1 << 6,
|
||||
ADB_STAT_RESPONSE = 1 << 7,
|
||||
};
|
||||
|
||||
class AdbDevice; // forward declaration to prevent compiler errors
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -66,7 +66,7 @@ void AdbMouse::reset() {
|
||||
this->changed = false;
|
||||
}
|
||||
|
||||
bool AdbMouse::get_register_0(uint8_t buttons, bool force) {
|
||||
bool AdbMouse::get_register_0(uint8_t buttons_state, bool force) {
|
||||
bool should_update = this->x_rel || this->y_rel || this->changed || force;
|
||||
|
||||
if (should_update) {
|
||||
@@ -84,7 +84,7 @@ bool AdbMouse::get_register_0(uint8_t buttons, bool force) {
|
||||
num_bits = this->num_bits;
|
||||
total_bits = std::max(buttons_to_bits[this->num_buttons], bits_to_bits[num_bits]);
|
||||
}
|
||||
buttons = ~buttons;
|
||||
uint8_t buttons_state = ~this->buttons_state;
|
||||
|
||||
for (int axis = 0; axis < 2; axis++) {
|
||||
int bits = num_bits;
|
||||
@@ -100,7 +100,7 @@ bool AdbMouse::get_register_0(uint8_t buttons, bool force) {
|
||||
bits = 7;
|
||||
|
||||
while (bits_remaining > 0) {
|
||||
*p = uint8_t((val & ((1 << bits) - 1)) | (((buttons >> button) & 1) << bits) | (*p << (bits + 1)));
|
||||
*p = (val & ((1 << bits) - 1)) | (((buttons_state >> button) & 1) << bits) | (*p << (bits + 1));
|
||||
val >>= bits;
|
||||
bits_remaining -= bits;
|
||||
p = bits == 7 ? &out_buf[2] : p + 1;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -70,7 +70,7 @@ enum DeviceClass {
|
||||
void set_register_3() override;
|
||||
|
||||
protected:
|
||||
bool get_register_0(uint8_t buttons, bool force);
|
||||
bool get_register_0(uint8_t buttons_state, bool force);
|
||||
uint8_t get_buttons_state() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -116,7 +116,7 @@ void AtapiCdrom::perform_packet_command() {
|
||||
this->status_good();
|
||||
this->present_status();
|
||||
break;
|
||||
case ScsiCommand::READ_CAPACITY:
|
||||
case ScsiCommand::READ_CAPACITY_10:
|
||||
this->xfer_cnt = this->report_capacity(this->data_buf);
|
||||
this->r_byte_count = this->xfer_cnt;
|
||||
this->data_ptr = (uint16_t*)this->data_buf;
|
||||
@@ -395,11 +395,11 @@ uint16_t AtapiCdrom::get_data() {
|
||||
if (this->current_block_byte >= area_start && this->current_block_byte < area_end) {
|
||||
AddrMsf msf = lba_to_msf(this->current_block + 150);
|
||||
uint8_t header[4]{
|
||||
(uint8_t)msf.min,
|
||||
(uint8_t)msf.sec,
|
||||
(uint8_t)msf.frm,
|
||||
(uint8_t)msf.min,
|
||||
(uint8_t)msf.sec,
|
||||
(uint8_t)msf.frm,
|
||||
0x01 // Mode 1
|
||||
};
|
||||
};
|
||||
ret_data = BYTESWAP_16(*((uint16_t*)(&header[current_block_byte - area_start])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-21 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-23 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -37,7 +37,7 @@ using namespace MeshScsi;
|
||||
int MeshController::device_postinit() {
|
||||
this->bus_obj = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("ScsiMesh"));
|
||||
if (bus_obj) {
|
||||
bus_obj->register_device(7, static_cast<ScsiPhysDevice*>(this));
|
||||
bus_obj->register_device(7, static_cast<ScsiDevice*>(this));
|
||||
bus_obj->attach_scsi_devices("2");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -33,7 +33,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <cinttypes>
|
||||
#include <cstring>
|
||||
|
||||
Sc53C94::Sc53C94(uint8_t chip_id, uint8_t my_id) : ScsiPhysDevice("SC53C94", my_id), DmaDevice()
|
||||
Sc53C94::Sc53C94(uint8_t chip_id, uint8_t my_id) : ScsiDevice("SC53C94", my_id), DmaDevice()
|
||||
{
|
||||
this->chip_id = chip_id;
|
||||
this->my_bus_id = my_id;
|
||||
@@ -45,7 +45,7 @@ int Sc53C94::device_postinit()
|
||||
{
|
||||
ScsiBus* bus = dynamic_cast<ScsiBus*>(gMachineObj->get_comp_by_name("ScsiCurio"));
|
||||
if (bus) {
|
||||
bus->register_device(7, static_cast<ScsiPhysDevice*>(this));
|
||||
bus->register_device(7, static_cast<ScsiDevice*>(this));
|
||||
bus->attach_scsi_devices("");
|
||||
}
|
||||
|
||||
@@ -560,6 +560,7 @@ void Sc53C94::sequencer()
|
||||
this->bus_obj->target_xfer_data();
|
||||
break;
|
||||
case SeqState::CMD_COMPLETE:
|
||||
this->int_status = INTSTAT_SR | INTSTAT_SO;
|
||||
this->cur_state = SeqState::IDLE;
|
||||
this->update_irq();
|
||||
exec_next_command();
|
||||
@@ -582,6 +583,7 @@ void Sc53C94::sequencer()
|
||||
this->channel_obj->xfer_retry();
|
||||
break;
|
||||
}
|
||||
this->bus_obj->negotiate_xfer(this->data_fifo_pos, this->bytes_out);
|
||||
this->cur_state = SeqState::RCV_DATA;
|
||||
this->rcv_data();
|
||||
if (!(this->is_dma_cmd)) {
|
||||
@@ -625,6 +627,7 @@ void Sc53C94::sequencer()
|
||||
break;
|
||||
case SeqState::RCV_STATUS:
|
||||
case SeqState::RCV_MESSAGE:
|
||||
this->bus_obj->negotiate_xfer(this->data_fifo_pos, this->bytes_out);
|
||||
this->rcv_data();
|
||||
if (this->is_initiator) {
|
||||
if (this->cur_state == SeqState::RCV_STATUS) {
|
||||
@@ -637,7 +640,6 @@ void Sc53C94::sequencer()
|
||||
} else if (this->cur_state == SeqState::RCV_MESSAGE) {
|
||||
this->bus_obj->assert_ctrl_line(this->my_bus_id, SCSI_CTRL_ACK);
|
||||
if (this->cur_cmd == CMD_COMPLETE_STEPS) {
|
||||
this->int_status = INTSTAT_SO;
|
||||
this->cur_state = SeqState::CMD_COMPLETE;
|
||||
this->sequencer();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -194,7 +194,7 @@ typedef struct {
|
||||
|
||||
typedef std::function<void(const uint8_t drq_state)> DrqCb;
|
||||
|
||||
class Sc53C94 : public ScsiPhysDevice, public DmaDevice {
|
||||
class Sc53C94 : public ScsiDevice, public DmaDevice {
|
||||
public:
|
||||
Sc53C94(uint8_t chip_id=12, uint8_t my_id=7);
|
||||
~Sc53C94() = default;
|
||||
@@ -234,8 +234,10 @@ public:
|
||||
this->drq_cb = cb;
|
||||
}
|
||||
|
||||
// ScsiPhysDevice methods
|
||||
// ScsiDevice methods
|
||||
void notify(ScsiNotification notif_type, int param) override;
|
||||
bool prepare_data() override { return false; }
|
||||
bool get_more_data() override { return false; }
|
||||
bool has_data() override { return this->data_fifo_pos != 0; }
|
||||
int send_data(uint8_t* dst_ptr, int count) override;
|
||||
void process_command() override {}
|
||||
|
||||
+36
-109
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,7 +25,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#define SCSI_H
|
||||
|
||||
#include <devices/common/hwcomponent.h>
|
||||
#include <devices/common/scsi/scsiphysinterface.h>
|
||||
|
||||
#include <array>
|
||||
#include <cinttypes>
|
||||
@@ -121,7 +120,7 @@ enum ScsiCommand : uint8_t {
|
||||
DIAG_RESULTS = 0x1C,
|
||||
SEND_DIAGS = 0x1D,
|
||||
PREVENT_ALLOW_MEDIUM_REMOVAL = 0x1E,
|
||||
READ_CAPACITY = 0x25,
|
||||
READ_CAPACITY_10 = 0x25,
|
||||
READ_10 = 0x28,
|
||||
WRITE_10 = 0x2A,
|
||||
SEEK_10 = 0x2B,
|
||||
@@ -144,9 +143,15 @@ enum ScsiCommand : uint8_t {
|
||||
READ_TOC = 0x43,
|
||||
SET_CD_SPEED = 0xBB,
|
||||
READ_CD = 0xBE,
|
||||
|
||||
// vendor specific commands
|
||||
VENDOR_09 = 0x09,
|
||||
EJECT = 0xC0,
|
||||
READ_CDDA = 0xD8, //TOSHIBA
|
||||
READ_CDDA_MSF = 0xD9, //TOSHIBA
|
||||
};
|
||||
|
||||
enum ScsiSense : uint8_t {
|
||||
enum ScsiSense : int {
|
||||
NO_SENSE = 0x0,
|
||||
RECOVERED = 0x1,
|
||||
NOT_READY = 0x2,
|
||||
@@ -161,7 +166,7 @@ enum ScsiSense : uint8_t {
|
||||
COMPLETED = 0xF
|
||||
};
|
||||
|
||||
enum ScsiError : uint8_t {
|
||||
enum ScsiError : int {
|
||||
NO_ERROR = 0x00,
|
||||
NO_SECTOR = 0x01,
|
||||
WRITE_FAULT = 0x03,
|
||||
@@ -175,57 +180,6 @@ enum ScsiError : uint8_t {
|
||||
MEDIUM_NOT_PRESENT = 0x3A,
|
||||
};
|
||||
|
||||
/** SCSI device types used in INQUIRY. */
|
||||
namespace ScsiDevType {
|
||||
enum : uint8_t {
|
||||
DIRECT_ACCESS = 0,
|
||||
SEQ_ACCESS = 1,
|
||||
PRINTER = 2,
|
||||
PROCESSOR = 3,
|
||||
WRITE_ONCE = 4,
|
||||
CD_ROM = 5,
|
||||
SCANNER = 6,
|
||||
OPT_MEMORY = 7,
|
||||
MEDIUM_CHANGER = 8,
|
||||
COMMUNICATION = 9,
|
||||
UNKNOWN = 0x1F
|
||||
};
|
||||
};
|
||||
|
||||
/** SCSI device capacity flags. */
|
||||
enum : uint8_t {
|
||||
CAP_REL_ADDR = 1 << 7, // device supports relative addressing
|
||||
CAP_W32_XFER = 1 << 6, // device supports 32-bit wide transfers
|
||||
CAP_W16_XFER = 1 << 5, // device supports 16-bit wide transfers
|
||||
CAP_SYNC_XFER = 1 << 4, // device supports synchronous transfers
|
||||
CAP_LINKED_CMDS = 1 << 3, // device supports linked commands
|
||||
CAP_CMD_QUEUE = 1 << 1, // device supports command queuing
|
||||
CAP_CMD_SRST = 1 << 0, // device supports soft resets
|
||||
};
|
||||
|
||||
/** Page control values for MODE SENSE. */
|
||||
namespace PageControl {
|
||||
enum : uint8_t {
|
||||
CURRENT_VALUES = 0,
|
||||
CHANGEABLE_VALUES = 1,
|
||||
DEFAULT_VALUES = 2,
|
||||
SAVED_VALUES = 3
|
||||
};
|
||||
};
|
||||
|
||||
/** Page numbers for MODE SENSE and MODE SELECT. */
|
||||
enum ModePage : uint8_t {
|
||||
ERROR_RECOVERY = 0x1,
|
||||
DEV_FORMAT_PARAMS = 0x3,
|
||||
RIGID_DISK_GEOMETRY = 0x4,
|
||||
CDROM_PARAMS = 0xD,
|
||||
CDROM_AUDIO = 0xE,
|
||||
POWER_CONDITION = 0x1A,
|
||||
CDROM_CAPABILITIES = 0x2A,
|
||||
VENDOR_PAGE_31 = 0x31,
|
||||
ALL_PAGES = 0x3F,
|
||||
};
|
||||
|
||||
/** Standard SCSI bus timing values measured in ns. */
|
||||
constexpr uint64_t BUS_SETTLE_DELAY = 400;
|
||||
constexpr uint64_t BUS_FREE_DELAY = 800;
|
||||
@@ -238,65 +192,34 @@ constexpr auto SCSI_MAX_DEVS = 8;
|
||||
|
||||
class ScsiBus;
|
||||
|
||||
class ScsiPhysDevice : public ScsiPhysInterface, public HWComponent {
|
||||
typedef std::function<void()> action_callback;
|
||||
|
||||
class ScsiDevice : public HWComponent {
|
||||
public:
|
||||
ScsiPhysDevice(std::string name, int my_id) : ScsiPhysInterface(PHY_ID_SCSI) {
|
||||
ScsiDevice(std::string name, int my_id) {
|
||||
this->set_name(name);
|
||||
supports_types(HWCompType::SCSI_DEV);
|
||||
this->scsi_id = my_id;
|
||||
this->lun = 0,
|
||||
this->cur_phase = ScsiPhase::BUS_FREE;
|
||||
}
|
||||
~ScsiPhysDevice() = default;
|
||||
|
||||
// ScsiPhysInterface methods
|
||||
bool last_sel_has_attention() override {
|
||||
return this->last_selection_has_attention;
|
||||
}
|
||||
|
||||
uint8_t last_sel_msg() override {
|
||||
return this->last_selection_message;
|
||||
}
|
||||
|
||||
void set_xfer_len(uint64_t len) override {
|
||||
this->xfer_len = len;
|
||||
}
|
||||
|
||||
void set_buffer(uint8_t *bptr) override {
|
||||
this->buf_ptr = bptr;
|
||||
}
|
||||
|
||||
void set_read_more_data_cb(more_data_cb_t cb) override {
|
||||
this->read_more_data = cb;
|
||||
}
|
||||
|
||||
void set_write_more_data_cb(more_data_cb_t cb) override {
|
||||
this->write_more_data = cb;
|
||||
}
|
||||
|
||||
void set_post_xfer_action(action_callback cb) override {
|
||||
this->post_xfer_action = cb;
|
||||
}
|
||||
|
||||
void set_status(uint8_t status_code) override {
|
||||
this->status = status_code;
|
||||
}
|
||||
|
||||
void set_eject_state(bool eject_allowed) override {
|
||||
this->eject_allowed = eject_allowed;
|
||||
}
|
||||
~ScsiDevice() = default;
|
||||
|
||||
virtual void notify(ScsiNotification notif_type, int param);
|
||||
virtual void next_step();
|
||||
virtual void prepare_xfer();
|
||||
virtual void switch_phase(const int new_phase) override;
|
||||
virtual void prepare_xfer(ScsiBus* bus_obj, int& bytes_in, int& bytes_out);
|
||||
virtual void switch_phase(const int new_phase);
|
||||
virtual bool allow_phase_change();
|
||||
|
||||
virtual bool has_data() { return this->data_size != 0; }
|
||||
virtual int xfer_data();
|
||||
virtual int send_data(uint8_t* dst_ptr, int count);
|
||||
virtual int rcv_data(const uint8_t* src_ptr, const int count);
|
||||
virtual bool check_lun();
|
||||
void illegal_command(const uint8_t* cmd);
|
||||
|
||||
virtual bool prepare_data() = 0;
|
||||
virtual bool get_more_data() = 0;
|
||||
virtual void process_command() = 0;
|
||||
virtual void process_message();
|
||||
|
||||
@@ -304,6 +227,8 @@ public:
|
||||
this->bus_obj = bus_obj_ptr;
|
||||
}
|
||||
|
||||
void report_error(uint8_t sense_key, uint8_t asc);
|
||||
|
||||
protected:
|
||||
uint8_t cmd_buf[16] = {};
|
||||
uint8_t msg_buf[16] = {}; // TODO: clarify how big this one should be
|
||||
@@ -312,14 +237,18 @@ protected:
|
||||
int initiator_id;
|
||||
int cur_phase;
|
||||
uint8_t* data_ptr = nullptr;
|
||||
uint8_t* buf_ptr = nullptr;
|
||||
int xfer_len;
|
||||
int data_size;
|
||||
int incoming_size;
|
||||
uint8_t status;
|
||||
|
||||
bool eject_allowed = true;
|
||||
bool last_selection_has_attention = false;
|
||||
int sense;
|
||||
int asc;
|
||||
int ascq;
|
||||
int sksv;
|
||||
int field;
|
||||
bool valid;
|
||||
|
||||
bool last_selection_has_atention = false;
|
||||
uint8_t last_selection_message = 0;
|
||||
ScsiBus* bus_obj;
|
||||
|
||||
@@ -327,9 +256,6 @@ protected:
|
||||
|
||||
action_callback pre_xfer_action = nullptr;
|
||||
action_callback post_xfer_action = nullptr;
|
||||
|
||||
more_data_cb_t read_more_data = {};
|
||||
more_data_cb_t write_more_data = {};
|
||||
};
|
||||
|
||||
/** This class provides a higher level abstraction for the SCSI bus. */
|
||||
@@ -349,7 +275,7 @@ public:
|
||||
void attach_scsi_devices(const std::string bus_suffix);
|
||||
|
||||
// low-level state management
|
||||
void register_device(int id, ScsiPhysDevice* dev_obj);
|
||||
void register_device(int id, ScsiDevice* dev_obj);
|
||||
|
||||
int current_phase() const {
|
||||
return this->cur_phase;
|
||||
@@ -384,13 +310,14 @@ public:
|
||||
bool push_data(const int id, const uint8_t* src_ptr, const int size);
|
||||
int target_xfer_data();
|
||||
void target_next_step();
|
||||
bool negotiate_xfer(int& bytes_in, int& bytes_out);
|
||||
|
||||
protected:
|
||||
void change_bus_phase(int initiator_id);
|
||||
|
||||
private:
|
||||
// SCSI devices registered with this bus
|
||||
std::array<ScsiPhysDevice*, SCSI_MAX_DEVS> devices;
|
||||
std::array<ScsiDevice*, SCSI_MAX_DEVS> devices;
|
||||
|
||||
// per-device state of the control lines
|
||||
uint16_t dev_ctrl_lines[SCSI_MAX_DEVS] = {};
|
||||
|
||||
@@ -1,259 +0,0 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <devices/common/scsi/scsiblockcmds.h>
|
||||
#include <loguru.hpp>
|
||||
#include <memaccess.h>
|
||||
|
||||
ScsiBlockCmds::ScsiBlockCmds(int cache_blocks) : BlockStorageDevice(cache_blocks) {
|
||||
this->enable_cmd(ScsiCommand::READ_6);
|
||||
this->enable_cmd(ScsiCommand::READ_10);
|
||||
this->enable_cmd(ScsiCommand::READ_12);
|
||||
this->enable_cmd(ScsiCommand::WRITE_6);
|
||||
this->enable_cmd(ScsiCommand::WRITE_10);
|
||||
this->enable_cmd(ScsiCommand::WRITE_12);
|
||||
this->enable_cmd(ScsiCommand::START_STOP_UNIT);
|
||||
this->enable_cmd(ScsiCommand::PREVENT_ALLOW_MEDIUM_REMOVAL);
|
||||
this->enable_cmd(ScsiCommand::READ_CAPACITY);
|
||||
|
||||
this->add_page_getter(this, ModePage::ERROR_RECOVERY,
|
||||
&ScsiBlockCmds::get_error_recovery_page);
|
||||
}
|
||||
|
||||
void ScsiBlockCmds::init_block_device(uint8_t medium_type, uint8_t dev_flags) {
|
||||
this->medium_type = medium_type;
|
||||
this->device_flags = dev_flags;
|
||||
|
||||
phy_impl->set_read_more_data_cb(
|
||||
[this](int* dsize, uint8_t** dptr) -> bool {
|
||||
if (this->remain_size) {
|
||||
*dsize = this->read_more();
|
||||
*dptr = (uint8_t *)this->data_cache.get();
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
if (this->is_writeable) {
|
||||
phy_impl->set_write_more_data_cb(
|
||||
[this](int* dsize, uint8_t** dptr) -> bool {
|
||||
if (this->remain_size) {
|
||||
*dsize = this->write_more();
|
||||
*dptr = (uint8_t *)this->data_cache.get();
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
);
|
||||
} else {
|
||||
phy_impl->set_write_more_data_cb(
|
||||
[this](int* dsize, uint8_t** dptr) {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void ScsiBlockCmds::process_command() {
|
||||
int next_phase;
|
||||
|
||||
// use non-disk buffer by default
|
||||
phy_impl->set_buffer(this->buf_ptr);
|
||||
|
||||
switch(this->cdb_ptr[0]) {
|
||||
case ScsiCommand::READ_6:
|
||||
case ScsiCommand::READ_10:
|
||||
case ScsiCommand::READ_12:
|
||||
next_phase = this->read_new();
|
||||
break;
|
||||
case ScsiCommand::WRITE_6:
|
||||
case ScsiCommand::WRITE_10:
|
||||
case ScsiCommand::WRITE_12:
|
||||
next_phase = this->write_new();
|
||||
break;
|
||||
case ScsiCommand::START_STOP_UNIT:
|
||||
next_phase = this->start_stop_unit();
|
||||
break;
|
||||
case ScsiCommand::PREVENT_ALLOW_MEDIUM_REMOVAL:
|
||||
phy_impl->set_eject_state((this->cdb_ptr[4] & 1) == 0);
|
||||
next_phase = ScsiPhase::STATUS;
|
||||
break;
|
||||
case ScsiCommand::READ_CAPACITY:
|
||||
next_phase = this->read_capacity();
|
||||
break;
|
||||
default:
|
||||
ScsiCommonCmds::process_command();
|
||||
return;
|
||||
}
|
||||
|
||||
phy_impl->switch_phase(next_phase);
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::read_new() {
|
||||
int nblocks = this->get_xfer_len();
|
||||
|
||||
// special case: zero transfer length means 256 blocks for READ_6
|
||||
if (this->cdb_ptr[0] == ScsiCommand::READ_6) {
|
||||
if (!nblocks)
|
||||
nblocks = 256;
|
||||
} else {
|
||||
if ((this->cdb_ptr[1] & 1) && !this->linked_cmds_supported()) {
|
||||
LOG_F(WARNING, "READ: RelAdr bit set");
|
||||
this->set_field_pointer(1);
|
||||
this->set_bit_pointer(0);
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
// go directly to the STATUS phase if nblocks = 0
|
||||
if (!nblocks) {
|
||||
LOG_F(WARNING, "READ: skip data transfer because nblocks = 0");
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
this->set_fpos(this->get_lba());
|
||||
phy_impl->set_xfer_len(this->read_begin(nblocks));
|
||||
phy_impl->set_buffer((uint8_t *)this->data_cache.get());
|
||||
|
||||
return ScsiPhase::DATA_IN;
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::write_new() {
|
||||
int nblocks = this->get_xfer_len();
|
||||
|
||||
// special case: zero transfer length means 256 blocks for WRITE_6
|
||||
if (this->cdb_ptr[0] == ScsiCommand::WRITE_6) {
|
||||
if (!nblocks)
|
||||
nblocks = 256;
|
||||
} else {
|
||||
if ((this->cdb_ptr[1] & 1) && !this->linked_cmds_supported()) {
|
||||
LOG_F(WARNING, "WRITE: RelAdr bit set");
|
||||
this->set_field_pointer(1);
|
||||
this->set_bit_pointer(0);
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
// go directly to the STATUS phase if nblocks = 0
|
||||
if (!nblocks) {
|
||||
LOG_F(WARNING, "WRITE: skip data transfer because nblocks = 0");
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
this->set_fpos(this->get_lba());
|
||||
phy_impl->set_xfer_len(this->write_begin(nblocks));
|
||||
phy_impl->set_buffer((uint8_t *)this->data_cache.get());
|
||||
|
||||
phy_impl->set_post_xfer_action([this]() {
|
||||
this->write_cache();
|
||||
}
|
||||
);
|
||||
|
||||
return ScsiPhase::DATA_OUT;
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::start_stop_unit() {
|
||||
if (this->cdb_ptr[4] & 1) {
|
||||
if (this->cdb_ptr[4] & 2)
|
||||
LOG_F(INFO, "START_STOP_UNIT: medium load requested");
|
||||
} else {
|
||||
if (this->cdb_ptr[4] & 2) {
|
||||
LOG_F(INFO, "START_STOP_UNIT: medium eject requested");
|
||||
}
|
||||
}
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::read_capacity() {
|
||||
uint32_t lba = this->get_lba();
|
||||
|
||||
if ((this->cdb_ptr[1] & 1) && !this->linked_cmds_supported()) {
|
||||
LOG_F(WARNING, "READ_CAPACITY: RelAdr bit set");
|
||||
this->set_field_pointer(1);
|
||||
this->set_bit_pointer(0);
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
if (!(this->cdb_ptr[8] & 1) && lba) {
|
||||
LOG_F(ERROR, "READ_CAPACITY: non-zero LBA for PMI=0");
|
||||
this->set_field_pointer(2),
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
uint32_t last_lba = this->size_blocks - 1;
|
||||
uint32_t blk_len = this->block_size;
|
||||
|
||||
WRITE_DWORD_BE_A(&this->buf_ptr[0], last_lba);
|
||||
WRITE_DWORD_BE_A(&this->buf_ptr[4], blk_len);
|
||||
|
||||
phy_impl->set_xfer_len(8);
|
||||
|
||||
return ScsiPhase::DATA_IN;
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::format_block_descriptors(uint8_t* out_ptr) {
|
||||
uint8_t density_code = 0;
|
||||
|
||||
uint32_t nblocks = std::min((int64_t)this->size_blocks, (int64_t)0xFFFFFFFFUL);
|
||||
|
||||
WRITE_DWORD_BE_A(&out_ptr[0], nblocks);
|
||||
WRITE_DWORD_BE_A(&out_ptr[4], (density_code << 24) | (this->block_size & 0xFFFFFF));
|
||||
|
||||
return 8;
|
||||
}
|
||||
|
||||
int ScsiBlockCmds::get_error_recovery_page(uint8_t ctrl, uint8_t subpage,
|
||||
uint8_t *out_ptr, int avail_len)
|
||||
{
|
||||
if (subpage && subpage != 0xFFU)
|
||||
return FORMAT_ERR_BAD_SUBPAGE;
|
||||
|
||||
if (ctrl == 3)
|
||||
return FORMAT_ERR_BAD_CONTROL;
|
||||
|
||||
int page_size = 6;
|
||||
|
||||
if (page_size > avail_len)
|
||||
return FORMAT_ERR_DATA_TOO_BIG;
|
||||
|
||||
std::memset(out_ptr, 0, page_size);
|
||||
|
||||
return page_size;
|
||||
}
|
||||
|
||||
uint32_t ScsiBlockCmds::get_lba() {
|
||||
int cmd_len = this->get_cdb_length(this->cdb_ptr[0]);
|
||||
|
||||
switch(cmd_len) {
|
||||
case 6:
|
||||
return ((this->cdb_ptr[1] & 0x1F) << 16) | READ_WORD_BE_A(&this->cdb_ptr[2]);
|
||||
case 10:
|
||||
case 12:
|
||||
return READ_DWORD_BE_U(&this->cdb_ptr[2]);
|
||||
default:
|
||||
ABORT_F("unsupported command length %d in get_lba", cmd_len);
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SCSI_BLOCK_COMMANDS_H
|
||||
#define SCSI_BLOCK_COMMANDS_H
|
||||
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/common/scsi/scsicommoncmds.h>
|
||||
#include <devices/storage/blockstoragedevice.h>
|
||||
|
||||
#include <cinttypes>
|
||||
|
||||
/** Base class for SCSI block device commands. */
|
||||
class ScsiBlockCmds : public ScsiCommonCmds, public BlockStorageDevice {
|
||||
public:
|
||||
ScsiBlockCmds(int cache_blocks = 256);
|
||||
~ScsiBlockCmds() = default;
|
||||
|
||||
void init_block_device(uint8_t medium_type, uint8_t dev_flags);
|
||||
|
||||
virtual int read_new();
|
||||
virtual int write_new();
|
||||
virtual int start_stop_unit();
|
||||
virtual int read_capacity();
|
||||
|
||||
void get_medium_type(uint8_t& medium_type, uint8_t& dev_flags) override {
|
||||
medium_type = this->medium_type;
|
||||
dev_flags = this->device_flags;
|
||||
}
|
||||
|
||||
int format_block_descriptors(uint8_t* out_ptr) override;
|
||||
|
||||
int get_error_recovery_page(uint8_t ctrl, uint8_t subpage, uint8_t *out_ptr,
|
||||
int avail_len);
|
||||
|
||||
protected:
|
||||
virtual void process_command() override;
|
||||
|
||||
uint32_t get_lba();
|
||||
|
||||
uint8_t medium_type = 0;
|
||||
uint8_t device_flags = 0;
|
||||
};
|
||||
|
||||
#endif // SCSI_BLOCK_COMMANDS_H
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -49,7 +49,7 @@ ScsiBus::ScsiBus(const std::string name)
|
||||
this->target_id = -1;
|
||||
}
|
||||
|
||||
void ScsiBus::register_device(int id, ScsiPhysDevice* dev_obj)
|
||||
void ScsiBus::register_device(int id, ScsiDevice* dev_obj)
|
||||
{
|
||||
if (this->devices[id] != nullptr) {
|
||||
ABORT_F("%s: device with ID %d already registered", this->get_name().c_str(), id);
|
||||
@@ -298,6 +298,18 @@ void ScsiBus::target_next_step()
|
||||
}
|
||||
}
|
||||
|
||||
bool ScsiBus::negotiate_xfer(int& bytes_in, int& bytes_out)
|
||||
{
|
||||
if (target_id < 0) {
|
||||
LOG_F(ERROR, "%s: target_id is not set yet.", this->get_name().c_str());
|
||||
}
|
||||
else {
|
||||
this->devices[this->target_id]->prepare_xfer(this, bytes_in, bytes_out);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScsiBus::disconnect(int dev_id)
|
||||
{
|
||||
this->release_ctrl_lines(dev_id);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -113,6 +113,7 @@ void ScsiBusController::sequencer() {
|
||||
this->cur_state = SeqState::SEND_DATA;
|
||||
break;
|
||||
case ScsiPhase::DATA_IN:
|
||||
this->bus_obj->negotiate_xfer(this->fifo_pos, this->bytes_out);
|
||||
this->cur_state = SeqState::RCV_DATA;
|
||||
this->rcv_data();
|
||||
}
|
||||
@@ -145,6 +146,7 @@ void ScsiBusController::sequencer() {
|
||||
break;
|
||||
case SeqState::RCV_STATUS:
|
||||
case SeqState::RCV_MESSAGE:
|
||||
this->bus_obj->negotiate_xfer(this->fifo_pos, this->bytes_out);
|
||||
this->rcv_data();
|
||||
if (this->is_initiator) {
|
||||
if (this->cur_state == SeqState::RCV_STATUS) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -60,9 +60,9 @@ enum : int {
|
||||
|
||||
constexpr auto DATA_FIFO_DEPTH = 16;
|
||||
|
||||
class ScsiBusController : public ScsiPhysDevice, public DmaDevice {
|
||||
class ScsiBusController : public ScsiDevice, public DmaDevice {
|
||||
public:
|
||||
ScsiBusController(std::string name, uint8_t my_bus_id=7) : ScsiPhysDevice(name, my_bus_id) {
|
||||
ScsiBusController(std::string name, uint8_t my_bus_id=7) : ScsiDevice(name, my_bus_id) {
|
||||
supports_types(HWCompType::SCSI_HOST | HWCompType::SCSI_DEV);
|
||||
}
|
||||
~ScsiBusController() = default;
|
||||
@@ -73,8 +73,10 @@ public:
|
||||
virtual void step_completed() = 0;
|
||||
virtual void report_error(const int error) = 0;
|
||||
|
||||
// ScsiPhysDevice methods
|
||||
// ScsiDevice methods
|
||||
void notify(ScsiNotification notif_type, int param) override;
|
||||
bool prepare_data() override { return false; }
|
||||
bool get_more_data() override { return false; }
|
||||
bool has_data() override { return false; }
|
||||
bool rcv_data();
|
||||
int send_data(uint8_t* dst_ptr, int count) override;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -32,88 +32,56 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
using namespace std;
|
||||
|
||||
static char my_vendor_id[] = "SONY ";
|
||||
static char my_product_id[] = "CD-ROM CDU-8003A";
|
||||
static char my_revision_id[] = "1.9a";
|
||||
|
||||
ScsiCdrom::ScsiCdrom(std::string name, int my_id) :
|
||||
CdromDrive(), ScsiPhysDevice(name, my_id), ScsiCommonCmds()
|
||||
ScsiCdrom::ScsiCdrom(std::string name, int my_id) : CdromDrive(), ScsiDevice(name, my_id)
|
||||
{
|
||||
this->set_phys_dev(this);
|
||||
this->set_cdb_ptr(this->cmd_buf);
|
||||
this->set_buf_ptr(this->data_buf);
|
||||
this->set_error_callback(
|
||||
[this](uint8_t sense_key, uint8_t asc) {
|
||||
//his->report_error(sense_key, asc);
|
||||
this->invalid_cdb(); // HACK! to make CdromDrive::read_toc() work
|
||||
this->report_error(sense_key, asc);
|
||||
}
|
||||
);
|
||||
|
||||
this->set_read_more_data_cb(
|
||||
[this](int* dsize, uint8_t** dptr) {
|
||||
if (this->remain_size) {
|
||||
*dsize = this->read_more();
|
||||
*dptr = (uint8_t *)this->data_cache.get();
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
this->set_write_more_data_cb(
|
||||
[this](int* dsize, uint8_t** dptr) {
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
// populate device info for INQUIRY
|
||||
this->dev_type = ScsiDevType::CD_ROM;
|
||||
this->is_removable = true; // removable medium
|
||||
this->std_versions = 2; // ISO vers=0, ECMA vers=0, ANSI vers=2 (SCSI-2)
|
||||
this->resp_fmt = 2; // response data format: SCSI-2
|
||||
this->cap_flags = CAP_SYNC_XFER; // supports synchronous transfers
|
||||
this->set_vendor_id(my_vendor_id);
|
||||
this->set_product_id(my_product_id);
|
||||
this->set_revision_id(my_revision_id);
|
||||
}
|
||||
|
||||
void ScsiCdrom::process_command()
|
||||
{
|
||||
uint32_t lba;
|
||||
|
||||
if (this->verify_cdb() < 0) {
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return;
|
||||
}
|
||||
uint32_t cdda_start, cdda_end, cdda_len;
|
||||
|
||||
this->pre_xfer_action = nullptr;
|
||||
this->post_xfer_action = nullptr;
|
||||
|
||||
// assume successful command execution
|
||||
phy_impl->set_status(ScsiStatus::GOOD);
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
this->status = ScsiStatus::GOOD;
|
||||
|
||||
// use internal data buffer by default
|
||||
phy_impl->set_buffer(this->data_buf);
|
||||
this->data_ptr = this->data_buf;
|
||||
|
||||
uint8_t* cmd = this->cmd_buf;
|
||||
|
||||
switch (cmd[0]) {
|
||||
case ScsiCommand::TEST_UNIT_READY:
|
||||
this->test_unit_ready();
|
||||
break;
|
||||
case ScsiCommand::READ_6:
|
||||
lba = ((cmd[1] & 0x1F) << 16) + (cmd[2] << 8) + cmd[3];
|
||||
this->read(lba, cmd[4], 6);
|
||||
break;
|
||||
case ScsiCommand::INQUIRY:
|
||||
this->bytes_out = this->inquiry(cmd, this->data_buf);
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
break;
|
||||
case ScsiCommand::MODE_SELECT_6:
|
||||
this->mode_select_6(cmd[4]);
|
||||
break;
|
||||
case ScsiCommand::MODE_SENSE_6:
|
||||
this->mode_sense_6();
|
||||
break;
|
||||
case ScsiCommand::START_STOP_UNIT:
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
break;
|
||||
case ScsiCommand::PREVENT_ALLOW_MEDIUM_REMOVAL:
|
||||
this->eject_allowed = (cmd[4] & 1) == 0;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
break;
|
||||
case ScsiCommand::READ_CAPACITY:
|
||||
case ScsiCommand::READ_CAPACITY_10:
|
||||
this->read_capacity_10();
|
||||
break;
|
||||
case ScsiCommand::READ_10:
|
||||
@@ -126,38 +94,127 @@ void ScsiCdrom::process_command()
|
||||
|
||||
// CD-ROM specific commands
|
||||
case ScsiCommand::READ_TOC:
|
||||
phy_impl->set_xfer_len(read_toc(cmd, this->data_buf));
|
||||
this->bytes_out = read_toc(cmd, this->data_buf);
|
||||
if (this->status == ScsiStatus::GOOD) {
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
}
|
||||
break;
|
||||
case ScsiCommand::READ_CDDA:
|
||||
lba = READ_DWORD_BE_U(&cmd[2]);
|
||||
cdda_len = READ_DWORD_BE_U(&cmd[6]);
|
||||
this->read(lba, cdda_len, 12);
|
||||
break;
|
||||
case ScsiCommand::READ_CDDA_MSF:
|
||||
cdda_start = (cmd[3] * 60 * 75) + (cmd[4] * 75) + cmd[5];
|
||||
cdda_end = (cmd[7] * 60 * 75) + (cmd[8] * 75) + cmd[9];
|
||||
|
||||
cdda_len = (cdda_end > cdda_start) ? (cdda_end - cdda_start) : 0;
|
||||
|
||||
this->read(cdda_start, cdda_len, 12);
|
||||
break;
|
||||
default:
|
||||
ScsiCommonCmds::process_command();
|
||||
LOG_F(ERROR, "%s: unsupported command 0x%X", this->name.c_str(), cmd[0]);
|
||||
this->illegal_command(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
bool ScsiCdrom::prepare_data()
|
||||
{
|
||||
switch (this->cur_phase) {
|
||||
case ScsiPhase::DATA_IN:
|
||||
this->data_size = this->bytes_out;
|
||||
break;
|
||||
case ScsiPhase::DATA_OUT:
|
||||
this->data_size = 0;
|
||||
break;
|
||||
case ScsiPhase::STATUS:
|
||||
break;
|
||||
default:
|
||||
LOG_F(WARNING, "%s: unexpected phase in prepare_data", this->name.c_str());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScsiCdrom::get_more_data() {
|
||||
if (this->data_left()) {
|
||||
this->data_size = this->read_more();
|
||||
this->data_ptr = (uint8_t *)this->data_cache.get();
|
||||
}
|
||||
|
||||
return this->data_size != 0;
|
||||
}
|
||||
|
||||
void ScsiCdrom::read(uint32_t lba, uint16_t nblocks, uint8_t cmd_len)
|
||||
{
|
||||
if (!check_lun())
|
||||
return;
|
||||
|
||||
if (cmd_len == 6 && nblocks == 0)
|
||||
nblocks = 256;
|
||||
|
||||
this->set_fpos(lba);
|
||||
|
||||
phy_impl->set_buffer((uint8_t *)this->data_cache.get());
|
||||
phy_impl->set_xfer_len(this->read_begin(nblocks, UINT32_MAX));
|
||||
this->data_ptr = (uint8_t *)this->data_cache.get();
|
||||
this->bytes_out = this->read_begin(nblocks, UINT32_MAX);
|
||||
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
}
|
||||
|
||||
int ScsiCdrom::format_block_descriptors(uint8_t* out_ptr) {
|
||||
uint8_t density_code = 1; // user data only, 2048 bytes per physical sector
|
||||
int ScsiCdrom::test_unit_ready()
|
||||
{
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return ScsiError::NO_ERROR;
|
||||
}
|
||||
|
||||
WRITE_DWORD_BE_A(&out_ptr[0], (density_code << 24) | (this->size_blocks & 0xFFFFFF));
|
||||
WRITE_DWORD_BE_A(&out_ptr[4], (this->block_size & 0xFFFFFF));
|
||||
uint32_t ScsiCdrom::inquiry(uint8_t *cmd_ptr, uint8_t *data_ptr) {
|
||||
int page_num = cmd_ptr[2];
|
||||
int alloc_len = cmd_ptr[4];
|
||||
|
||||
return 8;
|
||||
if (page_num) {
|
||||
ABORT_F("%s: invalid page number in INQUIRY", this->name.c_str());
|
||||
}
|
||||
|
||||
if (alloc_len > 36) {
|
||||
LOG_F(WARNING, "%s: more than 36 bytes requested in INQUIRY", this->name.c_str());
|
||||
}
|
||||
|
||||
int lun;
|
||||
if (this->last_selection_has_atention) {
|
||||
LOG_F(INFO, "%s: INQUIRY (%d bytes) with ATN LUN = %02x & 7", this->name.c_str(),
|
||||
alloc_len, this->last_selection_message);
|
||||
lun = this->last_selection_message & 7;
|
||||
}
|
||||
else {
|
||||
LOG_F(INFO, "%s: INQUIRY (%d bytes) with NO ATN LUN = %02x >> 5", this->name.c_str(),
|
||||
alloc_len, cmd_ptr[1]);
|
||||
lun = cmd_ptr[1] >> 5;
|
||||
}
|
||||
|
||||
data_ptr[0] = (lun == this->lun) ? 5 : 0x7f; // device type: CD-ROM
|
||||
data_ptr[1] = 0x80; // removable media
|
||||
data_ptr[2] = 2; // ANSI version: SCSI-2
|
||||
data_ptr[3] = 1; // response data format
|
||||
data_ptr[4] = 0x1F; // additional length
|
||||
data_ptr[5] = 0;
|
||||
data_ptr[6] = 0;
|
||||
data_ptr[7] = 0x18; // supports synchronous xfers and linked commands
|
||||
std::memcpy(&data_ptr[8], vendor_info, 8);
|
||||
std::memcpy(&data_ptr[16], prod_info, 16);
|
||||
std::memcpy(&data_ptr[32], rev_info, 4);
|
||||
//std::memcpy(&data_ptr[36], serial_number, 8);
|
||||
//etc.
|
||||
|
||||
if (alloc_len < 36) {
|
||||
LOG_F(ERROR, "%s: allocation length too small: %d", this->name.c_str(),
|
||||
alloc_len);
|
||||
}
|
||||
else {
|
||||
memset(&data_ptr[36], 0, alloc_len - 36);
|
||||
}
|
||||
|
||||
return alloc_len;
|
||||
}
|
||||
|
||||
static char Apple_Copyright_Page_Data[] = "APPLE COMPUTER, INC ";
|
||||
@@ -203,17 +260,18 @@ void ScsiCdrom::mode_sense_6()
|
||||
this->data_buf[17] = 'p';
|
||||
break;
|
||||
default:
|
||||
LOG_F(WARNING, "%s: unsupported page 0x%02x in MODE_SENSE_6", this->name.c_str(),
|
||||
page_code);
|
||||
this->set_field_pointer(2), // error is in the 3rd byte
|
||||
this->set_bit_pointer(5), // starting with bit 5
|
||||
this->invalid_cdb();
|
||||
LOG_F(WARNING, "%s: unsupported page 0x%02x in MODE_SENSE_6", this->name.c_str(), page_code);
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_CDB;
|
||||
this->ascq = 0;
|
||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||
this->field = 2;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return;
|
||||
}
|
||||
|
||||
phy_impl->set_xfer_len(this->data_buf[0]);
|
||||
|
||||
this->bytes_out = this->data_buf[0];
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
@@ -224,7 +282,7 @@ void ScsiCdrom::mode_select_6(uint8_t param_len)
|
||||
if (!param_len)
|
||||
return;
|
||||
|
||||
phy_impl->set_xfer_len(param_len);
|
||||
this->incoming_size = param_len;
|
||||
|
||||
std::memset(&this->data_buf[0], 0, 512);
|
||||
|
||||
@@ -246,19 +304,25 @@ void ScsiCdrom::read_capacity_10()
|
||||
|
||||
if (!(this->cmd_buf[8] & 1) && lba) {
|
||||
LOG_F(ERROR, "%s: non-zero LBA for PMI=0", this->name.c_str());
|
||||
this->set_field_pointer(2),
|
||||
this->invalid_cdb();
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_CDB;
|
||||
this->ascq = 0;
|
||||
this->sksv = 0xc0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||
this->field = 8;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!check_lun())
|
||||
return;
|
||||
|
||||
int last_lba = (int)this->size_blocks - 1;
|
||||
|
||||
WRITE_DWORD_BE_A(&this->data_buf[0], last_lba);
|
||||
WRITE_DWORD_BE_A(&this->data_buf[4], this->block_size);
|
||||
|
||||
phy_impl->set_xfer_len(8);
|
||||
|
||||
this->bytes_out = 8;
|
||||
this->msg_buf[0] = ScsiMessage::COMMAND_COMPLETE;
|
||||
|
||||
this->switch_phase(ScsiPhase::DATA_IN);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-24 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -25,7 +25,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#define SCSI_CDROM_H
|
||||
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/common/scsi/scsicommoncmds.h>
|
||||
#include <devices/storage/cdromdrive.h>
|
||||
#include <utils/imgfile.h>
|
||||
|
||||
@@ -33,26 +32,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
class ScsiCdrom : public ScsiPhysDevice, public CdromDrive, public ScsiCommonCmds {
|
||||
class ScsiCdrom : public CdromDrive, public ScsiDevice {
|
||||
public:
|
||||
ScsiCdrom(std::string name, int my_id);
|
||||
~ScsiCdrom() = default;
|
||||
|
||||
virtual void process_command() override;
|
||||
virtual bool prepare_data() override;
|
||||
virtual bool get_more_data() override;
|
||||
|
||||
protected:
|
||||
bool is_device_ready() override { return true; }
|
||||
|
||||
// temporary implementation that should be elsewhere
|
||||
void get_medium_type(uint8_t& medium_type, uint8_t& dev_flags) override {
|
||||
medium_type = 1; // 120mm CD-ROM data only
|
||||
dev_flags = 0;
|
||||
}
|
||||
|
||||
// temporary implementation that should be elsewhere
|
||||
int format_block_descriptors(uint8_t* out_ptr) override;
|
||||
|
||||
int test_unit_ready();
|
||||
void read(uint32_t lba, uint16_t nblocks, uint8_t cmd_len);
|
||||
uint32_t inquiry(uint8_t *cmd_ptr, uint8_t *data_ptr) override;
|
||||
void mode_select_6(uint8_t param_len);
|
||||
|
||||
void mode_sense_6();
|
||||
@@ -62,6 +54,11 @@ private:
|
||||
bool eject_allowed = true;
|
||||
int bytes_out = 0;
|
||||
uint8_t data_buf[2048] = {};
|
||||
|
||||
//inquiry info
|
||||
char vendor_info[9] = "SONY ";
|
||||
char prod_info[17] = "CD-ROM CDU-8003A";
|
||||
char rev_info[5] = "1.9a";
|
||||
};
|
||||
|
||||
#endif // SCSI_CDROM_H
|
||||
@@ -1,447 +0,0 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <devices/common/scsi/scsicommoncmds.h>
|
||||
#include <loguru.hpp>
|
||||
#include <memaccess.h>
|
||||
|
||||
ScsiCommonCmds::ScsiCommonCmds() {
|
||||
this->enable_cmd(ScsiCommand::TEST_UNIT_READY);
|
||||
this->enable_cmd(ScsiCommand::REQ_SENSE);
|
||||
this->enable_cmd(ScsiCommand::INQUIRY);
|
||||
this->enable_cmd(ScsiCommand::MODE_SENSE_6);
|
||||
this->enable_cmd(ScsiCommand::MODE_SENSE_10);
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::process_command() {
|
||||
int next_phase;
|
||||
|
||||
switch(this->cdb_ptr[0]) {
|
||||
case ScsiCommand::TEST_UNIT_READY:
|
||||
next_phase = this->test_unit_ready();
|
||||
break;
|
||||
case ScsiCommand::REQ_SENSE:
|
||||
next_phase = this->request_sense_new();
|
||||
break;
|
||||
case ScsiCommand::INQUIRY:
|
||||
next_phase = this->inquiry_new();
|
||||
break;
|
||||
case ScsiCommand::MODE_SENSE_6:
|
||||
case ScsiCommand::MODE_SENSE_10:
|
||||
next_phase = this->mode_sense();
|
||||
break;
|
||||
default:
|
||||
LOG_F(ERROR, "no support for command 0x%X", this->cdb_ptr[0]);
|
||||
this->invalid_command();
|
||||
next_phase = ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
phy_impl->switch_phase(next_phase);
|
||||
}
|
||||
|
||||
// maps command group number to CDB length (SCSI-2 standard §7.2.1)
|
||||
static const int CmdGroupLen[8] = {6, 10, 10, CMD_GRP_RESERVED, CMD_GRP_RESERVED, 12,
|
||||
CMD_GRP_VENDOR_SPECIFIC, CMD_GRP_VENDOR_SPECIFIC};
|
||||
|
||||
int ScsiCommonCmds::get_cdb_length(uint8_t op_code) {
|
||||
return CmdGroupLen[op_code >> 5];
|
||||
}
|
||||
|
||||
int ScsiCommonCmds::verify_cdb() {
|
||||
if (phy_impl->get_phy_id() == PHY_ID_ATAPI)
|
||||
return 0; // don't try to verify ATAPI packets
|
||||
|
||||
int cdb_len = this->get_cdb_length(this->cdb_ptr[0]);
|
||||
|
||||
if (cdb_len < 0)
|
||||
return 0; // don't know how to verify non-standard CDBs
|
||||
|
||||
// check the LUN field except for INQUIRY and REQ_SENSE
|
||||
if ((this->cdb_ptr[0] != ScsiCommand::INQUIRY) &&
|
||||
(this->cdb_ptr[0] != ScsiCommand::REQ_SENSE))
|
||||
{
|
||||
if (phy_impl->last_sel_has_attention() &&
|
||||
(phy_impl->last_sel_msg() & ScsiMessage::IDENTIFY))
|
||||
{
|
||||
uint8_t lun = phy_impl->last_sel_msg() & 7;
|
||||
|
||||
if (!this->lun_supported(lun)) {
|
||||
LOG_F(ERROR, "unsupported LUN 0x%X", lun);
|
||||
this->invalid_lun();
|
||||
phy_impl->set_status(ScsiStatus::CHECK_CONDITION);
|
||||
return -1;
|
||||
}
|
||||
} else if (this->cdb_ptr[1] >> 5)
|
||||
LOG_F(WARNING, "non-zero LUN 0x%X in CDB", this->cdb_ptr[1] >> 5);
|
||||
}
|
||||
|
||||
// check the control field
|
||||
uint8_t ctrl_byte = this->cdb_ptr[cdb_len - 1];
|
||||
|
||||
if (ctrl_byte & 3) {
|
||||
if (this->linked_cmds_supported())
|
||||
this->link_ctrl = ctrl_byte;
|
||||
else {
|
||||
LOG_F(ERROR, "flag/link bit set in CDB control: 0x%X", ctrl_byte);
|
||||
this->invalid_cdb();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ScsiCommonCmds::test_unit_ready() {
|
||||
// Assume that LUN is okay and the status has been set to GOOD
|
||||
|
||||
if (!phy_impl->is_device_ready()) {
|
||||
this->sense_key = ScsiSense::NOT_READY;
|
||||
this->asc = phy_impl->not_ready_reason();
|
||||
this->ascq = 0;
|
||||
phy_impl->set_status(ScsiStatus::CHECK_CONDITION);
|
||||
}
|
||||
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
int ScsiCommonCmds::inquiry_new() {
|
||||
int alloc_len = this->get_xfer_len();
|
||||
int resp_len = 36; // standard response length
|
||||
|
||||
// go directly to the STATUS phase if alloc_len = 0
|
||||
if (!alloc_len) {
|
||||
LOG_F(WARNING, "INQUIRY: skip data transfer because alloc_len = 0");
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
if (phy_impl->get_phy_id() == PHY_ID_SCSI) {
|
||||
bool is_invalid = false;
|
||||
|
||||
if (this->cdb_ptr[1] & 1) {
|
||||
LOG_F(ERROR, "INQUIRY: EVPD=1 not supported");
|
||||
this->set_field_pointer(1);
|
||||
this->set_bit_pointer(0);
|
||||
is_invalid = true;
|
||||
}
|
||||
|
||||
if (this->cdb_ptr[2]) {
|
||||
LOG_F(ERROR, "INQUIRY: non-zero page code not supported");
|
||||
this->set_field_pointer(2);
|
||||
is_invalid = true;
|
||||
}
|
||||
|
||||
if (is_invalid) {
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
std::memset(this->buf_ptr, 0, resp_len);
|
||||
|
||||
uint8_t lun = this->get_lun();
|
||||
|
||||
if (lun) {
|
||||
// tell the host there is no device for this LUN
|
||||
this->buf_ptr[0] = (3 << 5) | ScsiDevType::UNKNOWN;
|
||||
LOG_F(WARNING, "INQUIRY: no device for LUN %d", lun);
|
||||
} else {
|
||||
this->buf_ptr[0] = this->dev_type;
|
||||
this->buf_ptr[1] = ((this->is_removable) ? 0x80 : 0) | this->dev_type_mod;
|
||||
this->buf_ptr[2] = this->std_versions;
|
||||
this->buf_ptr[3] = this->resp_fmt;
|
||||
this->buf_ptr[4] = 31; // additional length (n-5)
|
||||
this->buf_ptr[7] = this->cap_flags;
|
||||
std::memcpy(&this->buf_ptr[ 8], vendor_id, sizeof(this->vendor_id));
|
||||
std::memcpy(&this->buf_ptr[16], product_id, sizeof(this->product_id));
|
||||
std::memcpy(&this->buf_ptr[32], revision_id, sizeof(this->revision_id));
|
||||
}
|
||||
|
||||
phy_impl->set_xfer_len(std::min(alloc_len, resp_len));
|
||||
|
||||
return ScsiPhase::DATA_IN;
|
||||
}
|
||||
|
||||
int ScsiCommonCmds::request_sense_new() {
|
||||
int alloc_len = this->get_xfer_len();
|
||||
int resp_len = 18; // standard response length
|
||||
|
||||
// go directly to the STATUS phase if alloc_len = 0
|
||||
if (!alloc_len) {
|
||||
LOG_F(WARNING, "REQ_SENSE: skip data transfer because alloc_len = 0");
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
std::memset(this->buf_ptr, 0, resp_len);
|
||||
|
||||
this->buf_ptr[0] = 0x80 | 0x70; // valid bit + current errors
|
||||
this->buf_ptr[7] = 10; // additional sense length
|
||||
|
||||
uint8_t lun = this->get_lun();
|
||||
|
||||
if (lun) // unsupported LUN
|
||||
this->invalid_lun();
|
||||
|
||||
this->buf_ptr[ 2] = this->sense_key;
|
||||
this->buf_ptr[12] = this->asc;
|
||||
this->buf_ptr[13] = this->ascq;
|
||||
|
||||
if (this->sense_key == ScsiSense::ILLEGAL_REQ && this->field_ptr_valid) {
|
||||
this->buf_ptr[15] = this->is_cdb_err ? 0xC0 : 0x80;
|
||||
|
||||
WRITE_WORD_BE_A(&this->buf_ptr[16], this->field_ptr);
|
||||
|
||||
if (this->bit_ptr_valid)
|
||||
this->buf_ptr[15] |= (this->bit_ptr & 7) | 8;
|
||||
}
|
||||
|
||||
this->reset_sense(); // clear last sense information
|
||||
|
||||
phy_impl->set_xfer_len(std::min(alloc_len, resp_len));
|
||||
|
||||
return ScsiPhase::DATA_IN;
|
||||
}
|
||||
|
||||
const char* Page_Control_Modes[4] = {
|
||||
"CURRENT_VALUES",
|
||||
"CHANGEABLE_VALUES",
|
||||
"DEFAULT_VALUES",
|
||||
"SAVED_VALUES"
|
||||
};
|
||||
|
||||
int ScsiCommonCmds::mode_sense() {
|
||||
uint8_t page_ctrl = this->cdb_ptr[2] >> 6;
|
||||
|
||||
if (page_ctrl == PageControl::SAVED_VALUES && !this->supports_params_saving()) {
|
||||
LOG_F(ERROR, "MODE_SENSE: Page control mode (%s) not supported",
|
||||
Page_Control_Modes[page_ctrl]);
|
||||
this->set_field_pointer(2), // error in the 3rd byte
|
||||
this->set_bit_pointer(7), // starting with bit 7
|
||||
this->illegal_request(ScsiError::SAVING_NOT_SUPPORTED, 0);
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
|
||||
uint8_t page_code = this->cdb_ptr[2] & 0x3F;
|
||||
uint8_t subpage_code = this->cdb_ptr[3];
|
||||
|
||||
// MODE_SENSE_10 returns a bigger response
|
||||
bool is_long_resp = this->cdb_ptr[0] == ScsiCommand::MODE_SENSE_10;
|
||||
|
||||
int alloc_len = this->get_xfer_len();
|
||||
int resp_len = 0;
|
||||
int resp_max_len = is_long_resp ? 65536 : 256;
|
||||
|
||||
uint8_t* out_ptr = this->buf_ptr;
|
||||
|
||||
uint8_t medium_type, dev_flags;
|
||||
|
||||
this->get_medium_type(medium_type, dev_flags);
|
||||
|
||||
// format response header
|
||||
if (is_long_resp) { // MODE_SENSE_10
|
||||
WRITE_WORD_BE_A(out_ptr, 0); // zero data_length -> to be adjusted later
|
||||
out_ptr[2] = medium_type;
|
||||
out_ptr[3] = dev_flags;
|
||||
resp_len = 8; // initial response length
|
||||
out_ptr += 8; // move data pointer past block descriptor length
|
||||
WRITE_WORD_BE_A(&out_ptr[-2], 0); // zero block descriptor length
|
||||
} else {
|
||||
out_ptr[0] = 0; // zero data_length -> to be adjusted later
|
||||
out_ptr[1] = medium_type;
|
||||
out_ptr[2] = dev_flags;
|
||||
resp_len = 4; // initial response length
|
||||
out_ptr += 4; // move data pointer past block descriptor length
|
||||
out_ptr[-1] = 0; // zero block descriptor length
|
||||
}
|
||||
|
||||
// return block descriptor(s) unless
|
||||
// it's ATAPI that doesn't use block descriptors
|
||||
// block descriptors are disabled by the DBD bit
|
||||
if (phy_impl->get_phy_id() == PHY_ID_SCSI) {
|
||||
if (!(this->cdb_ptr[1] & 8)) { // if DBD=0
|
||||
int desc_len = this->format_block_descriptors(out_ptr);
|
||||
if (is_long_resp)
|
||||
WRITE_WORD_BE_A(&out_ptr[-2], desc_len);
|
||||
else
|
||||
out_ptr[-1] = desc_len;
|
||||
out_ptr += desc_len;
|
||||
resp_len += desc_len;
|
||||
} else
|
||||
LOG_F(WARNING, "MODE_SENSE: block descriptor(s) disabled");
|
||||
}
|
||||
|
||||
// return all pages if requested
|
||||
if (page_code == ModePage::ALL_PAGES) {
|
||||
for (const auto& [page_num, formatter] : this->getters) {
|
||||
if (!page_num)
|
||||
continue; // skip vendor specific page 0 - shall be returned last
|
||||
|
||||
int page_len = this->get_one_page(page_ctrl, page_num, 0,
|
||||
out_ptr, resp_max_len - resp_len);
|
||||
if (page_len < 0)
|
||||
return ScsiPhase::STATUS;
|
||||
|
||||
out_ptr += page_len;
|
||||
resp_len += page_len;
|
||||
}
|
||||
|
||||
if (this->getters.count(0))
|
||||
page_code = 0; // page 0 exists -> let the following code return it last
|
||||
}
|
||||
|
||||
// return one page
|
||||
if (page_code != ModePage::ALL_PAGES) {
|
||||
if (this->getters.count(page_code)) {
|
||||
int page_len = this->get_one_page(page_ctrl, page_code, subpage_code,
|
||||
out_ptr, resp_max_len - resp_len);
|
||||
if (page_len < 0)
|
||||
return ScsiPhase::STATUS;
|
||||
|
||||
resp_len += page_len;
|
||||
} else {
|
||||
LOG_F(ERROR, "MODE_SENSE: page 0x%X not supported", page_code);
|
||||
this->set_field_pointer(2), // error in the 3rd byte
|
||||
this->set_bit_pointer(5), // starting with bit 5
|
||||
this->invalid_cdb();
|
||||
return ScsiPhase::STATUS;
|
||||
}
|
||||
}
|
||||
|
||||
// stuff final response into response header
|
||||
if (is_long_resp)
|
||||
WRITE_WORD_BE_A(&this->buf_ptr[0], resp_len - 2);
|
||||
else
|
||||
this->buf_ptr[0] = resp_len - 1;
|
||||
|
||||
phy_impl->set_xfer_len(std::min(alloc_len, resp_len));
|
||||
|
||||
return ScsiPhase::DATA_IN;
|
||||
}
|
||||
|
||||
int ScsiCommonCmds::get_one_page(uint8_t ctrl, uint8_t page, uint8_t subpage,
|
||||
uint8_t* out_ptr, int avail_len)
|
||||
{
|
||||
int len, err;
|
||||
|
||||
try_again:
|
||||
len = this->getters[page](ctrl, subpage, &out_ptr[2], avail_len - 2);
|
||||
if (len < 0) {
|
||||
err = len;
|
||||
if (err == FORMAT_ERR_DATA_TOO_BIG) {
|
||||
ABORT_F("Internal buffer too small!");
|
||||
// increase buffer size
|
||||
// goto try_again;
|
||||
} else if (err == FORMAT_ERR_BAD_CONTROL) {
|
||||
LOG_F(ERROR, "MODE_SENSE: Page control (%s) not supported for page 0x%X",
|
||||
Page_Control_Modes[ctrl], page);
|
||||
this->set_field_pointer(2), // error in the 3rd byte
|
||||
this->set_bit_pointer(7); // starting with bit 7
|
||||
} else if (err == FORMAT_ERR_BAD_SUBPAGE) {
|
||||
LOG_F(ERROR, "MODE_SENSE: unsupported subpage 0x%X for page 0x%X",
|
||||
subpage, page);
|
||||
this->set_field_pointer(3); // error in the 4th byte
|
||||
} else
|
||||
ABORT_F("MODE_SENSE: unknown getter error %d", err);
|
||||
|
||||
this->invalid_cdb();
|
||||
return err;
|
||||
}
|
||||
|
||||
out_ptr[0] = page;
|
||||
out_ptr[1] = len;
|
||||
|
||||
return len + 2;
|
||||
}
|
||||
|
||||
uint8_t ScsiCommonCmds::get_lun() {
|
||||
if (phy_impl->get_phy_id() == PHY_ID_ATAPI)
|
||||
return 0; // ATAPI doesn't support SCSI LUNs so bail out early
|
||||
|
||||
if (phy_impl->last_sel_has_attention() &&
|
||||
(phy_impl->last_sel_msg() & ScsiMessage::IDENTIFY))
|
||||
return phy_impl->last_sel_msg() & 7;
|
||||
else
|
||||
return this->cdb_ptr[1] >> 5;
|
||||
}
|
||||
|
||||
uint32_t ScsiCommonCmds::get_xfer_len() {
|
||||
int cmd_len = this->get_cdb_length(this->cdb_ptr[0]);
|
||||
|
||||
switch(cmd_len) {
|
||||
case 6:
|
||||
return this->cdb_ptr[4];
|
||||
case 10:
|
||||
return READ_WORD_BE_U(&this->cdb_ptr[7]);
|
||||
case 12:
|
||||
return READ_DWORD_BE_U(&this->cdb_ptr[6]);
|
||||
default:
|
||||
ABORT_F("unsupported command length %d in get_xfer_len", cmd_len);
|
||||
}
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::reset_sense() {
|
||||
this->sense_key = ScsiSense::NO_SENSE;
|
||||
this->asc = ScsiError::NO_ERROR;
|
||||
this->ascq = 0;
|
||||
this->field_ptr_valid = false;
|
||||
this->bit_ptr_valid = false;
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::invalid_lun() {
|
||||
this->sense_key = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_LUN;
|
||||
this->ascq = 0;
|
||||
this->is_cdb_err = true;
|
||||
this->field_ptr_valid = true;
|
||||
this->field_ptr = 1; // error in the 2nd byte
|
||||
this->bit_ptr_valid = true;
|
||||
this->bit_ptr = 7; // MSB number of the invalid bitfield
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::invalid_cdb() {
|
||||
this->sense_key = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_CDB;
|
||||
this->ascq = 0;
|
||||
this->is_cdb_err = true;
|
||||
|
||||
phy_impl->set_status(ScsiStatus::CHECK_CONDITION);
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::invalid_command() {
|
||||
LOG_F(ERROR, "unsupported command: 0x%02x", this->cdb_ptr[0]);
|
||||
|
||||
this->sense_key = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_CMD;
|
||||
this->ascq = 0;
|
||||
this->is_cdb_err = true;
|
||||
this->field_ptr_valid = true;
|
||||
this->field_ptr = 0; // error in the 1st byte
|
||||
|
||||
phy_impl->set_status(ScsiStatus::CHECK_CONDITION);
|
||||
}
|
||||
|
||||
void ScsiCommonCmds::illegal_request(uint8_t asc, uint8_t ascq, bool is_cdb) {
|
||||
this->sense_key = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = asc;
|
||||
this->ascq = ascq;
|
||||
this->is_cdb_err = is_cdb;
|
||||
|
||||
phy_impl->set_status(ScsiStatus::CHECK_CONDITION);
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SCSI_COMMON_COMMANDS_H
|
||||
#define SCSI_COMMON_COMMANDS_H
|
||||
|
||||
#include <core/bitops.h>
|
||||
#include <devices/common/scsi/scsi.h>
|
||||
#include <devices/common/scsi/scsiphysinterface.h>
|
||||
|
||||
#include <array>
|
||||
#include <cinttypes>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
|
||||
/** IDs for command groups with non-standard length. */
|
||||
enum : int {
|
||||
CMD_GRP_RESERVED = -1,
|
||||
CMD_GRP_VENDOR_SPECIFIC = -2,
|
||||
};
|
||||
|
||||
/** Errors returned by mode sense page formatters. */
|
||||
enum {
|
||||
FORMAT_ERR_BAD_SUBPAGE = -1,
|
||||
FORMAT_ERR_BAD_CONTROL = -2,
|
||||
FORMAT_ERR_DATA_TOO_BIG = -3,
|
||||
};
|
||||
|
||||
typedef std::function<int(uint8_t, uint8_t, uint8_t *, int)> page_getter_t;
|
||||
|
||||
/** Base class for common SCSI commands. */
|
||||
class ScsiCommonCmds {
|
||||
public:
|
||||
ScsiCommonCmds();
|
||||
~ScsiCommonCmds() = default;
|
||||
|
||||
void set_phys_dev(ScsiPhysInterface* dev_obj) { this->phy_impl = dev_obj; }
|
||||
void set_cdb_ptr(uint8_t* ptr) { this->cdb_ptr = ptr; }
|
||||
void set_buf_ptr(uint8_t* ptr) { this->buf_ptr = ptr; }
|
||||
|
||||
virtual int verify_cdb();
|
||||
|
||||
virtual int get_cdb_length(uint8_t op_code);
|
||||
|
||||
// override this to support several LUNs
|
||||
virtual bool lun_supported(uint8_t lun) { return lun == 0; }
|
||||
|
||||
// override it in the sub-classes to support saving of device parameters
|
||||
virtual bool supports_params_saving() { return false; }
|
||||
|
||||
// override this to support linked commands
|
||||
virtual bool linked_cmds_supported() { return false; }
|
||||
|
||||
// implement it in the sub-classes because those parameters are device specific
|
||||
virtual void get_medium_type(uint8_t& medium_type, uint8_t& dev_flags) = 0;
|
||||
|
||||
// implement it in the sub-classes
|
||||
virtual int format_block_descriptors(uint8_t* out_ptr) = 0;
|
||||
|
||||
template <typename T>
|
||||
void add_page_getter(T *inst, int page, int(T::*func)(uint8_t, uint8_t, uint8_t *, int)) {
|
||||
page_getter_t f = [=] (uint8_t ctrl, uint8_t page, uint8_t *out_ptr, int avail_len) {
|
||||
return (inst->*func)(ctrl, page, out_ptr, avail_len);
|
||||
};
|
||||
this->getters.emplace(std::make_pair(page, f));
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void process_command();
|
||||
virtual int test_unit_ready();
|
||||
virtual int inquiry_new();
|
||||
virtual int request_sense_new();
|
||||
virtual int mode_sense();
|
||||
virtual uint8_t get_lun();
|
||||
virtual uint32_t get_xfer_len();
|
||||
virtual void reset_sense();
|
||||
virtual void invalid_lun();
|
||||
virtual void invalid_cdb();
|
||||
virtual void invalid_command();
|
||||
virtual void illegal_request(uint8_t asc, uint8_t ascq, bool is_cdb = true);
|
||||
|
||||
int get_one_page(uint8_t ctrl, uint8_t page, uint8_t subpage, uint8_t* out_ptr,
|
||||
int avail_len);
|
||||
|
||||
virtual void set_field_pointer(const uint16_t fp) {
|
||||
this->field_ptr = fp;
|
||||
this->field_ptr_valid = true;
|
||||
}
|
||||
|
||||
virtual void set_bit_pointer(const uint8_t bp) {
|
||||
this->bit_ptr = bp;
|
||||
this->bit_ptr_valid = true;
|
||||
}
|
||||
|
||||
bool cmd_enabled(uint8_t cmd) {
|
||||
return bit_set(this->cmd_enables[cmd >> 3], cmd & 7);
|
||||
}
|
||||
|
||||
void enable_cmd(uint8_t cmd) {
|
||||
set_bit(this->cmd_enables[cmd >> 3], cmd & 7);
|
||||
}
|
||||
|
||||
void disable_cmd(uint8_t cmd) {
|
||||
clear_bit(this->cmd_enables[cmd >> 3], cmd & 7);
|
||||
}
|
||||
|
||||
void set_vendor_id(char* vid) {
|
||||
std::memset(this->vendor_id, 0, sizeof(this->vendor_id));
|
||||
std::strncpy(this->vendor_id, vid, sizeof(this->vendor_id));
|
||||
}
|
||||
|
||||
void set_product_id(char* pid) {
|
||||
std::memset(this->product_id, 0, sizeof(this->product_id));
|
||||
std::strncpy(this->product_id, pid, sizeof(this->product_id));
|
||||
}
|
||||
|
||||
void set_revision_id(char* rid) {
|
||||
std::memset(this->revision_id, 0, sizeof(this->revision_id));
|
||||
std::strncpy(this->revision_id, rid, sizeof(this->revision_id));
|
||||
}
|
||||
|
||||
ScsiPhysInterface* phy_impl = nullptr;
|
||||
uint8_t* cdb_ptr = nullptr;
|
||||
uint8_t* buf_ptr = nullptr;
|
||||
|
||||
std::array<uint8_t, 32> cmd_enables{};
|
||||
|
||||
// REQUEST SENSE state
|
||||
uint8_t sense_key = ScsiSense::NO_SENSE;
|
||||
uint8_t asc = 0; // additional sense code
|
||||
uint8_t ascq = 0; // additional sense code qualifier
|
||||
bool field_ptr_valid = false; // field pointer valid
|
||||
bool bit_ptr_valid = false; // bit pointer valid
|
||||
bool is_cdb_err = false; // error in CDB?
|
||||
uint8_t bit_ptr = 0; // field pointer value
|
||||
uint16_t field_ptr = 0; // bit pointer value
|
||||
|
||||
// INQUIRY state
|
||||
uint8_t dev_type = ScsiDevType::UNKNOWN;
|
||||
bool is_removable = false;
|
||||
uint8_t dev_type_mod = 0;
|
||||
uint8_t std_versions = 0; // compliance with some standards
|
||||
uint8_t resp_fmt = 0;
|
||||
uint8_t cap_flags = 0; // capability flags
|
||||
char vendor_id[8] = {};
|
||||
char product_id[16] = {};
|
||||
char revision_id[4] = {};
|
||||
|
||||
uint8_t link_ctrl = 0; // control field from CDB
|
||||
|
||||
mutable std::map<int, page_getter_t> getters;
|
||||
};
|
||||
|
||||
#endif // SCSI_COMMON_COMMANDS_H
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
DingusPPC - The Experimental PowerPC Macintosh emulator
|
||||
Copyright (C) 2018-26 The DingusPPC Development Team
|
||||
(See CREDITS.MD for more details)
|
||||
Copyright (C) 2018-25 divingkatae and maximum
|
||||
(theweirdo) spatium
|
||||
|
||||
(You may also contact divingkxt or powermax2286 on Discord)
|
||||
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -26,17 +26,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <cinttypes>
|
||||
#include <cstring>
|
||||
|
||||
void ScsiPhysDevice::notify(ScsiNotification notif_type, int param)
|
||||
void ScsiDevice::notify(ScsiNotification notif_type, int param)
|
||||
{
|
||||
if (notif_type == ScsiNotification::BUS_PHASE_CHANGE) {
|
||||
switch (param) {
|
||||
case ScsiPhase::RESET:
|
||||
LOG_F(9, "device %d: bus reset aknowledged", this->scsi_id);
|
||||
LOG_F(9, "ScsiDevice %d: bus reset aknowledged", this->scsi_id);
|
||||
break;
|
||||
case ScsiPhase::SELECTION:
|
||||
// check if something tries to select us
|
||||
if (this->bus_obj->get_data_lines() & (1 << scsi_id)) {
|
||||
LOG_F(9, "device %d selected", this->scsi_id);
|
||||
LOG_F(9, "ScsiDevice %d selected", this->scsi_id);
|
||||
TimerManager::get_instance()->add_oneshot_timer(
|
||||
BUS_SETTLE_DELAY,
|
||||
[this]() {
|
||||
@@ -48,10 +48,10 @@ void ScsiPhysDevice::notify(ScsiNotification notif_type, int param)
|
||||
this->seq_steps = nullptr;
|
||||
this->initiator_id = this->bus_obj->get_initiator_id();
|
||||
if (this->bus_obj->test_ctrl_lines(SCSI_CTRL_ATN)) {
|
||||
this->last_selection_has_attention = true;
|
||||
this->last_selection_has_atention = true;
|
||||
this->switch_phase(ScsiPhase::MESSAGE_OUT);
|
||||
} else {
|
||||
this->last_selection_has_attention = false;
|
||||
this->last_selection_has_atention = false;
|
||||
this->switch_phase(ScsiPhase::COMMAND);
|
||||
}
|
||||
});
|
||||
@@ -61,14 +61,13 @@ void ScsiPhysDevice::notify(ScsiNotification notif_type, int param)
|
||||
}
|
||||
}
|
||||
|
||||
void ScsiPhysDevice::switch_phase(const int new_phase)
|
||||
void ScsiDevice::switch_phase(const int new_phase)
|
||||
{
|
||||
this->cur_phase = new_phase;
|
||||
this->bus_obj->switch_phase(this->scsi_id, this->cur_phase);
|
||||
this->prepare_xfer();
|
||||
}
|
||||
|
||||
bool ScsiPhysDevice::allow_phase_change() {
|
||||
bool ScsiDevice::allow_phase_change() {
|
||||
if (this->bus_obj->test_ctrl_lines(SCSI_CTRL_ATN | SCSI_CTRL_ACK) ==
|
||||
(SCSI_CTRL_ATN | SCSI_CTRL_ACK))
|
||||
ABORT_F("%s: reject message requested", this->name.c_str());
|
||||
@@ -79,7 +78,7 @@ bool ScsiPhysDevice::allow_phase_change() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScsiPhysDevice::next_step()
|
||||
void ScsiDevice::next_step()
|
||||
{
|
||||
// special case: data transfers during MESSAGE_IN phase
|
||||
// require handshaking. Rejecting needs to be detected too.
|
||||
@@ -115,11 +114,16 @@ void ScsiPhysDevice::next_step()
|
||||
case ScsiPhase::COMMAND:
|
||||
this->process_command();
|
||||
if (this->cur_phase != ScsiPhase::COMMAND) {
|
||||
this->bus_obj->assert_ctrl_line(this->scsi_id, SCSI_CTRL_REQ);
|
||||
if (this->prepare_data()) {
|
||||
this->bus_obj->assert_ctrl_line(this->scsi_id, SCSI_CTRL_REQ);
|
||||
} else {
|
||||
ABORT_F("ScsiDevice: prepare_data() failed");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ScsiPhase::STATUS:
|
||||
this->bus_obj->release_ctrl_line(this->scsi_id, SCSI_CTRL_REQ);
|
||||
this->data_ptr = this->msg_buf;
|
||||
this->data_size = 1;
|
||||
this->switch_phase(ScsiPhase::MESSAGE_IN);
|
||||
break;
|
||||
@@ -133,45 +137,45 @@ void ScsiPhysDevice::next_step()
|
||||
this->switch_phase(ScsiPhase::BUS_FREE);
|
||||
break;
|
||||
default:
|
||||
LOG_F(WARNING, "%s: nothing to do for phase %d", this->name.c_str(), this->cur_phase);
|
||||
LOG_F(WARNING, "ScsiDevice: nothing to do for phase %d", this->cur_phase);
|
||||
}
|
||||
}
|
||||
|
||||
void ScsiPhysDevice::prepare_xfer() {
|
||||
this->cur_phase = this->bus_obj->current_phase();
|
||||
void ScsiDevice::prepare_xfer(ScsiBus* bus_obj, int& bytes_in, int& bytes_out)
|
||||
{
|
||||
this->cur_phase = bus_obj->current_phase();
|
||||
|
||||
switch (this->cur_phase) {
|
||||
case ScsiPhase::COMMAND: // handled in xfer_data()
|
||||
case ScsiPhase::COMMAND:
|
||||
this->data_ptr = this->cmd_buf;
|
||||
this->data_size = 0;
|
||||
bytes_out = 0;
|
||||
break;
|
||||
case ScsiPhase::STATUS:
|
||||
this->data_ptr = &this->status;
|
||||
this->data_size = 1;
|
||||
bytes_out = 1;
|
||||
break;
|
||||
case ScsiPhase::DATA_IN:
|
||||
this->data_ptr = this->buf_ptr;
|
||||
this->data_size = this->xfer_len;
|
||||
bytes_out = this->data_size;
|
||||
break;
|
||||
case ScsiPhase::DATA_OUT:
|
||||
this->data_ptr = this->buf_ptr;
|
||||
this->incoming_size = this->xfer_len;
|
||||
this->data_size = 0;
|
||||
break;
|
||||
case ScsiPhase::MESSAGE_OUT: // handled in xfer_data()
|
||||
case ScsiPhase::MESSAGE_OUT:
|
||||
this->data_ptr = this->msg_buf;
|
||||
this->data_size = bytes_in;
|
||||
bytes_out = 0;
|
||||
break;
|
||||
case ScsiPhase::MESSAGE_IN: // HACK: this->data_size is initialized elsewhere
|
||||
this->data_ptr = this->msg_buf;
|
||||
case ScsiPhase::MESSAGE_IN:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
ABORT_F("ScsiDevice: unhandled phase %d in prepare_xfer()", this->cur_phase);
|
||||
}
|
||||
}
|
||||
|
||||
static const int CmdGroupLen[8] = {6, 10, 10, -1, -1, 12, -1, -1};
|
||||
|
||||
int ScsiPhysDevice::xfer_data() {
|
||||
int ScsiDevice::xfer_data() {
|
||||
this->cur_phase = bus_obj->current_phase();
|
||||
|
||||
switch (this->cur_phase) {
|
||||
@@ -183,7 +187,7 @@ int ScsiPhysDevice::xfer_data() {
|
||||
} else {
|
||||
this->process_message();
|
||||
}
|
||||
if (this->last_selection_has_attention)
|
||||
if (this->last_selection_has_atention)
|
||||
this->last_selection_message = this->msg_buf[0];
|
||||
}
|
||||
break;
|
||||
@@ -199,74 +203,45 @@ int ScsiPhysDevice::xfer_data() {
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ABORT_F("%s: unhandled phase %d in xfer_data()", this->name.c_str(),
|
||||
this->cur_phase);
|
||||
ABORT_F("ScsiDevice: unhandled phase %d in xfer_data()", this->cur_phase);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ScsiPhysDevice::send_data(uint8_t* dst_ptr, const int count)
|
||||
int ScsiDevice::send_data(uint8_t* dst_ptr, const int count)
|
||||
{
|
||||
if (dst_ptr == nullptr || !count)
|
||||
if (dst_ptr == nullptr || !count) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int remainder = count;
|
||||
int actual_count = std::min(this->data_size, count);
|
||||
|
||||
while (remainder) {
|
||||
if (this->data_size) {
|
||||
int chunk_size = std::min(this->data_size, remainder);
|
||||
if (chunk_size) {
|
||||
std::memcpy(dst_ptr, this->data_ptr, chunk_size);
|
||||
dst_ptr += chunk_size;
|
||||
this->data_ptr += chunk_size;
|
||||
this->data_size -= chunk_size;
|
||||
remainder -= chunk_size;
|
||||
}
|
||||
}
|
||||
if (!this->data_size) {
|
||||
if (!this->read_more_data(&this->data_size, &this->data_ptr))
|
||||
break;
|
||||
std::memcpy(dst_ptr, this->data_ptr, actual_count);
|
||||
this->data_ptr += actual_count;
|
||||
this->data_size -= actual_count;
|
||||
|
||||
// attempt to return the requested amount of data
|
||||
// when data_size drops down to zero
|
||||
if (!this->data_size) {
|
||||
if (this->get_more_data() && count > actual_count) {
|
||||
dst_ptr += actual_count;
|
||||
actual_count = std::min(this->data_size, count - actual_count);
|
||||
std::memcpy(dst_ptr, this->data_ptr, actual_count);
|
||||
this->data_ptr += actual_count;
|
||||
this->data_size -= actual_count;
|
||||
}
|
||||
}
|
||||
|
||||
return count - remainder;
|
||||
return actual_count;
|
||||
}
|
||||
|
||||
int ScsiPhysDevice::rcv_data(const uint8_t* src_ptr, const int count)
|
||||
int ScsiDevice::rcv_data(const uint8_t* src_ptr, const int count)
|
||||
{
|
||||
if (src_ptr == nullptr || !count)
|
||||
return 0;
|
||||
|
||||
// DATA_OUT can transfer big data in several chunks while crossing buffer boundaries
|
||||
if (this->cur_phase == ScsiPhase::DATA_OUT) {
|
||||
int remainder = count;
|
||||
|
||||
while (remainder) {
|
||||
if (this->data_size < this->incoming_size) {
|
||||
int chunk_size = std::min(this->incoming_size - this->data_size, remainder);
|
||||
if (chunk_size) {
|
||||
std::memcpy(this->data_ptr, src_ptr, chunk_size);
|
||||
src_ptr += chunk_size;
|
||||
this->data_ptr += chunk_size;
|
||||
this->data_size += chunk_size;
|
||||
remainder -= chunk_size;
|
||||
}
|
||||
}
|
||||
if (this->data_size >= this->incoming_size) {
|
||||
if (!this->write_more_data(&this->incoming_size, &this->data_ptr))
|
||||
break;
|
||||
this->data_size = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return count - remainder;
|
||||
} else {
|
||||
// accumulating incoming data in the pre-configured buffer
|
||||
std::memcpy(this->data_ptr, src_ptr, count);
|
||||
this->data_ptr += count;
|
||||
this->data_size += count;
|
||||
}
|
||||
// accumulating incoming data in the pre-configured buffer
|
||||
std::memcpy(this->data_ptr, src_ptr, count);
|
||||
this->data_ptr += count;
|
||||
this->data_size += count;
|
||||
|
||||
if (this->cur_phase == ScsiPhase::COMMAND)
|
||||
this->next_step();
|
||||
@@ -274,7 +249,42 @@ int ScsiPhysDevice::rcv_data(const uint8_t* src_ptr, const int count)
|
||||
return count;
|
||||
}
|
||||
|
||||
void ScsiPhysDevice::process_message() {
|
||||
bool ScsiDevice::check_lun() {
|
||||
if (this->cmd_buf[1] >> 5 != this->lun) {
|
||||
LOG_F(ERROR, "%s: non-matching LUN", this->name.c_str());
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_LUN;
|
||||
this->ascq = 0;
|
||||
this->sksv = 0;
|
||||
this->field = 0;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ScsiDevice::illegal_command(const uint8_t *cmd) {
|
||||
LOG_F(ERROR, "%s: unsupported command: 0x%02x", this->name.c_str(), cmd[0]);
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = ScsiSense::ILLEGAL_REQ;
|
||||
this->asc = ScsiError::INVALID_CMD;
|
||||
this->ascq = 0;
|
||||
this->sksv = 0xC0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||
this->field = 0;
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
}
|
||||
|
||||
void ScsiDevice::report_error(uint8_t sense_key, uint8_t asc) {
|
||||
this->status = ScsiStatus::CHECK_CONDITION;
|
||||
this->sense = sense_key;
|
||||
this->asc = asc;
|
||||
this->ascq = 0;
|
||||
this->sksv = 0xC0; // sksv=1, C/D=Command, BPV=0, BP=0
|
||||
this->switch_phase(ScsiPhase::STATUS);
|
||||
}
|
||||
|
||||
void ScsiDevice::process_message() {
|
||||
static int sdtr_response_seq[4] = {ScsiPhase::MESSAGE_OUT, ScsiPhase::MESSAGE_IN,
|
||||
ScsiPhase::COMMAND, -1};
|
||||
|
||||
Loaded 100 of 206 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user