File indexing completed on 2025-05-11 08:24:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030 #include <bspopts.h>
0031 #include <gdt.h>
0032
0033 #ifdef BSP_MULTIBOOT_SUPPORT
0034 #include <multiboot2.h>
0035 #endif
0036
0037 .text
0038 .section .text._start,"ax",@progbits
0039 .p2align 4,,15
0040 .globl _start
0041 .type _start, @function
0042 _start:
0043 .cfi_startproc
0044 movq %rsp, %rbp
0045
0046
0047
0048
0049
0050
0051 movabsq $_ISR_Stack_area_begin, %rsp
0052 addq $_ISR_Stack_size, %rsp
0053
0054 #ifndef BSP_USE_EFI_BOOT_SERVICES
0055
0056 lgdt amd64_gdt_descriptor
0057
0058
0059 movw $GDT_DATA_SEG_OFFSET, %ax
0060 movw %ax, %ds
0061 movw %ax, %es
0062 movw %ax, %ss
0063 movw %ax, %fs
0064
0065
0066 pushq $GDT_CODE_SEG_OFFSET
0067 pushq $after_load_gdt
0068 retfq
0069
0070 after_load_gdt:
0071 #endif
0072
0073 #ifndef BSP_MULTIBOOT_SUPPORT
0074
0075
0076
0077
0078
0079
0080
0081
0082
0083
0084 movl 4(%rbp), %edi
0085 call retrieve_info_from_freebsd_loader
0086 #endif
0087
0088 .cfi_def_cfa_offset 16
0089 xorl %edi, %edi
0090 #ifdef BSP_MULTIBOOT_SUPPORT
0091 mov %eax, _multiboot2_magic
0092 mov %rbx, _multiboot2_info_ptr
0093 #endif
0094 movabsq $boot_card, %rax
0095 call *%rax
0096 .cfi_endproc
0097
0098 #ifdef BSP_MULTIBOOT_SUPPORT
0099
0100 multiboot2:
0101 ret
0102
0103 _multiboot2_start:
0104 jmp _start
0105
0106 .text
0107 .section .multiboot2_header
0108 .p2align 4,,15
0109 multiboot2_header_start:
0110 .long MULTIBOOT2_HEADER_MAGIC
0111 .long MULTIBOOT_ARCHITECTURE_I386
0112 .long multiboot2_header_end - multiboot2_header_start
0113 .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot2_header_end - multiboot2_header_start))
0114 efi_bootservices_start:
0115 .short MULTIBOOT_HEADER_TAG_EFI_BS
0116 .short 0
0117 .long efi_bootservices_end - efi_bootservices_start
0118 efi_bootservices_end:
0119 efi64_entry_start:
0120 .short MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64
0121 .short 0
0122 .long efi64_entry_end - efi64_entry_start
0123 .long _start
0124
0125 .long 0
0126 efi64_entry_end:
0127 info_requests_start:
0128 .short MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST
0129 .short 0
0130 .long info_requests_end - info_requests_start
0131 .long MULTIBOOT_TAG_TYPE_EFI64
0132 .long MULTIBOOT_TAG_TYPE_CMDLINE
0133 #ifdef BSP_USE_EFI_BOOT_SERVICES
0134 .long MULTIBOOT_TAG_TYPE_EFI_BS
0135 #else
0136 .long 0
0137 #endif
0138 .long MULTIBOOT_TAG_TYPE_ACPI_OLD
0139 .long MULTIBOOT_TAG_TYPE_ACPI_NEW
0140 .long 0
0141 info_requests_end:
0142
0143 .short MULTIBOOT_HEADER_TAG_END
0144 .short 0
0145 .long 8
0146 multiboot2_header_end:
0147
0148 .data
0149 .global _multiboot2_magic
0150 _multiboot2_magic:
0151 .long 0
0152
0153 .data
0154 .global _multiboot2_info_ptr
0155 _multiboot2_info_ptr:
0156 .quad 0
0157
0158 #endif