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

Alpha

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

Fields

r: [32]Gpr

The numbered general-purpose registers R0 - R31.

pc: Gpr

Values

Functions

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

File

debug/cpu_context.zig:311
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
const Alpha = extern struct {
    /// The numbered general-purpose registers R0 - R31.
    r: [32]Gpr,
    pc: Gpr,

    pub const Gpr = u64;

    pub inline fn current() Alpha {
        var ctx: Alpha = undefined;
        asm volatile (
            \\ stq $0 , 0x000($0)
            \\ stq $1 , 0x008($0)
            \\ stq $2 , 0x010($0)
            \\ stq $3 , 0x018($0)
            \\ stq $4 , 0x020($0)
            \\ stq $5 , 0x028($0)
            \\ stq $6 , 0x030($0)
            \\ stq $7 , 0x038($0)
            \\ stq $8 , 0x040($0)
            \\ stq $9 , 0x048($0)
            \\ stq $10, 0x050($0)
            \\ stq $11, 0x058($0)
            \\ stq $12, 0x060($0)
            \\ stq $13, 0x068($0)
            \\ stq $14, 0x070($0)
            \\ stq $15, 0x078($0)
            \\ stq $16, 0x080($0)
            \\ stq $17, 0x088($0)
            \\ stq $18, 0x090($0)
            \\ stq $19, 0x098($0)
            \\ stq $20, 0x0a0($0)
            \\ stq $21, 0x0a8($0)
            \\ stq $22, 0x0b0($0)
            \\ stq $23, 0x0b8($0)
            \\ stq $24, 0x0c0($0)
            \\ stq $25, 0x0c8($0)
            \\ stq $26, 0x0d0($0)
            \\ stq $27, 0x0d8($0)
            \\ stq $28, 0x0e0($0)
            \\ stq $29, 0x0e8($0)
            \\ stq $30, 0x0f0($0)
            \\ stq $31, 0x0f8($0)
            \\
            \\ br $1, 1f
            \\1:
            \\ stq $1, 0x100($0)
            :
            : [ctx] "{$0}" (&ctx),
            : .{ .r1 = true, .memory = true });
        return ctx;
    }

    pub fn getFp(ctx: *const Alpha) usize {
        return ctx.r[15];
    }
    pub fn getPc(ctx: *const Alpha) usize {
        return ctx.pc;
    }

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

            32...63 => return error.UnsupportedRegister, // f0 - f31
            66 => return error.UnsupportedRegister, // uniq

            else => return error.InvalidRegister,
        }
    }
}