head_64.S 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * linux/boot/head.S
  4. *
  5. * Copyright (C) 1991, 1992, 1993 Linus Torvalds
  6. */
  7. /*
  8. * head.S contains the 32-bit startup code.
  9. *
  10. * NOTE!!! Startup happens at absolute address 0x00001000, which is also where
  11. * the page directory will exist. The startup code will be overwritten by
  12. * the page directory. [According to comments etc elsewhere on a compressed
  13. * kernel it will end up at 0x1000 + 1Mb I hope so as I assume this. - AC]
  14. *
  15. * Page 0 is deliberately kept safe, since System Management Mode code in
  16. * laptops may need to access the BIOS data stored there. This is also
  17. * useful for future device drivers that either access the BIOS via VM86
  18. * mode.
  19. */
  20. /*
  21. * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
  22. */
  23. .code32
  24. .text
  25. #include <linux/init.h>
  26. #include <linux/linkage.h>
  27. #include <asm/segment.h>
  28. #include <asm/boot.h>
  29. #include <asm/msr.h>
  30. #include <asm/processor-flags.h>
  31. #include <asm/asm-offsets.h>
  32. #include <asm/bootparam.h>
  33. #include "pgtable.h"
  34. /*
  35. * Locally defined symbols should be marked hidden:
  36. */
  37. .hidden _bss
  38. .hidden _ebss
  39. .hidden _got
  40. .hidden _egot
  41. .hidden _end
  42. __HEAD
  43. .code32
  44. ENTRY(startup_32)
  45. /*
  46. * 32bit entry is 0 and it is ABI so immutable!
  47. * If we come here directly from a bootloader,
  48. * kernel(text+data+bss+brk) ramdisk, zero_page, command line
  49. * all need to be under the 4G limit.
  50. */
  51. cld
  52. /*
  53. * Test KEEP_SEGMENTS flag to see if the bootloader is asking
  54. * us to not reload segments
  55. */
  56. testb $KEEP_SEGMENTS, BP_loadflags(%esi)
  57. jnz 1f
  58. cli
  59. movl $(__BOOT_DS), %eax
  60. movl %eax, %ds
  61. movl %eax, %es
  62. movl %eax, %ss
  63. 1:
  64. /*
  65. * Calculate the delta between where we were compiled to run
  66. * at and where we were actually loaded at. This can only be done
  67. * with a short local call on x86. Nothing else will tell us what
  68. * address we are running at. The reserved chunk of the real-mode
  69. * data at 0x1e4 (defined as a scratch field) are used as the stack
  70. * for this calculation. Only 4 bytes are needed.
  71. */
  72. leal (BP_scratch+4)(%esi), %esp
  73. call 1f
  74. 1: popl %ebp
  75. subl $1b, %ebp
  76. /* setup a stack and make sure cpu supports long mode. */
  77. movl $boot_stack_end, %eax
  78. addl %ebp, %eax
  79. movl %eax, %esp
  80. call verify_cpu
  81. testl %eax, %eax
  82. jnz no_longmode
  83. /*
  84. * Compute the delta between where we were compiled to run at
  85. * and where the code will actually run at.
  86. *
  87. * %ebp contains the address we are loaded at by the boot loader and %ebx
  88. * contains the address where we should move the kernel image temporarily
  89. * for safe in-place decompression.
  90. */
  91. #ifdef CONFIG_RELOCATABLE
  92. movl %ebp, %ebx
  93. movl BP_kernel_alignment(%esi), %eax
  94. decl %eax
  95. addl %eax, %ebx
  96. notl %eax
  97. andl %eax, %ebx
  98. cmpl $LOAD_PHYSICAL_ADDR, %ebx
  99. jae 1f
  100. #endif
  101. movl $LOAD_PHYSICAL_ADDR, %ebx
  102. 1:
  103. /* Target address to relocate to for decompression */
  104. movl BP_init_size(%esi), %eax
  105. subl $_end, %eax
  106. addl %eax, %ebx
  107. /*
  108. * Prepare for entering 64 bit mode
  109. */
  110. /* Load new GDT with the 64bit segments using 32bit descriptor */
  111. addl %ebp, gdt+2(%ebp)
  112. lgdt gdt(%ebp)
  113. /* Enable PAE mode */
  114. movl %cr4, %eax
  115. orl $X86_CR4_PAE, %eax
  116. movl %eax, %cr4
  117. /*
  118. * Build early 4G boot pagetable
  119. */
  120. /*
  121. * If SEV is active then set the encryption mask in the page tables.
  122. * This will insure that when the kernel is copied and decompressed
  123. * it will be done so encrypted.
  124. */
  125. call get_sev_encryption_bit
  126. xorl %edx, %edx
  127. testl %eax, %eax
  128. jz 1f
  129. subl $32, %eax /* Encryption bit is always above bit 31 */
  130. bts %eax, %edx /* Set encryption mask for page tables */
  131. 1:
  132. /* Initialize Page tables to 0 */
  133. leal pgtable(%ebx), %edi
  134. xorl %eax, %eax
  135. movl $(BOOT_INIT_PGT_SIZE/4), %ecx
  136. rep stosl
  137. /* Build Level 4 */
  138. leal pgtable + 0(%ebx), %edi
  139. leal 0x1007 (%edi), %eax
  140. movl %eax, 0(%edi)
  141. addl %edx, 4(%edi)
  142. /* Build Level 3 */
  143. leal pgtable + 0x1000(%ebx), %edi
  144. leal 0x1007(%edi), %eax
  145. movl $4, %ecx
  146. 1: movl %eax, 0x00(%edi)
  147. addl %edx, 0x04(%edi)
  148. addl $0x00001000, %eax
  149. addl $8, %edi
  150. decl %ecx
  151. jnz 1b
  152. /* Build Level 2 */
  153. leal pgtable + 0x2000(%ebx), %edi
  154. movl $0x00000183, %eax
  155. movl $2048, %ecx
  156. 1: movl %eax, 0(%edi)
  157. addl %edx, 4(%edi)
  158. addl $0x00200000, %eax
  159. addl $8, %edi
  160. decl %ecx
  161. jnz 1b
  162. /* Enable the boot page tables */
  163. leal pgtable(%ebx), %eax
  164. movl %eax, %cr3
  165. /* Enable Long mode in EFER (Extended Feature Enable Register) */
  166. movl $MSR_EFER, %ecx
  167. rdmsr
  168. btsl $_EFER_LME, %eax
  169. wrmsr
  170. /* After gdt is loaded */
  171. xorl %eax, %eax
  172. lldt %ax
  173. movl $__BOOT_TSS, %eax
  174. ltr %ax
  175. /*
  176. * Setup for the jump to 64bit mode
  177. *
  178. * When the jump is performend we will be in long mode but
  179. * in 32bit compatibility mode with EFER.LME = 1, CS.L = 0, CS.D = 1
  180. * (and in turn EFER.LMA = 1). To jump into 64bit mode we use
  181. * the new gdt/idt that has __KERNEL_CS with CS.L = 1.
  182. * We place all of the values on our mini stack so lret can
  183. * used to perform that far jump.
  184. */
  185. pushl $__KERNEL_CS
  186. leal startup_64(%ebp), %eax
  187. #ifdef CONFIG_EFI_MIXED
  188. movl efi32_config(%ebp), %ebx
  189. cmp $0, %ebx
  190. jz 1f
  191. leal handover_entry(%ebp), %eax
  192. 1:
  193. #endif
  194. pushl %eax
  195. /* Enter paged protected Mode, activating Long Mode */
  196. movl $(X86_CR0_PG | X86_CR0_PE), %eax /* Enable Paging and Protected mode */
  197. movl %eax, %cr0
  198. /* Jump from 32bit compatibility mode into 64bit mode. */
  199. lret
  200. ENDPROC(startup_32)
  201. #ifdef CONFIG_EFI_MIXED
  202. .org 0x190
  203. ENTRY(efi32_stub_entry)
  204. add $0x4, %esp /* Discard return address */
  205. popl %ecx
  206. popl %edx
  207. popl %esi
  208. leal (BP_scratch+4)(%esi), %esp
  209. call 1f
  210. 1: pop %ebp
  211. subl $1b, %ebp
  212. movl %ecx, efi32_config(%ebp)
  213. movl %edx, efi32_config+8(%ebp)
  214. sgdtl efi32_boot_gdt(%ebp)
  215. leal efi32_config(%ebp), %eax
  216. movl %eax, efi_config(%ebp)
  217. /* Disable paging */
  218. movl %cr0, %eax
  219. btrl $X86_CR0_PG_BIT, %eax
  220. movl %eax, %cr0
  221. jmp startup_32
  222. ENDPROC(efi32_stub_entry)
  223. #endif
  224. .code64
  225. .org 0x200
  226. ENTRY(startup_64)
  227. /*
  228. * 64bit entry is 0x200 and it is ABI so immutable!
  229. * We come here either from startup_32 or directly from a
  230. * 64bit bootloader.
  231. * If we come here from a bootloader, kernel(text+data+bss+brk),
  232. * ramdisk, zero_page, command line could be above 4G.
  233. * We depend on an identity mapped page table being provided
  234. * that maps our entire kernel(text+data+bss+brk), zero page
  235. * and command line.
  236. */
  237. /* Setup data segments. */
  238. xorl %eax, %eax
  239. movl %eax, %ds
  240. movl %eax, %es
  241. movl %eax, %ss
  242. movl %eax, %fs
  243. movl %eax, %gs
  244. /*
  245. * Compute the decompressed kernel start address. It is where
  246. * we were loaded at aligned to a 2M boundary. %rbp contains the
  247. * decompressed kernel start address.
  248. *
  249. * If it is a relocatable kernel then decompress and run the kernel
  250. * from load address aligned to 2MB addr, otherwise decompress and
  251. * run the kernel from LOAD_PHYSICAL_ADDR
  252. *
  253. * We cannot rely on the calculation done in 32-bit mode, since we
  254. * may have been invoked via the 64-bit entry point.
  255. */
  256. /* Start with the delta to where the kernel will run at. */
  257. #ifdef CONFIG_RELOCATABLE
  258. leaq startup_32(%rip) /* - $startup_32 */, %rbp
  259. movl BP_kernel_alignment(%rsi), %eax
  260. decl %eax
  261. addq %rax, %rbp
  262. notq %rax
  263. andq %rax, %rbp
  264. cmpq $LOAD_PHYSICAL_ADDR, %rbp
  265. jae 1f
  266. #endif
  267. movq $LOAD_PHYSICAL_ADDR, %rbp
  268. 1:
  269. /* Target address to relocate to for decompression */
  270. movl BP_init_size(%rsi), %ebx
  271. subl $_end, %ebx
  272. addq %rbp, %rbx
  273. /* Set up the stack */
  274. leaq boot_stack_end(%rbx), %rsp
  275. /*
  276. * paging_prepare() and cleanup_trampoline() below can have GOT
  277. * references. Adjust the table with address we are running at.
  278. *
  279. * Zero RAX for adjust_got: the GOT was not adjusted before;
  280. * there's no adjustment to undo.
  281. */
  282. xorq %rax, %rax
  283. /*
  284. * Calculate the address the binary is loaded at and use it as
  285. * a GOT adjustment.
  286. */
  287. call 1f
  288. 1: popq %rdi
  289. subq $1b, %rdi
  290. call adjust_got
  291. /*
  292. * At this point we are in long mode with 4-level paging enabled,
  293. * but we might want to enable 5-level paging or vice versa.
  294. *
  295. * The problem is that we cannot do it directly. Setting or clearing
  296. * CR4.LA57 in long mode would trigger #GP. So we need to switch off
  297. * long mode and paging first.
  298. *
  299. * We also need a trampoline in lower memory to switch over from
  300. * 4- to 5-level paging for cases when the bootloader puts the kernel
  301. * above 4G, but didn't enable 5-level paging for us.
  302. *
  303. * The same trampoline can be used to switch from 5- to 4-level paging
  304. * mode, like when starting 4-level paging kernel via kexec() when
  305. * original kernel worked in 5-level paging mode.
  306. *
  307. * For the trampoline, we need the top page table to reside in lower
  308. * memory as we don't have a way to load 64-bit values into CR3 in
  309. * 32-bit mode.
  310. *
  311. * We go though the trampoline even if we don't have to: if we're
  312. * already in a desired paging mode. This way the trampoline code gets
  313. * tested on every boot.
  314. */
  315. /* Make sure we have GDT with 32-bit code segment */
  316. leaq gdt(%rip), %rax
  317. movq %rax, gdt64+2(%rip)
  318. lgdt gdt64(%rip)
  319. /*
  320. * paging_prepare() sets up the trampoline and checks if we need to
  321. * enable 5-level paging.
  322. *
  323. * Address of the trampoline is returned in RAX.
  324. * Non zero RDX on return means we need to enable 5-level paging.
  325. *
  326. * RSI holds real mode data and needs to be preserved across
  327. * this function call.
  328. */
  329. pushq %rsi
  330. movq %rsi, %rdi /* real mode address */
  331. call paging_prepare
  332. popq %rsi
  333. /* Save the trampoline address in RCX */
  334. movq %rax, %rcx
  335. /*
  336. * Load the address of trampoline_return() into RDI.
  337. * It will be used by the trampoline to return to the main code.
  338. */
  339. leaq trampoline_return(%rip), %rdi
  340. /* Switch to compatibility mode (CS.L = 0 CS.D = 1) via far return */
  341. pushq $__KERNEL32_CS
  342. leaq TRAMPOLINE_32BIT_CODE_OFFSET(%rax), %rax
  343. pushq %rax
  344. lretq
  345. trampoline_return:
  346. /* Restore the stack, the 32-bit trampoline uses its own stack */
  347. leaq boot_stack_end(%rbx), %rsp
  348. /*
  349. * cleanup_trampoline() would restore trampoline memory.
  350. *
  351. * RDI is address of the page table to use instead of page table
  352. * in trampoline memory (if required).
  353. *
  354. * RSI holds real mode data and needs to be preserved across
  355. * this function call.
  356. */
  357. pushq %rsi
  358. leaq top_pgtable(%rbx), %rdi
  359. call cleanup_trampoline
  360. popq %rsi
  361. /* Zero EFLAGS */
  362. pushq $0
  363. popfq
  364. /*
  365. * Previously we've adjusted the GOT with address the binary was
  366. * loaded at. Now we need to re-adjust for relocation address.
  367. *
  368. * Calculate the address the binary is loaded at, so that we can
  369. * undo the previous GOT adjustment.
  370. */
  371. call 1f
  372. 1: popq %rax
  373. subq $1b, %rax
  374. /* The new adjustment is the relocation address */
  375. movq %rbx, %rdi
  376. call adjust_got
  377. /*
  378. * Copy the compressed kernel to the end of our buffer
  379. * where decompression in place becomes safe.
  380. */
  381. pushq %rsi
  382. leaq (_bss-8)(%rip), %rsi
  383. leaq (_bss-8)(%rbx), %rdi
  384. movq $_bss /* - $startup_32 */, %rcx
  385. shrq $3, %rcx
  386. std
  387. rep movsq
  388. cld
  389. popq %rsi
  390. /*
  391. * Jump to the relocated address.
  392. */
  393. leaq relocated(%rbx), %rax
  394. jmp *%rax
  395. #ifdef CONFIG_EFI_STUB
  396. /* The entry point for the PE/COFF executable is efi_pe_entry. */
  397. ENTRY(efi_pe_entry)
  398. movq %rcx, efi64_config(%rip) /* Handle */
  399. movq %rdx, efi64_config+8(%rip) /* EFI System table pointer */
  400. leaq efi64_config(%rip), %rax
  401. movq %rax, efi_config(%rip)
  402. call 1f
  403. 1: popq %rbp
  404. subq $1b, %rbp
  405. /*
  406. * Relocate efi_config->call().
  407. */
  408. addq %rbp, efi64_config+40(%rip)
  409. movq %rax, %rdi
  410. call make_boot_params
  411. cmpq $0,%rax
  412. je fail
  413. mov %rax, %rsi
  414. leaq startup_32(%rip), %rax
  415. movl %eax, BP_code32_start(%rsi)
  416. jmp 2f /* Skip the relocation */
  417. handover_entry:
  418. call 1f
  419. 1: popq %rbp
  420. subq $1b, %rbp
  421. /*
  422. * Relocate efi_config->call().
  423. */
  424. movq efi_config(%rip), %rax
  425. addq %rbp, 40(%rax)
  426. 2:
  427. movq efi_config(%rip), %rdi
  428. call efi_main
  429. movq %rax,%rsi
  430. cmpq $0,%rax
  431. jne 2f
  432. fail:
  433. /* EFI init failed, so hang. */
  434. hlt
  435. jmp fail
  436. 2:
  437. movl BP_code32_start(%esi), %eax
  438. leaq startup_64(%rax), %rax
  439. jmp *%rax
  440. ENDPROC(efi_pe_entry)
  441. .org 0x390
  442. ENTRY(efi64_stub_entry)
  443. movq %rdi, efi64_config(%rip) /* Handle */
  444. movq %rsi, efi64_config+8(%rip) /* EFI System table pointer */
  445. leaq efi64_config(%rip), %rax
  446. movq %rax, efi_config(%rip)
  447. movq %rdx, %rsi
  448. jmp handover_entry
  449. ENDPROC(efi64_stub_entry)
  450. #endif
  451. .text
  452. relocated:
  453. /*
  454. * Clear BSS (stack is currently empty)
  455. */
  456. xorl %eax, %eax
  457. leaq _bss(%rip), %rdi
  458. leaq _ebss(%rip), %rcx
  459. subq %rdi, %rcx
  460. shrq $3, %rcx
  461. rep stosq
  462. /*
  463. * Do the extraction, and jump to the new kernel..
  464. */
  465. pushq %rsi /* Save the real mode argument */
  466. movq %rsi, %rdi /* real mode address */
  467. leaq boot_heap(%rip), %rsi /* malloc area for uncompression */
  468. leaq input_data(%rip), %rdx /* input_data */
  469. movl $z_input_len, %ecx /* input_len */
  470. movq %rbp, %r8 /* output target address */
  471. movq $z_output_len, %r9 /* decompressed length, end of relocs */
  472. call extract_kernel /* returns kernel location in %rax */
  473. popq %rsi
  474. /*
  475. * Jump to the decompressed kernel.
  476. */
  477. jmp *%rax
  478. /*
  479. * Adjust the global offset table
  480. *
  481. * RAX is the previous adjustment of the table to undo (use 0 if it's the
  482. * first time we touch GOT).
  483. * RDI is the new adjustment to apply.
  484. */
  485. adjust_got:
  486. /* Walk through the GOT adding the address to the entries */
  487. leaq _got(%rip), %rdx
  488. leaq _egot(%rip), %rcx
  489. 1:
  490. cmpq %rcx, %rdx
  491. jae 2f
  492. subq %rax, (%rdx) /* Undo previous adjustment */
  493. addq %rdi, (%rdx) /* Apply the new adjustment */
  494. addq $8, %rdx
  495. jmp 1b
  496. 2:
  497. ret
  498. .code32
  499. /*
  500. * This is the 32-bit trampoline that will be copied over to low memory.
  501. *
  502. * RDI contains the return address (might be above 4G).
  503. * ECX contains the base address of the trampoline memory.
  504. * Non zero RDX on return means we need to enable 5-level paging.
  505. */
  506. ENTRY(trampoline_32bit_src)
  507. /* Set up data and stack segments */
  508. movl $__KERNEL_DS, %eax
  509. movl %eax, %ds
  510. movl %eax, %ss
  511. /* Set up new stack */
  512. leal TRAMPOLINE_32BIT_STACK_END(%ecx), %esp
  513. /* Disable paging */
  514. movl %cr0, %eax
  515. btrl $X86_CR0_PG_BIT, %eax
  516. movl %eax, %cr0
  517. /* Check what paging mode we want to be in after the trampoline */
  518. cmpl $0, %edx
  519. jz 1f
  520. /* We want 5-level paging: don't touch CR3 if it already points to 5-level page tables */
  521. movl %cr4, %eax
  522. testl $X86_CR4_LA57, %eax
  523. jnz 3f
  524. jmp 2f
  525. 1:
  526. /* We want 4-level paging: don't touch CR3 if it already points to 4-level page tables */
  527. movl %cr4, %eax
  528. testl $X86_CR4_LA57, %eax
  529. jz 3f
  530. 2:
  531. /* Point CR3 to the trampoline's new top level page table */
  532. leal TRAMPOLINE_32BIT_PGTABLE_OFFSET(%ecx), %eax
  533. movl %eax, %cr3
  534. 3:
  535. /* Set EFER.LME=1 as a precaution in case hypervsior pulls the rug */
  536. pushl %ecx
  537. pushl %edx
  538. movl $MSR_EFER, %ecx
  539. rdmsr
  540. btsl $_EFER_LME, %eax
  541. wrmsr
  542. popl %edx
  543. popl %ecx
  544. /* Enable PAE and LA57 (if required) paging modes */
  545. movl $X86_CR4_PAE, %eax
  546. cmpl $0, %edx
  547. jz 1f
  548. orl $X86_CR4_LA57, %eax
  549. 1:
  550. movl %eax, %cr4
  551. /* Calculate address of paging_enabled() once we are executing in the trampoline */
  552. leal paging_enabled - trampoline_32bit_src + TRAMPOLINE_32BIT_CODE_OFFSET(%ecx), %eax
  553. /* Prepare the stack for far return to Long Mode */
  554. pushl $__KERNEL_CS
  555. pushl %eax
  556. /* Enable paging again */
  557. movl $(X86_CR0_PG | X86_CR0_PE), %eax
  558. movl %eax, %cr0
  559. lret
  560. .code64
  561. paging_enabled:
  562. /* Return from the trampoline */
  563. jmp *%rdi
  564. /*
  565. * The trampoline code has a size limit.
  566. * Make sure we fail to compile if the trampoline code grows
  567. * beyond TRAMPOLINE_32BIT_CODE_SIZE bytes.
  568. */
  569. .org trampoline_32bit_src + TRAMPOLINE_32BIT_CODE_SIZE
  570. .code32
  571. no_longmode:
  572. /* This isn't an x86-64 CPU, so hang intentionally, we cannot continue */
  573. 1:
  574. hlt
  575. jmp 1b
  576. #include "../../kernel/verify_cpu.S"
  577. .data
  578. gdt64:
  579. .word gdt_end - gdt
  580. .long 0
  581. .word 0
  582. .quad 0
  583. gdt:
  584. .word gdt_end - gdt
  585. .long gdt
  586. .word 0
  587. .quad 0x00cf9a000000ffff /* __KERNEL32_CS */
  588. .quad 0x00af9a000000ffff /* __KERNEL_CS */
  589. .quad 0x00cf92000000ffff /* __KERNEL_DS */
  590. .quad 0x0080890000000000 /* TS descriptor */
  591. .quad 0x0000000000000000 /* TS continued */
  592. gdt_end:
  593. #ifdef CONFIG_EFI_STUB
  594. efi_config:
  595. .quad 0
  596. #ifdef CONFIG_EFI_MIXED
  597. .global efi32_config
  598. efi32_config:
  599. .fill 5,8,0
  600. .quad efi64_thunk
  601. .byte 0
  602. #endif
  603. .global efi64_config
  604. efi64_config:
  605. .fill 5,8,0
  606. .quad efi_call
  607. .byte 1
  608. #endif /* CONFIG_EFI_STUB */
  609. /*
  610. * Stack and heap for uncompression
  611. */
  612. .bss
  613. .balign 4
  614. boot_heap:
  615. .fill BOOT_HEAP_SIZE, 1, 0
  616. boot_stack:
  617. .fill BOOT_STACK_SIZE, 1, 0
  618. boot_stack_end:
  619. /*
  620. * Space for page tables (not in .bss so not zeroed)
  621. */
  622. .section ".pgtable","a",@nobits
  623. .balign 4096
  624. pgtable:
  625. .fill BOOT_PGT_SIZE, 1, 0
  626. /*
  627. * The page table is going to be used instead of page table in the trampoline
  628. * memory.
  629. */
  630. top_pgtable:
  631. .fill PAGE_SIZE, 1, 0