source: bootcd/isolinux/syslinux-6.03/efi/x86_64/linux.S

Last change on this file was e16e8f2, checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago

bootstuff

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[e16e8f2]1/* ----------------------------------------------------------------------- *
2 *
3 *   Copyright 2013 Intel Corporation; author: Matt Fleming
4 *
5 *   This program is free software; you can redistribute it and/or modify
6 *   it under the terms of the GNU General Public License as published by
7 *   the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
8 *   Boston MA 02110-1301, USA; either version 2 of the License, or
9 *   (at your option) any later version; incorporated herein by reference.
10 *
11 * ----------------------------------------------------------------------- */
12
13#define CR0_PG_FLAG     0x80000000
14#define MSR_EFER        0xc0000080
15
16        .globl kernel_jump
17        .type kernel_jump,@function
18        .code64
19kernel_jump:
20        cli
21
22        /*
23         * Setup our segment selector (0x10) and return address (%rdi)
24         * on the stack in preparation for the far return below.
25         */
26        mov     $0x1000000000, %rcx
27        addq    %rcx, %rdi
28        pushq   %rdi
29
30        .code32
31pm_code:
32
33        /* Disable IA-32e mode by clearing IA32_EFER.LME */
34        xorl    %eax, %eax
35        xorl    %edx, %edx
36        movl    $MSR_EFER, %ecx
37        wrmsr
38
39        /* Turn off paging to disable long mode */
40        movl    %cr0, %eax
41        andl    $~CR0_PG_FLAG, %eax
42        movl    %eax, %cr0
43
44        /* Far return */
45        lret
46
47        .code64
48        .align 4
49        .globl efi_handover_32
50        .type  efi_handover_32,@function
51efi_handover_32:
52        movl    $38, errno(%rip)        /* ENOSYS */
53        ret
54
55        .globl efi_handover_64
56        .globl efi_handover
57        .type  efi_handover_64,@function
58        .type  efi_handover,@function
59efi_handover_64:
60efi_handover:
61        add     $512, %rcx
62        cli
63        jmp     *%rcx
Note: See TracBrowser for help on using the repository browser.