Changeset View
Changeset View
Standalone View
Standalone View
head/sys/arm64/arm64/locore.S
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | |||||
* D-Cache: off | * D-Cache: off | ||||
* I-Cache: on or off | * I-Cache: on or off | ||||
* We are loaded at a 2MiB aligned address | * We are loaded at a 2MiB aligned address | ||||
*/ | */ | ||||
.text | .text | ||||
.globl _start | .globl _start | ||||
_start: | _start: | ||||
#ifdef LINUX_BOOT_ABI | |||||
/* | |||||
* See Documentation/arm64/booting.txt in the Linux kernel. | |||||
* This is needed to boot using U-Boot's booti command. | |||||
*/ | |||||
#define BOOTI_MAGIC 0x644d5241 | |||||
#define UBOOT_IMAGE_OFFSET 0 | |||||
#define UBOOT_IMAGE_SIZE _end - _start | |||||
#define UBOOT_IMAGE_FLAGS 0 | |||||
b 1f /* Executable code */ | |||||
.long 0 /* Executable code */ | |||||
.quad UBOOT_IMAGE_OFFSET /* Image load offset, little endian */ | |||||
.quad UBOOT_IMAGE_SIZE /* Effective Image size, little endian */ | |||||
.quad UBOOT_IMAGE_FLAGS /* kernel flags, little endian */ | |||||
.quad 0 /* reserved */ | |||||
.quad 0 /* reserved */ | |||||
.quad 0 /* reserved */ | |||||
.long BOOTI_MAGIC /* Magic number, little endian, "ARM\x64" */ | |||||
.long 0 /* reserved (used for PE COFF offset) */ | |||||
1: | |||||
#endif | |||||
/* Drop to EL1 */ | /* Drop to EL1 */ | ||||
bl drop_to_el1 | bl drop_to_el1 | ||||
/* | /* | ||||
* Disable the MMU. We may have entered the kernel with it on and | * Disable the MMU. We may have entered the kernel with it on and | ||||
* will need to update the tables later. If this has been set up | * will need to update the tables later. If this has been set up | ||||
* with anything other than a VA == PA map then this will fail, | * with anything other than a VA == PA map then this will fail, | ||||
* but in this case the code to find where we are running from | * but in this case the code to find where we are running from | ||||
▲ Show 20 Lines • Show All 278 Lines • ▼ Show 20 Lines | 1: | ||||
stp xzr, xzr, [x6], #16 | stp xzr, xzr, [x6], #16 | ||||
cmp x6, x27 | cmp x6, x27 | ||||
b.lo 1b | b.lo 1b | ||||
/* | /* | ||||
* Build the TTBR1 maps. | * Build the TTBR1 maps. | ||||
*/ | */ | ||||
/* Find the size of the kernel */ | |||||
mov x6, #(KERNBASE) | mov x6, #(KERNBASE) | ||||
/* Find modulep - begin */ | and x7, x0, x6 | ||||
sub x8, x0, x6 | cmp x7, x6 | ||||
b.eq 1f | |||||
/* booted from U-Boot */ | |||||
ldr x7, .Lend | |||||
sub x8, x7, x6 /* kernel size = end - begin */ | |||||
b 2f | |||||
1: | |||||
/* booted from FreeBSD loader */ | |||||
sub x8, x0, x6 /* size = modulep - begin */ | |||||
/* Add two 2MiB pages for the module data and round up */ | /* Add two 2MiB pages for the module data and round up */ | ||||
ldr x7, =(3 * L2_SIZE - 1) | ldr x7, =(3 * L2_SIZE - 1) | ||||
add x8, x8, x7 | add x8, x8, x7 | ||||
2: | |||||
/* Get the number of l2 pages to allocate, rounded down */ | /* Get the number of l2 pages to allocate, rounded down */ | ||||
lsr x10, x8, #(L2_SHIFT) | lsr x10, x8, #(L2_SHIFT) | ||||
/* Add 1 to get actual count */ | |||||
add x10, x10, #1 | |||||
/* Create the kernel space L2 table */ | /* Create the kernel space L2 table */ | ||||
mov x6, x26 | mov x6, x26 | ||||
mov x7, #NORMAL_MEM | mov x7, #NORMAL_MEM | ||||
mov x8, #(KERNBASE & L2_BLOCK_MASK) | mov x8, #(KERNBASE & L2_BLOCK_MASK) | ||||
mov x9, x28 | mov x9, x28 | ||||
bl build_l2_block_pagetable | bl build_l2_block_pagetable | ||||
▲ Show 20 Lines • Show All 357 Lines • Show Last 20 Lines |