~sircmpwn/helios

b4d5b037b21508038ef07d479dd22843519be50a — Alexey Yerin 1 year, 4 months ago ab5aa6f
Fill uninitialized fields
M arch/main/+aarch64/main.ha => arch/main/+aarch64/main.ha +3 -1
@@ 1,7 1,8 @@
use arch;
use arch::dev;
use arch::mem;
use arch;
use cons;
use elf;
use fdt;
use log;
use rt;


@@ 47,6 48,7 @@ export fn main(ctx: *bootctx) void = {

	// TODO: Unify arch::bootctx with boot::bootctx
	kmain(arch::bootctx {
		image = null: *elf::header64,
		mods = ctx.mods,
		dtb = ctx.dtb,
		...

M arch/mem/+x86_64/mmap.ha => arch/mem/+x86_64/mmap.ha +1 -1
@@ 3,7 3,7 @@ use types;

def MMAP_MAX_ENTRIES: size = 64;
let mmap: [MMAP_MAX_ENTRIES]multiboot::mb_mmap_entry = [
	multiboot::mb_mmap_entry { ... }...
	multiboot::mb_mmap_entry { typ = 0, ... }...
];
let nmmap: size = 0;


M objects/asid.ha => objects/asid.ha +12 -0
@@ 6,6 6,7 @@ use errors;

export const asid_control_impl: caps::interface = caps::interface {
	destroy = &asid_control_destroy,
	compare = &asid_control_compare,
	...
};



@@ 66,8 67,13 @@ fn asid_control_destroy(cslot: *caps::cslot) void = {
	return; // no-op
};

fn asid_control_compare(a: *caps::capability, b: *caps::capability) bool = {
	return false;
};

export const asid_pool_impl: caps::interface = caps::interface {
	destroy = &asid_pool_destroy,
	compare = &asid_pool_compare,
	...
};



@@ 91,6 97,12 @@ fn asid_pool_destroy(cslot: *caps::cslot) void = {
	caps::unlink(cslot);
};

fn asid_pool_compare(a: *caps::capability, b: *caps::capability) bool = {
	const a = a: *asid_pool;
	const b = b: *asid_pool;
	return a.base == b.base && a.pool == b.pool;
};

// Assigns an ASID to the provided vspace from this ASID pool.
export fn asid_pool_assign(
	pool_cap: *caps::capability,

M objects/endpoint.ha => objects/endpoint.ha +1 -1
@@ 47,7 47,7 @@ fn endpoint_init(
		send = null,
		recv = null,
		npoll = 0z,
		poll = [poll { ... }...],
		poll = [poll { events = 0, ... }...],
	};

	let cap = cslot: *endpoint;

M objects/notification.ha => objects/notification.ha +1 -1
@@ 45,7 45,7 @@ fn note_init(
		recv = null,
		word = 0,
		npoll = 0z,
		poll = [poll { ... }...],
		poll = [poll { events = 0, ... }...],
	};

	let cap = cslot: *notification;

M objects/reply.ha => objects/reply.ha +7 -0
@@ 6,6 6,7 @@ use ipc;

export const reply_impl: caps::interface = caps::interface {
	destroy = &reply_destroy,
	compare = &reply_compare,
	...
};



@@ 35,6 36,12 @@ fn reply_destroy(cslot: *caps::cslot) void = {
	return;
};

fn reply_compare(a: *caps::capability, b: *caps::capability) bool = {
	const a = a: *reply;
	const b = b: *reply;
	return a.recv == b.recv;
};

// XXX: Would be nice to de-duplicate some of the send/recv code with endpoint

// Calls an endpoint.

M strconv/itos.ha => strconv/itos.ha +4 -0
@@ 10,6 10,10 @@ use strings;
// allocated and will be overwritten on subsequent calls; see [[strings::dup]] to
// duplicate the result.
export fn i64tosb(i: i64, b: base) const str = {
	if (b == base::DEC) {
		b = 10;
	};

	static assert(types::I64_MAX == 9223372036854775807);
	if (i >= 0) return u64tosb(i: u64, b);


M strconv/types.ha => strconv/types.ha +2 -2
@@ 17,8 17,8 @@ export type base = enum uint {
	BIN = 2,
	// Base 8, octal
	OCT = 8,
	// Base 10, decimal
	DEC = 10,
	// Base 10, decimal (default)
	DEC = 0,
	// Base 16, UPPERCASE hexadecimal
	HEX_UPPER = 16,
	// Alias for HEX_UPPER

M strconv/utos.ha => strconv/utos.ha +4 -0
@@ 23,6 23,10 @@ export fn u64tosb(u: u64, b: base) const str = {
		yield &lut_lower;
	};

	if (b == base::DEC) {
		b = 10;
	};

	let s = types::string { data = &buf, ... };
	if (u == 0) {
		buf[s.length] = '0': u32: u8;

M vulcan/strconv/itos.ha => vulcan/strconv/itos.ha +3 -0
@@ 10,6 10,9 @@ use strings;
// allocated and will be overwritten on subsequent calls; see [[strings::dup]] to
// duplicate the result.
export fn i64tosb(i: i64, b: base) const str = {
	if (b == base::DEC) {
		b = 10;
	};
	static assert(types::I64_MAX == 9223372036854775807);
	if (i >= 0) return u64tosb(i: u64, b);


M vulcan/strconv/types.ha => vulcan/strconv/types.ha +2 -2
@@ 17,8 17,8 @@ export type base = enum uint {
	BIN = 2,
	// Base 8, octal
	OCT = 8,
	// Base 10, decimal
	DEC = 10,
	// Base 10, decimal (default)
	DEC = 0,
	// Base 16, UPPERCASE hexadecimal
	HEX_UPPER = 16,
	// Alias for HEX_UPPER

M vulcan/strconv/utos.ha => vulcan/strconv/utos.ha +4 -0
@@ 24,6 24,10 @@ export fn u64tosb(u: u64, b: base) const str = {
		yield &lut_lower;
	};

	if (b == base::DEC) {
		b = 10;
	};

	let s = types::string { data = &buf, ... };
	if (u == 0) {
		buf[s.length] = '0';