> Date: Tue, 22 Mar 2022 13:35:00 +1100 > From: Jonathan Gray <[email protected]> > > On Mon, Mar 21, 2022 at 08:00:56PM +0000, Miod Vallat wrote: > > The current state of the kernel starts userland processes with register > > a0 pointing to the stack, with a comment mentioning this is copied from > > FreeBSD. > > > > But while FreeBSD userland startup code (lib/csu) depends on this, > > OpenBSD binaries do not need this. > > > > Thus, don't bother setting up a0 upon startup. > > > > Completely untested. > > tested with qemu-system-riscv64 userland > > ok jsg@
ok kettenis@ > > Index: machdep.c > > =================================================================== > > RCS file: /OpenBSD/src/sys/arch/riscv64/riscv64/machdep.c,v > > retrieving revision 1.26 > > diff -u -p -r1.26 machdep.c > > --- machdep.c 14 Sep 2021 12:03:49 -0000 1.26 > > +++ machdep.c 21 Mar 2022 19:58:15 -0000 > > @@ -418,7 +418,6 @@ setregs(struct proc *p, struct exec_pack > > tf->tf_sstatus |= SSTATUS_FS_OFF; > > > > memset(tf, 0, sizeof(*tf)); > > - tf->tf_a[0] = stack; // XXX Inherited from FreeBSD. Why? > > tf->tf_sp = STACKALIGN(stack); > > tf->tf_ra = pack->ep_entry; > > tf->tf_sepc = pack->ep_entry; > > > > > >
