~sircmpwn/helios-devel

helios: init: Write registers in arch_init instead of map_tables v1 APPLIED

Alexey Yerin: 1
 init: Write registers in arch_init instead of map_tables

 2 files changed, 12 insertions(+), 12 deletions(-)
#1059411 .build.yml failed
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/helios-devel/patches/44841/mbox | git am -3
Learn more about email & git

[PATCH helios] init: Write registers in arch_init instead of map_tables Export this patch

---
... why was this done?

 init/+aarch64/arch_load.ha | 12 ++++++------
 init/+x86_64/arch_load.ha  | 12 ++++++------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/init/+aarch64/arch_load.ha b/init/+aarch64/arch_load.ha
index 50f3658..ce32da4 100644
--- a/init/+aarch64/arch_load.ha
+++ b/init/+aarch64/arch_load.ha
@@ -8,6 +8,12 @@ fn arch_load(task: *task, image: *elf::header64) void = {
	map_tables(task, image, &task.bootinfo.arch.l1, &map_l1);
	map_tables(task, image, &task.bootinfo.arch.l2, &map_l2);
	map_tables(task, image, &task.bootinfo.arch.l3, &map_l3);

	static let regs = arch::state { ... };
	regs.sp = INIT_STACK_ADDR;
	regs.pc = image.e_entry;
	regs.x0 = INIT_BOOTINFO_ADDR;
	objects::task_writeregisters(task.task, &regs)!;
};

type mapfunc = fn(task: *task, vaddr: uintptr) void;
@@ -41,12 +47,6 @@ fn map_tables(
		func(task, base);
		base -= mem::UPAGESIZE;
	};

	static let regs = arch::state { ... };
	regs.sp = INIT_STACK_ADDR;
	regs.pc = image.e_entry;
	regs.x0 = INIT_BOOTINFO_ADDR;
	objects::task_writeregisters(task.task, &regs)!;
};

fn map_tls(task: *task, image: *elf::header64, func: *mapfunc) void = {
diff --git a/init/+x86_64/arch_load.ha b/init/+x86_64/arch_load.ha
index 4992b41..b8c24c3 100644
--- a/init/+x86_64/arch_load.ha
+++ b/init/+x86_64/arch_load.ha
@@ -8,6 +8,12 @@ fn arch_load(task: *task, image: *elf::header64) void = {
	map_tables(task, image, &task.bootinfo.arch.pdpt, &map_pdpt);
	map_tables(task, image, &task.bootinfo.arch.pd, &map_pd);
	map_tables(task, image, &task.bootinfo.arch.pt, &map_pt);

	static let regs = arch::state { ... };
	regs.rsp = INIT_STACK_ADDR;
	regs.rip = image.e_entry;
	regs.rdi = INIT_BOOTINFO_ADDR;
	objects::task_writeregisters(task.task, &regs)!;
};

type mapfunc = fn(task: *task, vaddr: uintptr) void;
@@ -41,12 +47,6 @@ fn map_tables(
		func(task, base);
		base -= mem::UPAGESIZE;
	};

	static let regs = arch::state { ... };
	regs.rsp = INIT_STACK_ADDR;
	regs.rdi = INIT_BOOTINFO_ADDR;
	regs.rip = image.e_entry;
	objects::task_writeregisters(task.task, &regs)!;
};

fn map_tls(task: *task, image: *elf::header64, func: *mapfunc) void = {
-- 
2.42.0
helios/patches/.build.yml: FAILED in 42s

[init: Write registers in arch_init instead of map_tables][0] from [Alexey Yerin][1]

[0]: https://lists.sr.ht/~sircmpwn/helios-devel/patches/44841
[1]: mailto:yyp@disroot.org

✗ #1059411 FAILED helios/patches/.build.yml https://builds.sr.ht/~sircmpwn/job/1059411
Thanks!

To git@git.sr.ht:~sircmpwn/helios
   3587de8..eecd12d  master -> master

With your changes this boots and gets into the test suite, but there is
a fault here:

task::pagefault................. Warning: faulting task 0xffff000040452000 has no fault handler
Page fault @ address 7fff7ffeff70 from ip 80c824; 10010010000000000000000001000111
ESR: 92000047	FAR: 7fff7ffeff70	SPSR: 20000000	TPIDR: 4000000000f0
pc: 80c824	sp: 7fff7fff0030
x0: 82f9a8	x1: 21	x2: 2b	x3: 0
x4: 318	x5: 8	x6: 0	x7: 8
x8: 4	x9: 0	x10: 0	x11: 0
x12: 0	x13: 0	x14: 0	x15: 0
x16: 0	x17: 0	x18: 0	x19: 21
x20: 3	x21: 7fff7ffff6c8	x22: 7fff7ffff6e0	x23: 2
x24: 2	x25: 0	x26: 0	x27: 0
x28: 0	x29: 7fff7fff0030	x30: 80c88c

This is probably related to the new uapi fault handling logic not being
tested in aarch64. Will investigate myself if you don't get to it first.