Browse Source

remove old debugging changes

remotes/1785372757367212240/tmp_refs/heads/variable-page-size
Exverge 1 month ago
parent
commit
8ed9805d8e
No known key found for this signature in database GPG Key ID: DAD399BCC5FB77E4
  1. 6
      src/core/arm/nce/arm_nce.cpp
  2. 20
      src/core/arm/nce/arm_nce.s
  3. 2
      src/core/arm/nce/arm_nce_asm_definitions.h
  4. 6
      src/core/arm/nce/guest_context.h
  5. 4
      src/core/arm/nce/interpreter_visitor.h
  6. 2
      src/core/hle/kernel/svc/svc_debug_string.cpp

6
src/core/arm/nce/arm_nce.cpp

@ -16,6 +16,10 @@
#include "core/hle/kernel/k_process.h"
#include <unistd.h>
#include <sys/syscall.h>
#include <signal.h>
namespace Core {
namespace {
@ -368,7 +372,7 @@ void ArmNce::SignalInterrupt(Kernel::KThread* thread) {
// The running thread will unlock the thread context.
#if defined(__linux__)
syscall(SYS_tkill, m_thread_id, BreakFromRunCodeSignal);
#elif defined(TARGET_OS_MAC) && defined(__aarch64__)
#elif defined(__APPLE__) && defined(__aarch64__)
asm volatile(
"mov x0, %0\n" // m_thread_id
"mov x1, %1\n" // BreakFromRunCodeSignal

20
src/core/arm/nce/arm_nce.s

@ -8,7 +8,7 @@
movk reg, #(((val) >> 0x10) & 0xFFFF), lsl #16
#ifdef __APPLE__
#define func(name) _##name
#define SYM(name) _##name
.macro ASM_FUNCTION_START name
@ -19,7 +19,7 @@ _\name:
.endm
#else
#define func(name) name
#define SYM(name) name
.macro ASM_FUNCTION_START name
.section .text.\name, "ax", %progbits
@ -89,7 +89,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce37ReturnToRunCodeByExceptionLevelChangeEiPv
mov x8, #(__NR_tkill)
svc #0
#else
mov x16, #328
mov x16, #(__pthread_pkill)
svc #0x80
#endif
@ -104,7 +104,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalH
/* Call the context restorer with the raw context. */
mov x0, x2
bl func(_ZN4Core6ArmNce19RestoreGuestContextEPv)
bl SYM(_ZN4Core6ArmNce19RestoreGuestContextEPv)
/* Save the old value of tpidr_el0. */
mrs x8, tpidr_el0
@ -115,7 +115,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce50ReturnToRunCodeByExceptionLevelChangeSignalH
msr tpidr_el0, x0
/* Unlock the context. */
bl func(_ZN4Core6ArmNce22UnlockThreadParametersEPv)
bl SYM(_ZN4Core6ArmNce22UnlockThreadParametersEPv)
/* Returning from here will enter the guest. */
ldp x29, x30, [sp], #0x10
@ -141,7 +141,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce29BreakFromRunCodeSignalHandlerEiPvS1_
/* Tail call the restorer. */
mov x1, x2
b func(_ZN4Core6ArmNce16SaveGuestContextEPNS_12GuestContextEPv)
b SYM(_ZN4Core6ArmNce16SaveGuestContextEPNS_12GuestContextEPv)
/* Returning from here will enter host code. */
@ -163,7 +163,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_
/* Incorrect TLS magic, so this is a host fault. */
/* Tail call the handler. */
b func(_ZN4Core6ArmNce24HandleHostAlignmentFaultEiPvS1_)
b SYM(_ZN4Core6ArmNce24HandleHostAlignmentFaultEiPvS1_)
1:
/* Correct TLS magic, so this is a guest fault. */
@ -180,7 +180,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce32GuestAlignmentFaultSignalHandlerEiPvS1_
msr tpidr_el0, x3
/* Call the handler. */
bl func(_ZN4Core6ArmNce25HandleGuestAlignmentFaultEPNS_12GuestContextEPvS3_)
bl SYM(_ZN4Core6ArmNce25HandleGuestAlignmentFaultEPNS_12GuestContextEPvS3_)
/* If the handler returned false, we want to preserve the host tpidr_el0. */
cbz x0, 2f
@ -206,7 +206,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_
/* Incorrect TLS magic, so this is a host fault. */
/* Tail call the handler. */
b func(_ZN4Core6ArmNce21HandleHostAccessFaultEiPvS1_)
b SYM(_ZN4Core6ArmNce21HandleHostAccessFaultEiPvS1_)
1:
/* Correct TLS magic, so this is a guest fault. */
@ -223,7 +223,7 @@ ASM_FUNCTION_START _ZN4Core6ArmNce29GuestAccessFaultSignalHandlerEiPvS1_
msr tpidr_el0, x3
/* Call the handler. */
bl func(_ZN4Core6ArmNce22HandleGuestAccessFaultEPNS_12GuestContextEPvS3_)
bl SYM(_ZN4Core6ArmNce22HandleGuestAccessFaultEPNS_12GuestContextEPvS3_)
/* If the handler returned false, we want to preserve the host tpidr_el0. */
cbz x0, 2f

2
src/core/arm/nce/arm_nce_asm_definitions.h

@ -16,6 +16,8 @@
#define SIGURG 16
#define SIGSEGV 11
#define SIGBUS 10
#define __pthread_pkill 328
#endif
#define ReturnToRunCodeByExceptionLevelChangeSignal SIGUSR2

6
src/core/arm/nce/guest_context.h

@ -14,9 +14,7 @@
#include "core/arm/nce/arm_nce_asm_definitions.h"
#ifdef __linux__
#include <unistd.h>
#include <sys/syscall.h>
#include <signal.h>
#include <asm/sigcontext.h>
#endif
namespace Core {
@ -142,7 +140,7 @@ static_assert(offsetof(HostContext, host_tpidr_el0) == HostContextTpidrEl0);
static_assert(offsetof(HostContext, host_saved_regs) == HostContextRegs);
static_assert(offsetof(HostContext, host_saved_vregs) == HostContextVregs);
#ifdef TARGET_OS_MAC
#ifdef __APPLE__
// ensure that fp and lr are next to the rest of the x registers so they can be accessed like an array
static_assert(offsetof(_STRUCT_ARM_THREAD_STATE64, __sp) - offsetof(_STRUCT_ARM_THREAD_STATE64, __x) == sizeof(u64) * 31);
#endif

4
src/core/arm/nce/interpreter_visitor.h

@ -18,9 +18,9 @@
#include "core/arm/nce/visitor_base.h"
namespace Core {
class KernelContext;
class KernelContext;
namespace Memory {
namespace Memory {
class Memory;
}

2
src/core/hle/kernel/svc/svc_debug_string.cpp

@ -50,7 +50,7 @@ Result OutputDebugString(Core::System& system, u64 address, u64 len) {
if (flusher_data.msg_buffer.back() == '\n')
flusher_data.msg_buffer.pop_back();
LOG_CRITICAL(Debug_Emulated, "\n{}", flusher_data.msg_buffer);
LOG_INFO(Debug_Emulated, "\n{}", flusher_data.msg_buffer);
flusher_data.msg_buffer.clear();
}
if (stop_token.stop_requested()) break;

Loading…
Cancel
Save