// SPDX-License-Identifier: Apache-2.0 #pragma once #ifndef SCHBOOT_H #define SCHBOOT_H // The loader/kernel hand-off, in one place. // // Included by kernel/arch/x86_64/entry.S and by boot/uefi/main.c, so the two // cannot disagree about the magic or the layout. Defining it twice is exactly // how a loader ends up scanning for bytes the kernel never wrote — the first // attempt here searched for "SCH6" while the assembler had stored 0x53434836, // which lands in the file as "6HCS". // // Keep this header assembler-safe: no typedefs, no structs outside the C // guard, nothing entry.S cannot preprocess. // Scanned for in the first 16 KB of the kernel image, 8-byte aligned, exactly // as the BIOS loader scans for the multiboot magic. Followed by a little-endian // 64-bit physical address: the kernel's 64-bit entry point. // // The values spell "SCH6" "4BOO" when stored little-endian, which is what // makes them findable by eye in a hex dump of the image. #define SCH64_MAGIC0 0x36484353 /* "SCH6" */ #define SCH64_MAGIC1 0x4f4f4234 /* "4BOO" */ #ifndef __ASSEMBLER__ struct sch64_header { unsigned int magic0; // SCH64_MAGIC0 unsigned int magic1; // SCH64_MAGIC1 unsigned long long entry; // physical address, entered in long mode }; #endif /* !__ASSEMBLER__ */ #endif /* SCHBOOT_H */