aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/proc.c
blob: b6969121ea6a47b26a6b32d2086fb60c5ceabd5d (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__ volatile ("mv sp, %0\n" : "=r" (t->proc_stack) :: "memory");
	__asm__ volatile ("sret\n" ::: "memory");
}

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