aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/proc.c
blob: 57ddc5b1dfae0c2202fedabb723deb547cfd24a9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <apos/tcb.h>
#include <apos/elf.h>
#include <csr.h>

void jump_to_userspace(struct tcb *t, vm_t bin, int argc, char **argv)
{
	csr_write(CSR_SEPC, prepare_proc(t, bin));
	__asm__("mv sp, %0\n" : "=r" (t->proc_stack) :: "memory");
	__asm__("sret\n" ::: "memory");
}

void return_to_userspace(struct tcb *t)
{
	/* lol */
}