enum MemoryType [src]

Fields

reserved_memory_typecan only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise
loader_code
loader_data
boot_services_code
boot_services_data
runtime_services_codecan only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise
runtime_services_datacan only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise
conventional_memory
unusable_memory
acpi_reclaim_memorycan only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise
acpi_memory_nvscan only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise
memory_mapped_io
memory_mapped_io_port_space
pal_code
persistent_memory
unaccepted_memory
max_memory_type
invalid_start
invalid_end = 0x6FFFFFFF
oem_start = 0x70000000MemoryType values in the range 0x70000000..0x7FFFFFFF are reserved for OEM use.
oem_end = 0x7FFFFFFF
vendor_start = 0x80000000MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders that are provided by operating system vendors.
vendor_end = 0xFFFFFFFF
_

Members

Source

pub const MemoryType = enum(u32) { pub const Oem = math.IntFittingRange( 0, @intFromEnum(MemoryType.oem_end) - @intFromEnum(MemoryType.oem_start), ); pub const Vendor = math.IntFittingRange( 0, @intFromEnum(MemoryType.vendor_end) - @intFromEnum(MemoryType.vendor_start), ); /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise reserved_memory_type, loader_code, loader_data, boot_services_code, boot_services_data, /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise runtime_services_code, /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise runtime_services_data, conventional_memory, unusable_memory, /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise acpi_reclaim_memory, /// can only be allocated using .allocate_any_pages mode unless you are explicitly targeting an interface that states otherwise acpi_memory_nvs, memory_mapped_io, memory_mapped_io_port_space, pal_code, persistent_memory, unaccepted_memory, max_memory_type, invalid_start, invalid_end = 0x6FFFFFFF, /// MemoryType values in the range 0x70000000..0x7FFFFFFF are reserved for OEM use. oem_start = 0x70000000, oem_end = 0x7FFFFFFF, /// MemoryType values in the range 0x80000000..0xFFFFFFFF are reserved for use by UEFI /// OS loaders that are provided by operating system vendors. vendor_start = 0x80000000, vendor_end = 0xFFFFFFFF, _, pub fn fromOem(value: Oem) MemoryType { const oem_start = @intFromEnum(MemoryType.oem_start); return @enumFromInt(oem_start + value); } pub fn toOem(memtype: MemoryType) ?Oem { const as_int = @intFromEnum(memtype); const oem_start = @intFromEnum(MemoryType.oem_start); if (as_int < oem_start) return null; if (as_int > @intFromEnum(MemoryType.oem_end)) return null; return @truncate(as_int - oem_start); } pub fn fromVendor(value: Vendor) MemoryType { const vendor_start = @intFromEnum(MemoryType.vendor_start); return @enumFromInt(vendor_start + value); } pub fn toVendor(memtype: MemoryType) ?Vendor { const as_int = @intFromEnum(memtype); const vendor_start = @intFromEnum(MemoryType.vendor_start); if (as_int < @intFromEnum(MemoryType.vendor_end)) return null; if (as_int > @intFromEnum(MemoryType.vendor_end)) return null; return @truncate(as_int - vendor_start); } pub fn format(self: MemoryType, w: *std.Io.Writer) std.Io.Writer.Error!void { if (self.toOem()) |oemval| try w.print("OEM({X})", .{oemval}) else if (self.toVendor()) |vendorval| try w.print("Vendor({X})", .{vendorval}) else if (std.enums.tagName(MemoryType, self)) |name| try w.print("{s}", .{name}) else try w.print("INVALID({X})", .{@intFromEnum(self)}); } }