Skip to content

Commit e40df2d

Browse files
authored
Merge branch 'PCSX2:master' into Multiple-Displays
2 parents 5310c9a + 2d2bfd6 commit e40df2d

File tree

8 files changed

+36
-25
lines changed

8 files changed

+36
-25
lines changed

.github/workflows/check_pr_commits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee
1717
with:
1818
accessToken: ${{ secrets.GITHUB_TOKEN }}
19-
pattern: '^[A-Z][A-Za-z0-9 \["]+:.+'
19+
pattern: '^[A-Z][A-Za-z0-9 \["\/\\]+:.+'
2020
excludeTitle: true
2121
excludeDescription: true
2222
checkAllCommitMessages: true

.github/workflows/windows_build_qt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ jobs:
105105

106106
- name: Setup msbuild
107107
if: inputs.configuration != 'CMake'
108-
uses: microsoft/setup-msbuild@v2
108+
uses: microsoft/setup-msbuild@v3
109109

110110
- name: Download patches
111111
shell: cmd

bin/resources/game_controller_db.txt

Lines changed: 6 additions & 5 deletions
Large diffs are not rendered by default.

common/Darwin/DarwinMisc.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,7 @@ namespace PageFaultHandler
578578
{
579579
#ifdef USE_MACH_EXCEPTION_PORTS
580580
static void SignalHandler(mach_port_t port);
581+
static mach_port_t s_port = 0;
581582
#else
582583
static void SignalHandler(int sig, siginfo_t* info, void* ctx);
583584
#endif
@@ -661,7 +662,6 @@ void PageFaultHandler::SignalHandler(mach_port_t port)
661662
return;
662663
}
663664

664-
s_exception_handler_mutex.lock();
665665
thread_state64_t* state = (thread_state64_t*)msg_in.old_state;
666666

667667
HandlerResult result = HandlerResult::ExecuteNextHandler;
@@ -686,15 +686,10 @@ void PageFaultHandler::SignalHandler(mach_port_t port)
686686

687687
if (result != HandlerResult::ContinueExecution) // cooked
688688
{
689+
// Continue to the next exception handler (debugger or crash)
689690
msg_out.RetCode = KERN_FAILURE;
690691
msg_out.flavor = 0;
691692
msg_out.new_stateCnt = 0;
692-
693-
// The crash handler on macOS or Linux doesn't use context passed to it
694-
// Stubbing it here is fine
695-
CrashHandler::CrashSignalHandler(-1, nullptr, nullptr);
696-
697-
pxFailRel("CrashSignalHandler returned when it should have terminated us!");
698693
}
699694
else
700695
{
@@ -709,8 +704,6 @@ void PageFaultHandler::SignalHandler(mach_port_t port)
709704
offsetof(__typeof__(msg_out), new_state) + msg_out.new_stateCnt * sizeof(natural_t);
710705
send_size = msg_out.Head.msgh_size;
711706
option |= MACH_SEND_MSG;
712-
713-
s_exception_handler_mutex.unlock();
714707
}
715708
}
716709

@@ -751,22 +744,27 @@ bool PageFaultHandler::Install(Error* error)
751744
return false;
752745
}
753746

754-
if ((r = mach_port_mod_refs(mach_task_self(), port, MACH_PORT_RIGHT_SEND, -1)))
755-
{
756-
mach_port_deallocate(mach_task_self(), port);
757-
pxFailRel(fmt::format("mach_port_mod_refs: {:x}", r).c_str());
758-
return false;
759-
}
760-
761747
mach_port_t previous;
762748
if ((r = mach_port_request_notification(mach_task_self(), port, MACH_NOTIFY_NO_SENDERS, 0, port, MACH_MSG_TYPE_MAKE_SEND_ONCE, &previous)))
763749
{
764750
mach_port_deallocate(mach_task_self(), port);
765-
pxFailRel(fmt::format("mach_port_mod_refs: {:x}", r).c_str());
751+
pxFailRel(fmt::format("mach_port_request_notification: {:x}", r).c_str());
766752
return false;
767753
}
768754

769755
s_installed = true;
756+
s_port = port;
757+
return true;
758+
}
759+
760+
bool PageFaultHandler::InstallSecondaryThread()
761+
{
762+
kern_return_t r = thread_set_exception_ports(mach_thread_self(), EXC_MASK_BAD_ACCESS, s_port, EXCEPTION_STATE | MACH_EXCEPTION_CODES, THREAD_STATE64);
763+
if (r)
764+
{
765+
pxFailRel(fmt::format("thread_set_exception_ports(secondary): {:x}", r).c_str());
766+
return false;
767+
}
770768
return true;
771769
}
772770

@@ -839,4 +837,6 @@ bool PageFaultHandler::Install(Error* error)
839837
s_installed = true;
840838
return true;
841839
}
840+
841+
bool PageFaultHandler::InstallSecondaryThread() { return true; }
842842
#endif

common/HostSys.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ namespace PageFaultHandler
142142

143143
HandlerResult HandlePageFault(void* exception_pc, void* fault_address, bool is_write);
144144
bool Install(Error* error = nullptr);
145+
bool InstallSecondaryThread();
145146
} // namespace PageFaultHandler
146147

147148
class SharedMemoryMappingArea

common/Linux/LnxHostSys.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,5 @@ bool PageFaultHandler::Install(Error* error)
370370
s_installed = true;
371371
return true;
372372
}
373+
374+
bool PageFaultHandler::InstallSecondaryThread() { return true; }

common/Windows/WinHostSys.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,3 +373,5 @@ bool PageFaultHandler::Install(Error* error)
373373
s_installed = true;
374374
return true;
375375
}
376+
377+
bool PageFaultHandler::InstallSecondaryThread() { return true; }

pcsx2/MTGS.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ void MTGS::ThreadEntryPoint()
145145
{
146146
Threading::SetNameOfCurrentThread("GS");
147147

148+
// GS can hit SMC write traps when executing InitAndReadFIFO
149+
// As racey as it sounds, it should be safe, since InitAndReadFIFO is requested and immediately waited for,
150+
// so the EE thread shouldn't be touching any of its codegen structures while it happens.
151+
PageFaultHandler::InstallSecondaryThread();
152+
148153
// Explicitly set rounding mode to default (nearest, FTZ off).
149154
// Otherwise it appears to get inherited from the EE thread on Linux.
150155
FPControlRegister::SetCurrent(FPControlRegister::GetDefault());
@@ -1077,4 +1082,4 @@ void Gif_AddBlankGSPacket(u32 size, GIF_PATH path)
10771082
void Gif_MTGS_Wait(bool isMTVU)
10781083
{
10791084
MTGS::WaitGS(false, true, isMTVU);
1080-
}
1085+
}

0 commit comments

Comments
 (0)