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

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