From a37e016bdfbd830b04c3d0f27502202d7575134f Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Sat, 28 Sep 2024 10:35:47 -0700 Subject: [PATCH 1/3] Speeding up kernel hooks a bit. --- src/core/r3000a.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core/r3000a.cc b/src/core/r3000a.cc index 851d97957..9e6ea7e9f 100644 --- a/src/core/r3000a.cc +++ b/src/core/r3000a.cc @@ -433,14 +433,14 @@ std::unique_ptr PCSX::Cpus::DynaRec() { } void PCSX::R3000Acpu::processA0KernelCall(uint32_t call) { - auto r = m_regs.GPR.n; + auto& r = m_regs.GPR.n; switch (call) { case 0x03: { // write if (r.a0 != 1) break; IO memFile = g_emulator->m_mem->getMemoryAsFile(); uint32_t size = r.a2; - m_regs.GPR.n.v0 = size; + r.v0 = size; memFile->rSeek(r.a1); while (size--) { g_system->biosPutc(memFile->getc()); @@ -468,14 +468,14 @@ void PCSX::R3000Acpu::processA0KernelCall(uint32_t call) { } void PCSX::R3000Acpu::processB0KernelCall(uint32_t call) { - auto r = m_regs.GPR.n; + auto& r = m_regs.GPR.n; switch (call) { case 0x35: { // write if (r.a0 != 1) break; IO memFile = g_emulator->m_mem->getMemoryAsFile(); uint32_t size = r.a2; - m_regs.GPR.n.v0 = size; + r.v0 = size; memFile->rSeek(r.a1); while (size--) { g_system->biosPutc(memFile->getc()); From 1abee5aeaf87d4e288b36333b8f69b7986fe8c03 Mon Sep 17 00:00:00 2001 From: Nicolas Noble Date: Sat, 28 Sep 2024 20:50:15 -0700 Subject: [PATCH 2/3] Updating the disassembly of the break opcode. --- src/core/disr3000a.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/disr3000a.cc b/src/core/disr3000a.cc index f9463fe9c..2d1db7c99 100644 --- a/src/core/disr3000a.cc +++ b/src/core/disr3000a.cc @@ -716,7 +716,12 @@ declare(disMTLO) { *********************************************************/ declare(disBREAK) { dOpCode("break"); - Imm32((code >> 6) & 0xfffff); + unsigned category = (code >> 16) & 0x3ff; + unsigned exCode = (code >> 6) & 0x3ff; + Imm16(category); + if (exCode != 0) { + Imm16(exCode); + } } declare(disRFE) { dOpCode("rfe"); } declare(disSYSCALL) { From 0f72ff93afd58f811f87d4413da2fff360c3f424 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 30 Sep 2024 21:14:47 -0700 Subject: [PATCH 3/3] Adding mirrors for GNU URLs in scripts. --- tools/linux-mips/spawn-compiler.sh | 8 ++++++-- tools/macos-mips/mipsel-none-elf-binutils.rb | 1 + tools/macos-mips/mipsel-none-elf-gcc.rb | 1 + tools/macos-mips/mipsel-none-elf-gdb.rb | 1 + .../vscode-extension/scripts/mipsel-none-elf-binutils.rb | 1 + tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb | 1 + tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb | 1 + 7 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/linux-mips/spawn-compiler.sh b/tools/linux-mips/spawn-compiler.sh index 603569bfb..db8addfb3 100755 --- a/tools/linux-mips/spawn-compiler.sh +++ b/tools/linux-mips/spawn-compiler.sh @@ -13,7 +13,9 @@ set -ex PREFIX=${PREFIX:-"/usr/local"} -wget https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.gz +for url in https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.gz https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz ; do + wget --timeout=60 --continue $url && break +done tar xvfz binutils-2.43.tar.gz cd binutils-2.43 ./configure --target=mipsel-none-elf --disable-multilib --disable-nls --disable-werror --prefix=$PREFIX @@ -21,7 +23,9 @@ make make install-strip cd .. -wget https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz +for url in https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.gz ; do + wget --timeout=60 --continue $url && break +done tar xvfz gcc-14.2.0.tar.gz cd gcc-14.2.0 ./contrib/download_prerequisites diff --git a/tools/macos-mips/mipsel-none-elf-binutils.rb b/tools/macos-mips/mipsel-none-elf-binutils.rb index fb4072816..e05ed52f7 100644 --- a/tools/macos-mips/mipsel-none-elf-binutils.rb +++ b/tools/macos-mips/mipsel-none-elf-binutils.rb @@ -2,6 +2,7 @@ class MipselNoneElfBinutils < Formula desc "FSF Binutils for mipsel cross development" homepage "https://www.gnu.org/software/binutils/" url "https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.gz" + mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz" sha256 "025c436d15049076ebe511d29651cc4785ee502965a8839936a65518582bdd64" depends_on "texinfo" => :build diff --git a/tools/macos-mips/mipsel-none-elf-gcc.rb b/tools/macos-mips/mipsel-none-elf-gcc.rb index 0a8ffdb15..9b61b3ca2 100644 --- a/tools/macos-mips/mipsel-none-elf-gcc.rb +++ b/tools/macos-mips/mipsel-none-elf-gcc.rb @@ -2,6 +2,7 @@ class MipselNoneElfGcc < Formula desc "The GNU compiler collection for mipsel" homepage "https://gcc.gnu.org" url "https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" sha256 "a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9" depends_on "gmp" diff --git a/tools/macos-mips/mipsel-none-elf-gdb.rb b/tools/macos-mips/mipsel-none-elf-gdb.rb index 753893f0b..d44976df7 100644 --- a/tools/macos-mips/mipsel-none-elf-gdb.rb +++ b/tools/macos-mips/mipsel-none-elf-gdb.rb @@ -2,6 +2,7 @@ class MipselNoneElfGdb < Formula desc "GDB: The GNU Project Debugger compiled for Mips" homepage "https://sourceware.org/gdb/" url "https://ftp.gnu.org/gnu/gdb/gdb-15.1.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gdb/gdb-15.1.tar.xz" sha256 "38254eacd4572134bca9c5a5aa4d4ca564cbbd30c369d881f733fb6b903354f2" # inspired by https://github.com/orgs/Homebrew/discussions/1114#discussioncomment-8863715 diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb b/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb index fb4072816..e05ed52f7 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-binutils.rb @@ -2,6 +2,7 @@ class MipselNoneElfBinutils < Formula desc "FSF Binutils for mipsel cross development" homepage "https://www.gnu.org/software/binutils/" url "https://ftp.gnu.org/gnu/binutils/binutils-2.43.tar.gz" + mirror "https://mirrors.kernel.org/gnu/binutils/binutils-2.43.tar.gz" sha256 "025c436d15049076ebe511d29651cc4785ee502965a8839936a65518582bdd64" depends_on "texinfo" => :build diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb b/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb index 0a8ffdb15..9b61b3ca2 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-gcc.rb @@ -2,6 +2,7 @@ class MipselNoneElfGcc < Formula desc "The GNU compiler collection for mipsel" homepage "https://gcc.gnu.org" url "https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz" sha256 "a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9" depends_on "gmp" diff --git a/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb b/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb index 753893f0b..d44976df7 100644 --- a/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb +++ b/tools/vscode-extension/scripts/mipsel-none-elf-gdb.rb @@ -2,6 +2,7 @@ class MipselNoneElfGdb < Formula desc "GDB: The GNU Project Debugger compiled for Mips" homepage "https://sourceware.org/gdb/" url "https://ftp.gnu.org/gnu/gdb/gdb-15.1.tar.xz" + mirror "https://mirrors.kernel.org/gnu/gdb/gdb-15.1.tar.xz" sha256 "38254eacd4572134bca9c5a5aa4d4ca564cbbd30c369d881f733fb6b903354f2" # inspired by https://github.com/orgs/Homebrew/discussions/1114#discussioncomment-8863715