extern structstd.macho.segment_command_64[src]

The 64-bit segment load command indicates that a part of this file is to be mapped into a 64-bit task's address space. If the 64-bit segment has sections then section_64 structures directly follow the 64-bit segment command and their size is reflected in cmdsize.

Fields

cmd: LC = .SEGMENT_64

LC_SEGMENT_64

cmdsize: u32

includes sizeof section_64 structs

segname: [16]u8

segment name

vmaddr: u64 = 0

memory address of this segment

vmsize: u64 = 0

memory size of this segment

fileoff: u64 = 0

file offset of this segment

filesize: u64 = 0

amount to map from the file

maxprot: vm_prot_t = PROT.NONE

maximum VM protection

initprot: vm_prot_t = PROT.NONE

initial VM protection

nsects: u32 = 0

number of sections in segment

flags: u32 = 0

Functions

FunctionsegName[src]

pub fn segName(seg: *const segment_command_64) []const u8

Parameters

seg: *const segment_command_64

Source Code

Source code
pub fn segName(seg: *const segment_command_64) []const u8 {
    return parseName(&seg.segname);
}

FunctionisWriteable[src]

pub fn isWriteable(seg: segment_command_64) bool

Parameters

Source Code

Source code
pub fn isWriteable(seg: segment_command_64) bool {
    return seg.initprot & PROT.WRITE != 0;
}

Source Code

Source code
pub const segment_command_64 = extern struct {
    /// LC_SEGMENT_64
    cmd: LC = .SEGMENT_64,

    /// includes sizeof section_64 structs
    cmdsize: u32,
    // TODO lazy values in stage2
    // cmdsize: u32 = @sizeOf(segment_command_64),

    /// segment name
    segname: [16]u8,

    /// memory address of this segment
    vmaddr: u64 = 0,

    /// memory size of this segment
    vmsize: u64 = 0,

    /// file offset of this segment
    fileoff: u64 = 0,

    /// amount to map from the file
    filesize: u64 = 0,

    /// maximum VM protection
    maxprot: vm_prot_t = PROT.NONE,

    /// initial VM protection
    initprot: vm_prot_t = PROT.NONE,

    /// number of sections in segment
    nsects: u32 = 0,
    flags: u32 = 0,

    pub fn segName(seg: *const segment_command_64) []const u8 {
        return parseName(&seg.segname);
    }

    pub fn isWriteable(seg: segment_command_64) bool {
        return seg.initprot & PROT.WRITE != 0;
    }
}