Files
James Stringer 0d4897dd6b Windows guest on Mac host via QEMU+HVF + ivshmem transport
Run Windows 11 ARM64 guests on macOS over QEMU+HVF, with an ivshmem
shared-memory transport carrying every guest channel (agent control,
display/VDD, input, audio, clipboard, SSH, 9P) - no guest networking
required.

- tools/transport: one guest transport API, two backends (PC AF_HYPERV,
  Mac ivshmem); SPSC ring with an acquire-barrier fix for SSH integrity
- tools/ivshmem: our own KMDF ivshmem BAR-mapping driver (no third party)
- src/backend_mac: Mac-host ivshmem transport, QEMU VM lifecycle, IDD
  display consumer, agent/SSH proxies, ISO->disk patcher, Windows create
- tools/agent + channel EXEs + tools/vdd: wired to asb_transport
- tools/agent_win: staged guest payload (interim, pending JIT pull)
- vendor/qemu-ivshmem: vendored QEMU 11.0.1 fork (ivshmem-plain) + LGPL
  source mirror for the self-contained app bundle
- tools/sign/make-release.ps1: use the host-native ARM64 MSBuild so the
  WDK driver ApiValidator runs (the x86 validator fails on ARM64)
2026-06-21 18:30:59 -04:00

36 lines
1.5 KiB
C

/*
* gpt -- hand-written GUID Partition Table for the Windows guest disk.
*
* The Windows host path (iso-patch.c) delegates GPT creation to the OS via
* IOCTL_DISK_SET_DRIVE_LAYOUT_EX. On macOS we author every byte ourselves
* (no diskutil/gpt(8)), matching "all disk writing is ours". Layout matches
* iso-patch.c do_to_vhdx exactly: 1 MiB alignment, ESP (FAT32) + MSR + Windows
* (basic data), with the canonical Microsoft partition type GUIDs.
*/
#ifndef ASB_GPT_H
#define ASB_GPT_H
#include "blockio.h"
#include <stdint.h>
/* Partition LBA ranges the caller needs to then format. counts are in sectors. */
typedef struct {
uint32_t sector_size;
uint64_t esp_start_lba, esp_count_lba; /* EFI System Partition (FAT32) */
uint64_t msr_start_lba, msr_count_lba; /* Microsoft Reserved (unformatted) */
uint64_t win_start_lba, win_count_lba; /* Windows (NTFS) */
/* GUIDs in on-disk mixed-endian form (ready to memcpy into a BCD device blob) */
uint8_t disk_guid[16];
uint8_t esp_part_guid[16];
uint8_t win_part_guid[16];
} gpt_layout_t;
/* Write a protective MBR + primary/backup GPT describing ESP/MSR/Windows onto
* the image. esp_mb/msr_mb are the ESP and MSR sizes in MiB (e.g. 200, 128);
* Windows fills the remainder. Fills *out with the resulting LBA ranges.
* Returns 0 on success, -1 on error. */
int gpt_write_windows(blockio_t *io, uint32_t sector_size,
uint64_t esp_mb, uint64_t msr_mb, gpt_layout_t *out);
#endif /* ASB_GPT_H */