This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function
pubfndwarfRegisterBytes(ctx: *X86, register_num: u16) DwarfRegisterError![]u8 {
// System V Application Binary Interface Intel386 Architecture Processor Supplement Version 1.1// § 2.4.2 "DWARF Register Number Mapping"switch (register_num) {
// The order of `Gpr` intentionally matches DWARF's mappings.//// x86-macos sometimes uses different mappings (ebp and esp are reversed when the unwind// information is from `__eh_frame`). This deviation is not considered here, because// x86-macos is a deprecated target which is not supported by the Zig Standard Library.0...8 => return@ptrCast(&ctx.gprs.values[register_num]),
9 => returnerror.UnsupportedRegister, // eflags11...18 => returnerror.UnsupportedRegister, // st0 - st721...28 => returnerror.UnsupportedRegister, // xmm0 - xmm729...36 => returnerror.UnsupportedRegister, // mm0 - mm739 => returnerror.UnsupportedRegister, // mxcsr40...45 => returnerror.UnsupportedRegister, // es, cs, ss, ds, fs, gs48 => returnerror.UnsupportedRegister, // tr49 => returnerror.UnsupportedRegister, // ldtr93...100 => returnerror.UnsupportedRegister, // k0 - k7 (AVX-512)else => returnerror.InvalidRegister,
}
}