summaryrefslogtreecommitdiff
path: root/kernel/src/scheduler/switch.S
blob: f4d0e79f4931f5046dca47af1d2cfa07a36dc083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "x86_64_regs.S"

.global context_switch
context_switch:
	/* switch rsp to old task's %rsp */

	/* save all old task's registers */
	push_caller_saved
	push_callee_saved

	/* save old task's rsp & rip */
	call schedule
	/* get new task's rsp & rip */

	/* restore all new task's registers */
	pop_callee_saved
	pop_caller_saved
	iretq