|
23 | 23 | #include "exec/memattrs.h" |
24 | 24 | #include "exec/memory.h" |
25 | 25 | #include "hw/arm/apple-silicon/a13.h" |
| 26 | +#include "hw/arm/apple-silicon/boot.h" |
26 | 27 | #include "hw/arm/apple-silicon/dart.h" |
27 | 28 | #include "hw/arm/apple-silicon/dtb.h" |
28 | 29 | #include "hw/arm/apple-silicon/lm-backlight.h" |
@@ -151,8 +152,16 @@ static void t8030_create_s3c_uart(const T8030MachineState *t8030_machine, |
151 | 152 | dev->id = g_strdup(name); |
152 | 153 | } |
153 | 154 |
|
154 | | -static void t8030_patch_kernel(MachoHeader64 *hdr) |
| 155 | +static void t8030_patch_kernel(MachoHeader64 *hdr, uint32_t build_version) |
155 | 156 | { |
| 157 | + xnu_kpf(hdr); |
| 158 | + |
| 159 | + if (BUILD_VERSION_MAJOR(build_version) != 14 || |
| 160 | + BUILD_VERSION_MINOR(build_version) != 0 || |
| 161 | + BUILD_VERSION_PATCH(build_version) != 0) { |
| 162 | + return; |
| 163 | + } |
| 164 | + |
156 | 165 | const uint32_t nop = cpu_to_le32(0xD503201F); |
157 | 166 |
|
158 | 167 | // disable_kprintf_output = 0; |
@@ -217,8 +226,6 @@ static void t8030_patch_kernel(MachoHeader64 *hdr) |
217 | 226 | // AND SHOULD BE PROSECUTED TO THE FULL EXTENT OF THE LAW. |
218 | 227 | // We do NOT endorse nor approve the theft of property. |
219 | 228 | memcpy((char *)vtop_slid(0xFFFFFFF00703884E), "profile", 8); |
220 | | - |
221 | | - xnu_kpf(hdr); |
222 | 229 | } |
223 | 230 |
|
224 | 231 | static bool t8030_check_panic(T8030MachineState *t8030_machine) |
@@ -2385,9 +2392,10 @@ static void t8030_machine_init(MachineState *machine) |
2385 | 2392 | g_assert_nonnull(hdr); |
2386 | 2393 | t8030_machine->kernel = hdr; |
2387 | 2394 | build_version = macho_build_version(hdr); |
2388 | | - info_report("Loading %s %u.%u...", macho_platform_string(hdr), |
| 2395 | + info_report("Loading %s %u.%u.%u...", macho_platform_string(hdr), |
2389 | 2396 | BUILD_VERSION_MAJOR(build_version), |
2390 | | - BUILD_VERSION_MINOR(build_version)); |
| 2397 | + BUILD_VERSION_MINOR(build_version), |
| 2398 | + BUILD_VERSION_PATCH(build_version)); |
2391 | 2399 | t8030_machine->build_version = build_version; |
2392 | 2400 |
|
2393 | 2401 | switch (BUILD_VERSION_MAJOR(build_version)) { |
@@ -2429,7 +2437,7 @@ static void t8030_machine_init(MachineState *machine) |
2429 | 2437 | g_virt_base = kernel_low; |
2430 | 2438 | g_phys_base = (hwaddr)macho_get_buffer(hdr); |
2431 | 2439 |
|
2432 | | - t8030_patch_kernel(hdr); |
| 2440 | + t8030_patch_kernel(hdr, build_version); |
2433 | 2441 |
|
2434 | 2442 | t8030_machine->device_tree = load_dtb_from_file(machine->dtb); |
2435 | 2443 | t8030_machine->trustcache = |
|
0 commit comments