head_32.S 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659
  1. /*
  2. *
  3. * Copyright (C) 1991, 1992 Linus Torvalds
  4. *
  5. * Enhanced CPU detection and feature setting code by Mike Jagdis
  6. * and Martin Mares, November 1997.
  7. */
  8. .text
  9. #include <linux/threads.h>
  10. #include <linux/init.h>
  11. #include <linux/linkage.h>
  12. #include <asm/segment.h>
  13. #include <asm/page_types.h>
  14. #include <asm/pgtable_types.h>
  15. #include <asm/cache.h>
  16. #include <asm/thread_info.h>
  17. #include <asm/asm-offsets.h>
  18. #include <asm/setup.h>
  19. #include <asm/processor-flags.h>
  20. #include <asm/msr-index.h>
  21. #include <asm/cpufeatures.h>
  22. #include <asm/percpu.h>
  23. #include <asm/nops.h>
  24. #include <asm/bootparam.h>
  25. #include <asm/export.h>
  26. #include <asm/pgtable_32.h>
  27. /* Physical address */
  28. #define pa(X) ((X) - __PAGE_OFFSET)
  29. /*
  30. * References to members of the new_cpu_data structure.
  31. */
  32. #define X86 new_cpu_data+CPUINFO_x86
  33. #define X86_VENDOR new_cpu_data+CPUINFO_x86_vendor
  34. #define X86_MODEL new_cpu_data+CPUINFO_x86_model
  35. #define X86_MASK new_cpu_data+CPUINFO_x86_mask
  36. #define X86_HARD_MATH new_cpu_data+CPUINFO_hard_math
  37. #define X86_CPUID new_cpu_data+CPUINFO_cpuid_level
  38. #define X86_CAPABILITY new_cpu_data+CPUINFO_x86_capability
  39. #define X86_VENDOR_ID new_cpu_data+CPUINFO_x86_vendor_id
  40. #define SIZEOF_PTREGS 17*4
  41. /*
  42. * Worst-case size of the kernel mapping we need to make:
  43. * a relocatable kernel can live anywhere in lowmem, so we need to be able
  44. * to map all of lowmem.
  45. */
  46. KERNEL_PAGES = LOWMEM_PAGES
  47. INIT_MAP_SIZE = PAGE_TABLE_SIZE(KERNEL_PAGES) * PAGE_SIZE
  48. RESERVE_BRK(pagetables, INIT_MAP_SIZE)
  49. /*
  50. * 32-bit kernel entrypoint; only used by the boot CPU. On entry,
  51. * %esi points to the real-mode code as a 32-bit pointer.
  52. * CS and DS must be 4 GB flat segments, but we don't depend on
  53. * any particular GDT layout, because we load our own as soon as we
  54. * can.
  55. */
  56. __HEAD
  57. ENTRY(startup_32)
  58. movl pa(initial_stack),%ecx
  59. /* test KEEP_SEGMENTS flag to see if the bootloader is asking
  60. us to not reload segments */
  61. testb $KEEP_SEGMENTS, BP_loadflags(%esi)
  62. jnz 2f
  63. /*
  64. * Set segments to known values.
  65. */
  66. lgdt pa(boot_gdt_descr)
  67. movl $(__BOOT_DS),%eax
  68. movl %eax,%ds
  69. movl %eax,%es
  70. movl %eax,%fs
  71. movl %eax,%gs
  72. movl %eax,%ss
  73. 2:
  74. leal -__PAGE_OFFSET(%ecx),%esp
  75. /*
  76. * Clear BSS first so that there are no surprises...
  77. */
  78. cld
  79. xorl %eax,%eax
  80. movl $pa(__bss_start),%edi
  81. movl $pa(__bss_stop),%ecx
  82. subl %edi,%ecx
  83. shrl $2,%ecx
  84. rep ; stosl
  85. /*
  86. * Copy bootup parameters out of the way.
  87. * Note: %esi still has the pointer to the real-mode data.
  88. * With the kexec as boot loader, parameter segment might be loaded beyond
  89. * kernel image and might not even be addressable by early boot page tables.
  90. * (kexec on panic case). Hence copy out the parameters before initializing
  91. * page tables.
  92. */
  93. movl $pa(boot_params),%edi
  94. movl $(PARAM_SIZE/4),%ecx
  95. cld
  96. rep
  97. movsl
  98. movl pa(boot_params) + NEW_CL_POINTER,%esi
  99. andl %esi,%esi
  100. jz 1f # No command line
  101. movl $pa(boot_command_line),%edi
  102. movl $(COMMAND_LINE_SIZE/4),%ecx
  103. rep
  104. movsl
  105. 1:
  106. #ifdef CONFIG_OLPC
  107. /* save OFW's pgdir table for later use when calling into OFW */
  108. movl %cr3, %eax
  109. movl %eax, pa(olpc_ofw_pgd)
  110. #endif
  111. #ifdef CONFIG_MICROCODE
  112. /* Early load ucode on BSP. */
  113. call load_ucode_bsp
  114. #endif
  115. /* Create early pagetables. */
  116. call mk_early_pgtbl_32
  117. /* Do early initialization of the fixmap area */
  118. movl $pa(initial_pg_fixmap)+PDE_IDENT_ATTR,%eax
  119. #ifdef CONFIG_X86_PAE
  120. #define KPMDS (((-__PAGE_OFFSET) >> 30) & 3) /* Number of kernel PMDs */
  121. movl %eax,pa(initial_pg_pmd+0x1000*KPMDS-8)
  122. #else
  123. movl %eax,pa(initial_page_table+0xffc)
  124. #endif
  125. #ifdef CONFIG_PARAVIRT
  126. /* This is can only trip for a broken bootloader... */
  127. cmpw $0x207, pa(boot_params + BP_version)
  128. jb .Ldefault_entry
  129. /* Paravirt-compatible boot parameters. Look to see what architecture
  130. we're booting under. */
  131. movl pa(boot_params + BP_hardware_subarch), %eax
  132. cmpl $num_subarch_entries, %eax
  133. jae .Lbad_subarch
  134. movl pa(subarch_entries)(,%eax,4), %eax
  135. subl $__PAGE_OFFSET, %eax
  136. jmp *%eax
  137. .Lbad_subarch:
  138. WEAK(lguest_entry)
  139. WEAK(xen_entry)
  140. /* Unknown implementation; there's really
  141. nothing we can do at this point. */
  142. ud2a
  143. __INITDATA
  144. subarch_entries:
  145. .long .Ldefault_entry /* normal x86/PC */
  146. .long lguest_entry /* lguest hypervisor */
  147. .long xen_entry /* Xen hypervisor */
  148. .long .Ldefault_entry /* Moorestown MID */
  149. num_subarch_entries = (. - subarch_entries) / 4
  150. .previous
  151. #else
  152. jmp .Ldefault_entry
  153. #endif /* CONFIG_PARAVIRT */
  154. #ifdef CONFIG_HOTPLUG_CPU
  155. /*
  156. * Boot CPU0 entry point. It's called from play_dead(). Everything has been set
  157. * up already except stack. We just set up stack here. Then call
  158. * start_secondary().
  159. */
  160. ENTRY(start_cpu0)
  161. movl initial_stack, %ecx
  162. movl %ecx, %esp
  163. call *(initial_code)
  164. 1: jmp 1b
  165. ENDPROC(start_cpu0)
  166. #endif
  167. /*
  168. * Non-boot CPU entry point; entered from trampoline.S
  169. * We can't lgdt here, because lgdt itself uses a data segment, but
  170. * we know the trampoline has already loaded the boot_gdt for us.
  171. *
  172. * If cpu hotplug is not supported then this code can go in init section
  173. * which will be freed later
  174. */
  175. ENTRY(startup_32_smp)
  176. cld
  177. movl $(__BOOT_DS),%eax
  178. movl %eax,%ds
  179. movl %eax,%es
  180. movl %eax,%fs
  181. movl %eax,%gs
  182. movl pa(initial_stack),%ecx
  183. movl %eax,%ss
  184. leal -__PAGE_OFFSET(%ecx),%esp
  185. #ifdef CONFIG_MICROCODE
  186. /* Early load ucode on AP. */
  187. call load_ucode_ap
  188. #endif
  189. .Ldefault_entry:
  190. #define CR0_STATE (X86_CR0_PE | X86_CR0_MP | X86_CR0_ET | \
  191. X86_CR0_NE | X86_CR0_WP | X86_CR0_AM | \
  192. X86_CR0_PG)
  193. movl $(CR0_STATE & ~X86_CR0_PG),%eax
  194. movl %eax,%cr0
  195. /*
  196. * We want to start out with EFLAGS unambiguously cleared. Some BIOSes leave
  197. * bits like NT set. This would confuse the debugger if this code is traced. So
  198. * initialize them properly now before switching to protected mode. That means
  199. * DF in particular (even though we have cleared it earlier after copying the
  200. * command line) because GCC expects it.
  201. */
  202. pushl $0
  203. popfl
  204. /*
  205. * New page tables may be in 4Mbyte page mode and may be using the global pages.
  206. *
  207. * NOTE! If we are on a 486 we may have no cr4 at all! Specifically, cr4 exists
  208. * if and only if CPUID exists and has flags other than the FPU flag set.
  209. */
  210. movl $-1,pa(X86_CPUID) # preset CPUID level
  211. movl $X86_EFLAGS_ID,%ecx
  212. pushl %ecx
  213. popfl # set EFLAGS=ID
  214. pushfl
  215. popl %eax # get EFLAGS
  216. testl $X86_EFLAGS_ID,%eax # did EFLAGS.ID remained set?
  217. jz .Lenable_paging # hw disallowed setting of ID bit
  218. # which means no CPUID and no CR4
  219. xorl %eax,%eax
  220. cpuid
  221. movl %eax,pa(X86_CPUID) # save largest std CPUID function
  222. movl $1,%eax
  223. cpuid
  224. andl $~1,%edx # Ignore CPUID.FPU
  225. jz .Lenable_paging # No flags or only CPUID.FPU = no CR4
  226. movl pa(mmu_cr4_features),%eax
  227. movl %eax,%cr4
  228. testb $X86_CR4_PAE, %al # check if PAE is enabled
  229. jz .Lenable_paging
  230. /* Check if extended functions are implemented */
  231. movl $0x80000000, %eax
  232. cpuid
  233. /* Value must be in the range 0x80000001 to 0x8000ffff */
  234. subl $0x80000001, %eax
  235. cmpl $(0x8000ffff-0x80000001), %eax
  236. ja .Lenable_paging
  237. /* Clear bogus XD_DISABLE bits */
  238. call verify_cpu
  239. mov $0x80000001, %eax
  240. cpuid
  241. /* Execute Disable bit supported? */
  242. btl $(X86_FEATURE_NX & 31), %edx
  243. jnc .Lenable_paging
  244. /* Setup EFER (Extended Feature Enable Register) */
  245. movl $MSR_EFER, %ecx
  246. rdmsr
  247. btsl $_EFER_NX, %eax
  248. /* Make changes effective */
  249. wrmsr
  250. .Lenable_paging:
  251. /*
  252. * Enable paging
  253. */
  254. movl $pa(initial_page_table), %eax
  255. movl %eax,%cr3 /* set the page table pointer.. */
  256. movl $CR0_STATE,%eax
  257. movl %eax,%cr0 /* ..and set paging (PG) bit */
  258. ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
  259. 1:
  260. /* Shift the stack pointer to a virtual address */
  261. addl $__PAGE_OFFSET, %esp
  262. /*
  263. * start system 32-bit setup. We need to re-do some of the things done
  264. * in 16-bit mode for the "real" operations.
  265. */
  266. movl setup_once_ref,%eax
  267. andl %eax,%eax
  268. jz 1f # Did we do this already?
  269. call *%eax
  270. 1:
  271. /*
  272. * Check if it is 486
  273. */
  274. movb $4,X86 # at least 486
  275. cmpl $-1,X86_CPUID
  276. je .Lis486
  277. /* get vendor info */
  278. xorl %eax,%eax # call CPUID with 0 -> return vendor ID
  279. cpuid
  280. movl %eax,X86_CPUID # save CPUID level
  281. movl %ebx,X86_VENDOR_ID # lo 4 chars
  282. movl %edx,X86_VENDOR_ID+4 # next 4 chars
  283. movl %ecx,X86_VENDOR_ID+8 # last 4 chars
  284. orl %eax,%eax # do we have processor info as well?
  285. je .Lis486
  286. movl $1,%eax # Use the CPUID instruction to get CPU type
  287. cpuid
  288. movb %al,%cl # save reg for future use
  289. andb $0x0f,%ah # mask processor family
  290. movb %ah,X86
  291. andb $0xf0,%al # mask model
  292. shrb $4,%al
  293. movb %al,X86_MODEL
  294. andb $0x0f,%cl # mask mask revision
  295. movb %cl,X86_MASK
  296. movl %edx,X86_CAPABILITY
  297. .Lis486:
  298. movl $0x50022,%ecx # set AM, WP, NE and MP
  299. movl %cr0,%eax
  300. andl $0x80000011,%eax # Save PG,PE,ET
  301. orl %ecx,%eax
  302. movl %eax,%cr0
  303. lgdt early_gdt_descr
  304. lidt idt_descr
  305. ljmp $(__KERNEL_CS),$1f
  306. 1: movl $(__KERNEL_DS),%eax # reload all the segment registers
  307. movl %eax,%ss # after changing gdt.
  308. movl $(__USER_DS),%eax # DS/ES contains default USER segment
  309. movl %eax,%ds
  310. movl %eax,%es
  311. movl $(__KERNEL_PERCPU), %eax
  312. movl %eax,%fs # set this cpu's percpu
  313. movl $(__KERNEL_STACK_CANARY),%eax
  314. movl %eax,%gs
  315. xorl %eax,%eax # Clear LDT
  316. lldt %ax
  317. call *(initial_code)
  318. 1: jmp 1b
  319. ENDPROC(startup_32_smp)
  320. #include "verify_cpu.S"
  321. /*
  322. * setup_once
  323. *
  324. * The setup work we only want to run on the BSP.
  325. *
  326. * Warning: %esi is live across this function.
  327. */
  328. __INIT
  329. setup_once:
  330. /*
  331. * Set up a idt with 256 interrupt gates that push zero if there
  332. * is no error code and then jump to early_idt_handler_common.
  333. * It doesn't actually load the idt - that needs to be done on
  334. * each CPU. Interrupts are enabled elsewhere, when we can be
  335. * relatively sure everything is ok.
  336. */
  337. movl $idt_table,%edi
  338. movl $early_idt_handler_array,%eax
  339. movl $NUM_EXCEPTION_VECTORS,%ecx
  340. 1:
  341. movl %eax,(%edi)
  342. movl %eax,4(%edi)
  343. /* interrupt gate, dpl=0, present */
  344. movl $(0x8E000000 + __KERNEL_CS),2(%edi)
  345. addl $EARLY_IDT_HANDLER_SIZE,%eax
  346. addl $8,%edi
  347. loop 1b
  348. movl $256 - NUM_EXCEPTION_VECTORS,%ecx
  349. movl $ignore_int,%edx
  350. movl $(__KERNEL_CS << 16),%eax
  351. movw %dx,%ax /* selector = 0x0010 = cs */
  352. movw $0x8E00,%dx /* interrupt gate - dpl=0, present */
  353. 2:
  354. movl %eax,(%edi)
  355. movl %edx,4(%edi)
  356. addl $8,%edi
  357. loop 2b
  358. #ifdef CONFIG_CC_STACKPROTECTOR
  359. /*
  360. * Configure the stack canary. The linker can't handle this by
  361. * relocation. Manually set base address in stack canary
  362. * segment descriptor.
  363. */
  364. movl $gdt_page,%eax
  365. movl $stack_canary,%ecx
  366. movw %cx, 8 * GDT_ENTRY_STACK_CANARY + 2(%eax)
  367. shrl $16, %ecx
  368. movb %cl, 8 * GDT_ENTRY_STACK_CANARY + 4(%eax)
  369. movb %ch, 8 * GDT_ENTRY_STACK_CANARY + 7(%eax)
  370. #endif
  371. andl $0,setup_once_ref /* Once is enough, thanks */
  372. ret
  373. ENTRY(early_idt_handler_array)
  374. # 36(%esp) %eflags
  375. # 32(%esp) %cs
  376. # 28(%esp) %eip
  377. # 24(%rsp) error code
  378. i = 0
  379. .rept NUM_EXCEPTION_VECTORS
  380. .ifeq (EXCEPTION_ERRCODE_MASK >> i) & 1
  381. pushl $0 # Dummy error code, to make stack frame uniform
  382. .endif
  383. pushl $i # 20(%esp) Vector number
  384. jmp early_idt_handler_common
  385. i = i + 1
  386. .fill early_idt_handler_array + i*EARLY_IDT_HANDLER_SIZE - ., 1, 0xcc
  387. .endr
  388. ENDPROC(early_idt_handler_array)
  389. early_idt_handler_common:
  390. /*
  391. * The stack is the hardware frame, an error code or zero, and the
  392. * vector number.
  393. */
  394. cld
  395. incl %ss:early_recursion_flag
  396. /* The vector number is in pt_regs->gs */
  397. cld
  398. pushl %fs /* pt_regs->fs */
  399. movw $0, 2(%esp) /* clear high bits (some CPUs leave garbage) */
  400. pushl %es /* pt_regs->es */
  401. movw $0, 2(%esp) /* clear high bits (some CPUs leave garbage) */
  402. pushl %ds /* pt_regs->ds */
  403. movw $0, 2(%esp) /* clear high bits (some CPUs leave garbage) */
  404. pushl %eax /* pt_regs->ax */
  405. pushl %ebp /* pt_regs->bp */
  406. pushl %edi /* pt_regs->di */
  407. pushl %esi /* pt_regs->si */
  408. pushl %edx /* pt_regs->dx */
  409. pushl %ecx /* pt_regs->cx */
  410. pushl %ebx /* pt_regs->bx */
  411. /* Fix up DS and ES */
  412. movl $(__KERNEL_DS), %ecx
  413. movl %ecx, %ds
  414. movl %ecx, %es
  415. /* Load the vector number into EDX */
  416. movl PT_GS(%esp), %edx
  417. /* Load GS into pt_regs->gs and clear high bits */
  418. movw %gs, PT_GS(%esp)
  419. movw $0, PT_GS+2(%esp)
  420. movl %esp, %eax /* args are pt_regs (EAX), trapnr (EDX) */
  421. call early_fixup_exception
  422. popl %ebx /* pt_regs->bx */
  423. popl %ecx /* pt_regs->cx */
  424. popl %edx /* pt_regs->dx */
  425. popl %esi /* pt_regs->si */
  426. popl %edi /* pt_regs->di */
  427. popl %ebp /* pt_regs->bp */
  428. popl %eax /* pt_regs->ax */
  429. popl %ds /* pt_regs->ds */
  430. popl %es /* pt_regs->es */
  431. popl %fs /* pt_regs->fs */
  432. popl %gs /* pt_regs->gs */
  433. decl %ss:early_recursion_flag
  434. addl $4, %esp /* pop pt_regs->orig_ax */
  435. iret
  436. ENDPROC(early_idt_handler_common)
  437. /* This is the default interrupt "handler" :-) */
  438. ALIGN
  439. ignore_int:
  440. cld
  441. #ifdef CONFIG_PRINTK
  442. pushl %eax
  443. pushl %ecx
  444. pushl %edx
  445. pushl %es
  446. pushl %ds
  447. movl $(__KERNEL_DS),%eax
  448. movl %eax,%ds
  449. movl %eax,%es
  450. cmpl $2,early_recursion_flag
  451. je hlt_loop
  452. incl early_recursion_flag
  453. pushl 16(%esp)
  454. pushl 24(%esp)
  455. pushl 32(%esp)
  456. pushl 40(%esp)
  457. pushl $int_msg
  458. call printk
  459. call dump_stack
  460. addl $(5*4),%esp
  461. popl %ds
  462. popl %es
  463. popl %edx
  464. popl %ecx
  465. popl %eax
  466. #endif
  467. iret
  468. hlt_loop:
  469. hlt
  470. jmp hlt_loop
  471. ENDPROC(ignore_int)
  472. __INITDATA
  473. .align 4
  474. GLOBAL(early_recursion_flag)
  475. .long 0
  476. __REFDATA
  477. .align 4
  478. ENTRY(initial_code)
  479. .long i386_start_kernel
  480. ENTRY(setup_once_ref)
  481. .long setup_once
  482. /*
  483. * BSS section
  484. */
  485. __PAGE_ALIGNED_BSS
  486. .align PAGE_SIZE
  487. #ifdef CONFIG_X86_PAE
  488. .globl initial_pg_pmd
  489. initial_pg_pmd:
  490. .fill 1024*KPMDS,4,0
  491. #else
  492. .globl initial_page_table
  493. initial_page_table:
  494. .fill 1024,4,0
  495. #endif
  496. initial_pg_fixmap:
  497. .fill 1024,4,0
  498. .globl empty_zero_page
  499. empty_zero_page:
  500. .fill 4096,1,0
  501. .globl swapper_pg_dir
  502. swapper_pg_dir:
  503. .fill 1024,4,0
  504. EXPORT_SYMBOL(empty_zero_page)
  505. /*
  506. * This starts the data section.
  507. */
  508. #ifdef CONFIG_X86_PAE
  509. __PAGE_ALIGNED_DATA
  510. /* Page-aligned for the benefit of paravirt? */
  511. .align PAGE_SIZE
  512. ENTRY(initial_page_table)
  513. .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0 /* low identity map */
  514. # if KPMDS == 3
  515. .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0
  516. .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x1000),0
  517. .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x2000),0
  518. # elif KPMDS == 2
  519. .long 0,0
  520. .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0
  521. .long pa(initial_pg_pmd+PGD_IDENT_ATTR+0x1000),0
  522. # elif KPMDS == 1
  523. .long 0,0
  524. .long 0,0
  525. .long pa(initial_pg_pmd+PGD_IDENT_ATTR),0
  526. # else
  527. # error "Kernel PMDs should be 1, 2 or 3"
  528. # endif
  529. .align PAGE_SIZE /* needs to be page-sized too */
  530. #endif
  531. .data
  532. .balign 4
  533. ENTRY(initial_stack)
  534. /*
  535. * The SIZEOF_PTREGS gap is a convention which helps the in-kernel
  536. * unwinder reliably detect the end of the stack.
  537. */
  538. .long init_thread_union + THREAD_SIZE - SIZEOF_PTREGS - \
  539. TOP_OF_KERNEL_STACK_PADDING;
  540. __INITRODATA
  541. int_msg:
  542. .asciz "Unknown interrupt or fault at: %p %p %p\n"
  543. #include "../../x86/xen/xen-head.S"
  544. /*
  545. * The IDT and GDT 'descriptors' are a strange 48-bit object
  546. * only used by the lidt and lgdt instructions. They are not
  547. * like usual segment descriptors - they consist of a 16-bit
  548. * segment size, and 32-bit linear address value:
  549. */
  550. .data
  551. .globl boot_gdt_descr
  552. .globl idt_descr
  553. ALIGN
  554. # early boot GDT descriptor (must use 1:1 address mapping)
  555. .word 0 # 32 bit align gdt_desc.address
  556. boot_gdt_descr:
  557. .word __BOOT_DS+7
  558. .long boot_gdt - __PAGE_OFFSET
  559. .word 0 # 32-bit align idt_desc.address
  560. idt_descr:
  561. .word IDT_ENTRIES*8-1 # idt contains 256 entries
  562. .long idt_table
  563. # boot GDT descriptor (later on used by CPU#0):
  564. .word 0 # 32 bit align gdt_desc.address
  565. ENTRY(early_gdt_descr)
  566. .word GDT_ENTRIES*8-1
  567. .long gdt_page /* Overwritten for secondary CPUs */
  568. /*
  569. * The boot_gdt must mirror the equivalent in setup.S and is
  570. * used only for booting.
  571. */
  572. .align L1_CACHE_BYTES
  573. ENTRY(boot_gdt)
  574. .fill GDT_ENTRY_BOOT_CS,8,0
  575. .quad 0x00cf9a000000ffff /* kernel 4GB code at 0x00000000 */
  576. .quad 0x00cf92000000ffff /* kernel 4GB data at 0x00000000 */