// Copyright 2026 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include #include #include "Common/CommonTypes.h" // StarletBootstrapProbe's --stage-spk : StarOS's SPK1 service package, placed in MEM2 at // the package window's base once the image is loaded, before the first ARM instruction (StarOS // docs/contracts/spk-staging.md). The window is the contract's, never an argument, so that a run // cannot stage elsewhere. The probe only places bytes: SPK1's fields and digests are StarOS's to // check. namespace StarletBootstrapProbe { constexpr u32 SPK_WINDOW_BASE = 0x13720000; constexpr u32 SPK_WINDOW_SIZE = 0x20000; // Exit status of a run whose package file is refused before StarOS starts (1: failed // expectation, 2: usage, 3: Dolphin alert). constexpr int STAGING_EXIT_STATUS = 4; // Why a package file of `size` bytes cannot be staged, or nullopt when it can: not empty, whole // 32-bit words, at most the window. inline std::optional StagingRefusal(u64 size) { if (size == 0) return "it is empty"; if (size % 4 != 0) return "its length is not a whole number of 32-bit words"; if (size > SPK_WINDOW_SIZE) return "it is larger than the 128 KiB package window"; return std::nullopt; } } // namespace StarletBootstrapProbe