aboutsummaryrefslogtreecommitdiff
path: root/src/arch/x86_64/context.rs
blob: 37b6c2f6b14bf306b0e67760c25c9d3226aee923 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/// high level representation of the callee saved registers for thread context. The caller
/// saved registers will is pushed into the stack already upon the interrupt entry
/// fpstate is NOT saved here
#[repr(C)]
pub struct Context {
	rbx: u64,
	r12: u64,
	r13: u64,
	r14: u64,
	r15: u64,
	rbp: u64,
	rsp: u64,
}

/// prepare the thread (coroutine) for the first execution
pub unsafe fn settle() {
	todo!()
	// it will be something like this...
	// void **sp = (void**)tos;
	// *(--sp) = object;      // 7th parameter for kickoff
	// *(--sp) = (void*)0;    // return address
	// *(--sp) = kickoff;            // address
	// regs->rsp = sp;
}

pub unsafe fn switch(ctx_curr: usize, ctx_next: usize) {
	todo!()
}