From 076df971efc5672c6d3b73597ac2c02dbd2e07da Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 19 Dec 2024 01:18:26 +0200 Subject: [PATCH 1/2] vita: disable drc thread tc writes from a thread cause data abort, and sceKernelOpenVMDomain() returns 80010058 which https://wiki.henkaku.xyz/vita/SceSblSsMgr mentions as SCE_ERROR_ERRNO_ENOSYS, aka "Invalid system call number"? --- Makefile.libretro | 1 + libpcsxcore/new_dynarec/emu_if.c | 7 ------- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Makefile.libretro b/Makefile.libretro index 7ef285d5..18b4deeb 100644 --- a/Makefile.libretro +++ b/Makefile.libretro @@ -347,6 +347,7 @@ else ifeq ($(platform), vita) PARTIAL_LINKING = 1 NO_MMAP := 1 NO_POSIX_MEMALIGN := 1 + NDRC_THREAD := 0 # can't write to tc from thread HAVE_PHYSICAL_CDROM = 0 EXTRA_EXTERN_SYMS += _newlib_vm_size_user diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 5042bf58..a9122c81 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -24,9 +24,6 @@ #include "../../frontend/libretro-rthreads.h" #include "features/features_cpu.h" #include "retro_timers.h" -#ifdef VITA -#include -#endif #endif #ifdef _3DS #include <3ds_utils.h> @@ -449,10 +446,6 @@ static void ari64_compile_thread(void *unused) void *target; u32 addr; -#ifdef VITA - int ret = sceKernelOpenVMDomain(); - if (ret) SysPrintf("thread: sceKernelOpenVMDomain: %x\n", ret); -#endif slock_lock(ndrc_g.thread.lock); while (!ndrc_g.thread.exit) { From a1d828274f84fb360a5a1e5957c32a02b4e1cd8f Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 19 Dec 2024 02:23:00 +0200 Subject: [PATCH 2/2] gpulib: unbreak debug logs --- plugins/gpulib/gpu.c | 30 +++++++++++++++--------------- plugins/gpulib/gpu.h | 4 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/plugins/gpulib/gpu.c b/plugins/gpulib/gpu.c index 88aa6704..677e18b5 100644 --- a/plugins/gpulib/gpu.c +++ b/plugins/gpulib/gpu.c @@ -493,7 +493,7 @@ static noinline void start_vram_transfer(struct psx_gpu *gpu, uint32_t pos_word, uint32_t size_word, int is_read) { if (gpu->dma.h) - log_anomaly("start_vram_transfer while old unfinished\n"); + log_anomaly(gpu, "start_vram_transfer while old unfinished\n"); gpu->dma.x = pos_word & 0x3ff; gpu->dma.y = (pos_word >> 16) & 0x1ff; @@ -511,7 +511,7 @@ static noinline void start_vram_transfer(struct psx_gpu *gpu, uint32_t pos_word, gpu->state.last_vram_read_frame = *gpu->state.frame_count; } - log_io("start_vram_transfer %c (%d, %d) %dx%d\n", is_read ? 'r' : 'w', + log_io(gpu, "start_vram_transfer %c (%d, %d) %dx%d\n", is_read ? 'r' : 'w', gpu->dma.x, gpu->dma.y, gpu->dma.w, gpu->dma.h); if (gpu->gpu_state_change) gpu->gpu_state_change(PGS_VRAM_TRANSFER_START); @@ -532,7 +532,7 @@ static void finish_vram_transfer(struct psx_gpu *gpu, int is_read) not_dirty |= dma_r - gpu->screen.src_x - 1; not_dirty |= dma_b - gpu->screen.src_y - 1; not_dirty >>= 31; - log_io("dma %3d,%3d %dx%d scr %3d,%3d %3dx%3d -> dirty %d\n", + log_io(gpu, "dma %3d,%3d %dx%d scr %3d,%3d %3dx%3d -> dirty %d\n", gpu->dma_start.x, gpu->dma_start.y, gpu->dma_start.w, gpu->dma_start.h, gpu->screen.src_x, gpu->screen.src_y, gpu->screen.hres, gpu->screen.vres, !not_dirty); gpu->state.fb_dirty |= !not_dirty; @@ -715,7 +715,7 @@ static noinline int do_cmd_buffer(struct psx_gpu *gpu, uint32_t *data, int count if (cmd == 2) break; if (cmd == 0x1f) - log_anomaly("irq1?\n"); + log_anomaly(gpu, "irq1?\n"); pos++; continue; } @@ -764,19 +764,19 @@ void GPUwriteDataMem(uint32_t *mem, int count) { int dummy = 0, left; - log_io("gpu_dma_write %p %d\n", mem, count); + log_io(&gpu, "gpu_dma_write %p %d\n", mem, count); if (unlikely(gpu.cmd_len > 0)) flush_cmd_buffer(&gpu); left = do_cmd_buffer(&gpu, mem, count, &dummy, &dummy); if (left) - log_anomaly("GPUwriteDataMem: discarded %d/%d words\n", left, count); + log_anomaly(&gpu, "GPUwriteDataMem: discarded %d/%d words\n", left, count); } void GPUwriteData(uint32_t data) { - log_io("gpu_write %08x\n", data); + log_io(&gpu, "gpu_write %08x\n", data); gpu.cmd_buffer[gpu.cmd_len++] = HTOLE32(data); if (gpu.cmd_len >= CMD_BUFFER_LEN) flush_cmd_buffer(&gpu); @@ -795,7 +795,7 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, if (unlikely(gpu.cmd_len > 0)) flush_cmd_buffer(&gpu); - log_io("gpu_dma_chain\n"); + log_io(&gpu, "gpu_dma_chain\n"); addr = ld_addr = start_addr & 0xffffff; for (count = 0; (addr & 0x800000) == 0; count++) { @@ -808,11 +808,11 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, if (len > 0) cpu_cycles_sum += 5 + len; - log_io(".chain %08lx #%d+%d %u+%u\n", + log_io(&gpu, ".chain %08lx #%d+%d %u+%u\n", (long)(list - rambase) * 4, len, gpu.cmd_len, cpu_cycles_sum, cpu_cycles_last); if (unlikely(gpu.cmd_len > 0)) { if (gpu.cmd_len + len > ARRAY_SIZE(gpu.cmd_buffer)) { - log_anomaly("cmd_buffer overflow, likely garbage commands\n"); + log_anomaly(&gpu, "cmd_buffer overflow, likely garbage commands\n"); gpu.cmd_len = 0; } memcpy(gpu.cmd_buffer + gpu.cmd_len, list + 1, len * 4); @@ -826,7 +826,7 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, if (left) { memcpy(gpu.cmd_buffer, list + 1 + len - left, left * 4); gpu.cmd_len = left; - log_anomaly("GPUdmaChain: %d/%d words left\n", left, len); + log_anomaly(&gpu, "GPUdmaChain: %d/%d words left\n", left, len); } } @@ -835,7 +835,7 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, break; } if (addr == ld_addr) { - log_anomaly("GPUdmaChain: loop @ %08x, cnt=%u\n", addr, count); + log_anomaly(&gpu, "GPUdmaChain: loop @ %08x, cnt=%u\n", addr, count); break; } if (count == ld_count) { @@ -856,7 +856,7 @@ long GPUdmaChain(uint32_t *rambase, uint32_t start_addr, void GPUreadDataMem(uint32_t *mem, int count) { - log_io("gpu_dma_read %p %d\n", mem, count); + log_io(&gpu, "gpu_dma_read %p %d\n", mem, count); if (unlikely(gpu.cmd_len > 0)) flush_cmd_buffer(&gpu); @@ -879,7 +879,7 @@ uint32_t GPUreadData(void) ret = LE32TOH(ret); } - log_io("gpu_read %08x\n", ret); + log_io(&gpu, "gpu_read %08x\n", ret); return ret; } @@ -891,7 +891,7 @@ uint32_t GPUreadStatus(void) flush_cmd_buffer(&gpu); ret = gpu.status; - log_io("gpu_read_status %08x\n", ret); + log_io(&gpu, "gpu_read_status %08x\n", ret); return ret; } diff --git a/plugins/gpulib/gpu.h b/plugins/gpulib/gpu.h index 570d8421..7a84a254 100644 --- a/plugins/gpulib/gpu.h +++ b/plugins/gpulib/gpu.h @@ -15,8 +15,8 @@ //#define RAW_FB_DISPLAY -#define gpu_log(fmt, ...) \ - printf("%d:%03d: " fmt, *gpu.state.frame_count, *gpu.state.hcnt, ##__VA_ARGS__) +#define gpu_log(gpu, fmt, ...) \ + printf("%d:%03d: " fmt, *(gpu)->state.frame_count, *(gpu)->state.hcnt, ##__VA_ARGS__) //#define log_anomaly gpu_log #define log_anomaly(...)