includes/std: Added section parameters to a few std::mem functions

This commit is contained in:
Nik
2025-08-24 12:00:05 +02:00
committed by GitHub
parent 7fd79ec9fd
commit afffd7eced

View File

@@ -27,6 +27,8 @@ namespace auto std::mem {
A Handle for a custom Section
*/
using Section = u128;
const u64 SectionMain = 0;
const u64 SectionCurrent = 0xFFFF'FFFF'FFFF'FFFF;
/**
The endianness of a value
@@ -72,16 +74,16 @@ namespace auto std::mem {
Gets the base address of the data
@return The base address of the memory
*/
fn base_address() {
return builtin::std::mem::base_address();
fn base_address(u64 section = SectionCurrent) {
return builtin::std::mem::base_address(section);
};
/**
Gets the size of the data
@return The size of the memory
*/
fn size() {
return builtin::std::mem::size();
fn size(u64 section = SectionCurrent) {
return builtin::std::mem::size(section);
};
/**
@@ -138,8 +140,8 @@ namespace auto std::mem {
@param [endian] The endianness of the value to read. Defaults to native
@return The value read
*/
fn read_unsigned(u128 address, u8 size, Endian endian = Endian::Native) {
return builtin::std::mem::read_unsigned(address, size, u32(endian));
fn read_unsigned(u128 address, u8 size, Endian endian = Endian::Native, Section section = SectionCurrent) {
return builtin::std::mem::read_unsigned(address, size, u32(endian), section);
};
/**
@@ -149,8 +151,8 @@ namespace auto std::mem {
@param [endian] The endianness of the value to read. Defaults to native
@return The value read
*/
fn read_signed(u128 address, u8 size, Endian endian = Endian::Native) {
return builtin::std::mem::read_signed(address, size, u32(endian));
fn read_signed(u128 address, u8 size, Endian endian = Endian::Native, Section section = SectionCurrent) {
return builtin::std::mem::read_signed(address, size, u32(endian), section);
};
/**
@@ -159,8 +161,8 @@ namespace auto std::mem {
@param size The size of the value to read
@return The value read
*/
fn read_string(u128 address, u128 size) {
return builtin::std::mem::read_string(address, size);
fn read_string(u128 address, u128 size, Section section = SectionCurrent) {
return builtin::std::mem::read_string(address, size, section);
};
/**