Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
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. Private Struct

M88k

Private Struct
std.debug.cpu_context.M88k
const M88k = extern struct

This is an extern struct so that inline assembly in current can use field offsets.

Fields

r: [32]Gpr

The numbered general-purpose registers r0 - r31.

xip: Gpr

Values

Functions

pub inline fn current() M88k
pub fn getFp(ctx: *const M88k) usize
pub fn getPc(ctx: *const M88k) usize
pub fn dwarfRegisterBytes(ctx: *M88k, register_num: u16) DwarfRegisterError![]u8

File

debug/cpu_context.zig:926
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
const M88k = extern struct {
    /// The numbered general-purpose registers r0 - r31.
    r: [32]Gpr,
    xip: Gpr,

    pub const Gpr = u32;

    pub inline fn current() M88k {
        var ctx: M88k = undefined;
        asm volatile (
            \\ st %%r0, %%r2, 0
            \\ st %%r1, %%r2, 4
            \\ st %%r2, %%r2, 8
            \\ st %%r3, %%r2, 12
            \\ st %%r4, %%r2, 16
            \\ st %%r5, %%r2, 20
            \\ st %%r6, %%r2, 24
            \\ st %%r7, %%r2, 28
            \\ st %%r8, %%r2, 32
            \\ st %%r9, %%r2, 36
            \\ st %%r10, %%r2, 40
            \\ st %%r11, %%r2, 44
            \\ st %%r12, %%r2, 48
            \\ st %%r13, %%r2, 52
            \\ st %%r14, %%r2, 56
            \\ st %%r15, %%r2, 60
            \\ st %%r16, %%r2, 64
            \\ st %%r17, %%r2, 68
            \\ st %%r18, %%r2, 72
            \\ st %%r19, %%r2, 76
            \\ st %%r20, %%r2, 80
            \\ st %%r21, %%r2, 84
            \\ st %%r22, %%r2, 88
            \\ st %%r23, %%r2, 92
            \\ st %%r24, %%r2, 96
            \\ st %%r25, %%r2, 100
            \\ st %%r26, %%r2, 104
            \\ st %%r27, %%r2, 108
            \\ st %%r28, %%r2, 112
            \\ st %%r29, %%r2, 116
            \\ st %%r30, %%r2, 120
            \\ st %%r31, %%r2, 124
            \\ bsr.n 1f
            \\1:
            \\ st %%r1, %%r2, 128
            :
            : [ctx] "{r2}" (&ctx),
            : .{ .r1 = true, .memory = true });
        return ctx;
    }

    pub fn getFp(ctx: *const M88k) usize {
        return ctx.r[30];
    }
    pub fn getPc(ctx: *const M88k) usize {
        return ctx.xip;
    }

    pub fn dwarfRegisterBytes(ctx: *M88k, register_num: u16) DwarfRegisterError![]u8 {
        switch (register_num) {
            0...31 => return @ptrCast(&ctx.r[register_num]),
            64 => return @ptrCast(&ctx.xip),

            32...63 => return error.UnsupportedRegister, // x0 - x31

            else => return error.InvalidRegister,
        }
    }
}