aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv/kernel/proc.c
blob: 3a39dd3da9c3e40d8d5746f535e17e7ad297edcd (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, char **argv, int argc)
{
	csr_write(CSR_SEPC, bin_entry(t->bin));
	__asm__("mv sp, %0\n" : "=r" (t->stack) :: "memory");
	__asm__("sret\n" ::: "memory");
}

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