forked from vmware-archive/node-replicated-kernel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch.S
More file actions
27 lines (23 loc) · 713 Bytes
/
Copy pathswitch.S
File metadata and controls
27 lines (23 loc) · 713 Bytes
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
// Copyright © 2021 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
// UEFI uses Windows calling convention:
// ARG1 %rcx
// ARG2 %rdx
// ARG3 %r8
.text
.extern jump_to_kernel
jump_to_kernel: // fn(stack_ptr: u64, kernel_entry: u64, kernel_arg: u64)
// switch to our new stack
mov %rcx, %rbp
mov %rcx, %rsp
// move the data pointer to the first argument
// kernel expects sysv64 calling convention so rdi becomes first arg
mov %r8, %rdi
// We push 0 as return address in case we do stack backtracing we can
// abort
pushq $0
// absolute jump rather than call to the kernel entry point
jmp *%rdx
never_return:
hlt
jmp never_return