aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/proc.c
blob: 6d351bc0c1444994f48e8b2565cdfc35b299eada (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->stack) :: "memory");
	__asm__("sret\n" ::: "memory");
}

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