Repository navigation
PSX3DS v0.2.1 — Fix New 3DS Startup Crash (svcBreak in __system_allocateHeaps)
PSX3DS v0.2.1 — Fix New 3DS Startup Crash (svcBreak in __system_allocateHeaps)
v0.2.1 is a critical hotfix for all real New Nintendo 3DS / New 3DS XL / New 2DS XL consoles running Luma3DS (both .cia and .3dsx builds).
English Release Notes
Bug Fixed: Immediate Startup Crash (prefetch abort / Debug event) on Real New 3DS Hardware
- Symptom in
v0.2.0: Launchingpsx3ds.cia(orpsx3ds.3dsxwith>= 124 MiBcommit limit) on a real New 3DS running Luma3DS immediately crashed beforemain()with a Luma3DS exception screen:Exception type: prefetch abort(Fault status: Debug event—svcBreak(USERBREAK_PANIC))PC = 0x001CB108(svcBreak),LR = 0x001CABF4(__system_allocateHeaps + 0x1bc)R3 = 0x06694000(102.58 MiB) with New 3DSRESLIMIT_COMMIT = 0x07C00000(124 MiB)
- Root Cause:
- To fit
26 MiB PsxArena + 6 MiB JITon64 MiBOld 3DS.ciainstalls,v0.2.0setu32 __ctru_linear_heap_size = 20 MiBwhile leaving__ctru_heap_size = 0. - In
libctru's__system_allocateHeaps, setting a non-zero__ctru_linear_heap_sizewith__ctru_heap_size == 0bypasseslibctru's default32 MiBlinear-heap branch and takes an uncapped branch:__ctru_heap_size = remaining - __ctru_linear_heap_size. - On a real New 3DS (
124 MiBRESLIMIT_COMMIT,~122.58 MiBremaining),__ctru_heap_sizebecame102.58 MiB(0x06694000). WhensvcControlMemory(MEMOP_ALLOC)attempted to map0x08000000 .. 0x0E694000, it overflowed Horizon OS Kernel11's96 MiB([0x08000000, 0x0E000000)) application heap virtual address ceiling (OS_HEAP_AREA_END), failing and triggeringsvcBreak(USERBREAK_PANIC)beforemain(). (Azahar's HLE kernel permits a 128 MiB heap window, masking this bug in emulator-only tests.)
- To fit
- Fix in
v0.2.1:- Custom
__system_allocateHeapsOverride (src/platform/3ds/main_3ds.c+include/psx3ds/ctr_heap.h): Computesnormal_heap = min(remaining - 20 MiB, 80 MiB)and assigns the remaining commit budget to the linear heap:- New 3DS (
124 MiB.cia/.cci/.3dsx):80.00 MiB(0x05000000) normal heap (0x08000000 .. 0x0D000000, leaving a full16 MiBVA safety margin below0x0E000000) +~42.58 MiBlinear heap. - New 3DS (
178 MiBextended.3dsx):80.00 MiBnormal heap +~96.58 MiBlinear heap. - Old 3DS (
64 MiB.cia/.cci/.3dsx):~42.58 MiBnormal heap +20.00 MiBlinear heap (unchanged).
- New 3DS (
- Resilient Kernel Fallback: If
svcControlMemoryever rejects a requested heap or contiguous linear-heap allocation (e.g. fragmented FCRAM under.3dsxlaunchers),__system_allocateHeapsshrinks in8 MiBsteps and retries instead of panicking. - Accurate Old 3DS
small_memAuto-Detection:psx_system_init()now inspectsenvGetHeapSize() < 64 MiB(__ctru_heap_size) instead ofosGetMemRegionFree(MEMREGION_APPLICATION)(which reads~0after startup commitsRESLIMIT_COMMIT), ensuring New 3DS.ciaand.3dsxalways run the full16 MiBJIT +64-slotRGBA8 texture cache +8-slotCHD cache profile while Old 3DS usessmall_mem. - Startup Heap Regression Suite (
tests/unit/test_ctr_heap.c): Verifies36 MiB <= heap_size <= 80 MiB < 96 MiBacross O3DS64/80/96 MiB, N3DS124/178 MiB, the exact crash dump registers, and a1..256 MiBsweep across all 3 CI/test tiers.
- Custom
Quick Start (SD Card Installation)
- Download
psx3ds.cia(or extractpsx3ds-v0.2.1-3ds.zipto the root of your 3DS SD cardsdmc:/). - Recommended (
.cia): Open FBI →SD→ installpsx3ds.cia(overwritesv0.2.0cleanly underTitleID 000400000F853D00), then launch PSX3DS from the Home Menu. - Alternative (
.3dsx): Placepsx3ds.3dsxandpsx3ds.smdhinsdmc:/3ds/psx3ds/and launch from Homebrew Launcher. - Put PS1 BIOS (
SCPH1001.BINor includedopenbios.bin) insdmc:/psx3ds/bios/and games (.chd,.cue/.bin,.iso,.exe) insdmc:/psx3ds/roms/.
中文更新说明(修复 New 3DS 实机打开即崩溃问题)
修复核心问题:New 3DS / New 3DS XL / New 2DS XL(Luma3DS)启动即报 prefetch abort (svcBreak) 崩溃
- 问题原因(
v0.2.0):v0.2.0为了兼容老三(Old 3DS64 MiB)的内存预算,设置了__ctru_linear_heap_size = 20 MiB且保留__ctru_heap_size = 0。- 在
libctru的__system_allocateHeaps中,当仅指定线性堆大小而未指定普通堆上限时,会跳过默认的32 MiB线性堆分支,直接按remaining - 20 MiB无上限计算普通堆。 - 在 New 3DS(
RESLIMIT_COMMIT = 124 MiB,剩余约122.58 MiB)实机上,普通堆请求大小变成了102.58 MiB(R3 = 0x06694000),映射范围0x08000000 .. 0x0E694000超出了 3DS Kernel11 应用普通堆的96 MiB虚拟地址上限[0x08000000, 0x0E000000),导致svcControlMemory失败并在进入main()前触发svcBreak(USERBREAK_PANIC)(Luma3DS 显示prefetch abort / Debug event)。
v0.2.1修复方案:- 接管并重写
__system_allocateHeaps:通过psx_ctr_compute_heap_split()精确划分普通堆与线性堆:普通堆上限严格封顶为80 MiB(0x05000000,最高至0x0D000000),彻底杜绝越过0x0E000000内核虚拟地址边界:- New 3DS (
124 MiB.cia/.3dsx):80.00 MiB普通堆 +42.58 MiB线性堆(完整启用16 MiBARM11 W^X JIT 缓存、64 槽位硬件纹理缓存与 8 槽位 CHD 缓存)。 - Old 3DS (
64 MiB.cia/.3dsx):42.58 MiB普通堆 +20.00 MiB线性堆(自动启用small_mem配置)。
- New 3DS (
- 内核分配自适应退避重试:若在内存碎片化的自制软件启动器环境下单次分配被内核拒绝,自动按
8 MiB步进收缩重试,避免直接崩溃。 - 修复
small_mem自动识别逻辑:改用envGetHeapSize() < 64 MiB判定老三/新三内存配置,并新增test_ctr_heap单元测试覆盖全部机型内存布局。
- 接管并重写
安装/升级方法
.cia桌面安装版(推荐):下载psx3ds.cia(或解压psx3ds-v0.2.1-3ds.zip到 SD 卡根目录),使用 FBI 直接覆盖安装即可(相同TitleID 000400000F853D00,存档与记忆卡完全保留)。.3dsx自制系统启动版:下载psx3ds.3dsx(及psx3ds.smdh)覆盖sdmc:/3ds/psx3ds/目录后从 Homebrew Launcher 启动。- 所有发布文件均可通过
SHA256SUMS.txt校验完整性。