Changeset View
Changeset View
Standalone View
Standalone View
stand/efi/loader/arch/amd64/amd64_tramp.S
Show All 24 Lines | |||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
* SUCH DAMAGE. | * SUCH DAMAGE. | ||||
* | * | ||||
* $FreeBSD$ | * $FreeBSD$ | ||||
*/ | */ | ||||
#include <machine/asmacros.h> | #include <machine/asmacros.h> | ||||
#define ASM_FILE | |||||
#include "multiboot2.h" | |||||
.text | .text | ||||
.globl amd64_tramp | .globl amd64_tramp | ||||
/* | /* | ||||
* void amd64_tramp(uint64_t stack, void *copy_finish, uint64_t kernend, | * void amd64_tramp(uint64_t stack, void *copy_finish, uint64_t kernend, | ||||
* uint64_t modulep, uint64_t pagetable, uint64_t entry) | * uint64_t modulep, uint64_t pagetable, uint64_t entry) | ||||
*/ | */ | ||||
amd64_tramp: | amd64_tramp: | ||||
Show All 11 Lines | amd64_tramp: | ||||
salq $32,%r13 /* Shift modulep and push it. */ | salq $32,%r13 /* Shift modulep and push it. */ | ||||
pushq %r13 | pushq %r13 | ||||
pushq %r15 /* Push the entry address. */ | pushq %r15 /* Push the entry address. */ | ||||
movq %r14,%cr3 /* Switch page tables. */ | movq %r14,%cr3 /* Switch page tables. */ | ||||
ret /* "Return" to kernel entry. */ | ret /* "Return" to kernel entry. */ | ||||
ALIGN_TEXT | ALIGN_TEXT | ||||
amd64_tramp_end: | amd64_tramp_end: | ||||
/* void multiboot2_exec(uint64_t entry, uint64_t multiboot_info, uint64_t stack) */ | |||||
.globl multiboot2_exec | |||||
multiboot2_exec: | |||||
movq %rdx,%rsp | |||||
pushq %rdi | |||||
movq %rsi,%rbx | |||||
movq $MULTIBOOT2_BOOTLOADER_MAGIC,%rax | |||||
ret | |||||
.data | .data | ||||
.globl amd64_tramp_size | .globl amd64_tramp_size | ||||
amd64_tramp_size: | amd64_tramp_size: | ||||
.long amd64_tramp_end-amd64_tramp | .long amd64_tramp_end-amd64_tramp |