build(libkernel): compile Exception on macOS #11249
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11249"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by iamthehimansh on 2026-10-25T22:35:20Z.
What
Next part of splitting #8658:
libkernel'sSystem/src/Exception.cppdoes not compile on macOS. The change is macOS-only; Linux and Windows compile the same code as before.It converts the host signal context to and from the guest machine context through Linux's
gregsarray andfpregspointer. On macOS the general registers are named fields ofmcontext_t->__ss, and the x87/SSE state is an FXSAVE-layout block insidemcontext_t->__fs. macOS now copies those fields directly. Astatic_assertchecks that the Darwin float state has the FXSAVE layout (MXCSR at 24, XMM0 at 160) that the copy relies on, so a header change fails the build instead of corrupting registers.Overlap
@marion909's #7201 ("Macos port", 100 files, needs a rebase) also converts the Darwin machine context in this file, and 46 of this PR's 56 added lines appear there too. This PR carries only
Exception.cpp, so it can land on its own. It differs in one place: it copies the full 512-byte FXSAVE image from__fsinto the guest state, checks the Darwin layout with astatic_assertat MXCSR, XMM0 and the end of XMM15, and writes back only the 416 register bytes. #7201 copies 416 bytes in both directions. If #7201 lands first, I'll close this or rebase it onto that.Tested
macOS 26 on an Apple M2 Pro, x86_64 under Rosetta 2, Release with Ninja, on
mainatb90d009d9:System/src/Exception.cpp.ocompiles, wheremainfails it. Thelibkerneltests cannot run on macOS until the rest oflibkernelbuilds (#10552, #7804, #10898 and follow-ups), so this is a compile check only. In #8658's full macOS run (1,960 tests) the same code passedguest_exception_handler,guest_raise_exception,guest_signals,guest_signal_setsandguest_signal_list. For Linux and Windows, I checked the file's view underunifdef -U__APPLE__, with-D__linux__and with-D_WIN32: it equalsmain.python3 tools/check_conventions.py --base origin/mainpasses.Checklist
main; #7201 also implements this conversion (see Overlap)NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T22:36:54Z.
Review: APPROVED
I reviewed the full macOS conversion. The general registers map field-for-field between Darwin
__ssandGuestMcontext, and the FXSAVE offsets are checked at MXCSR, XMM0, and the end of XMM15 before copying the state image. The 512-byte host read fits the guest state assertion; the reverse path copies the same 416 bytes as the Linux implementation. The Apple branch is isolated from the existing Linux conversion.git diff --checkand current-main conventions pass. Hosted eligibility, conventions, intake, labels and report pass; product/build jobs are skipped by policy. I did not run the macOS runtime test locally. The author reports this same code passed the named guest exception/signal tests in the previous full macOS run (1,960 tests), and the changed translation unit compiles on the current branch. No concrete defect found.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T06:38:36Z.
Review: CHANGES_REQUESTED
I am updating my earlier approval after checking the exact overlap against current open #7201. #7201 is still open and contains this same
Exception.cppcontext conversion; this PR itself says 46 of its 56 added lines also appear there. CONTRIBUTING requires the authors to agree which overlapping change lands first and record any prerequisite onDepends on. The current description says this PR can land independently, but does not show coordination with #7201’s author. Please record the agreed merge order and list a dependency if #7201 must land first, or coordinate that this focused PR is the replacement for this portion of #7201. The technical review of this head remains sound; this request is specifically for the documented overlap/merge-order rule.Pull request closed