head64.S 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /* arch/x86/init/head64.S
  2. *
  3. * This file is part of evx.
  4. *
  5. * evx 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, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * evx is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with evx. If not, see <https://www.gnu.org/licenses/>
  17. */
  18. .code64
  19. .globl _start
  20. _start:
  21. /* we are now in the long-mode, just
  22. * do some initializes, and call main */
  23. lgdt gdt_descr(%rip)
  24. movq $0xffff800000000000, %rax
  25. leaq 1f(%rip), %rcx
  26. orq %rcx, %rax
  27. pushq %rax
  28. movq $0xffff800000000000, %rax
  29. leaq init(%rip), %rcx
  30. orq %rcx, %rax
  31. pushq %rax
  32. retq
  33. 1: hlt
  34. jmp 1b
  35. .data
  36. .align 16
  37. .globl gdt
  38. gdt: .quad 0x0000000000000000
  39. .quad 0x0020980000000000
  40. .quad 0x0000920000000000
  41. .globl gdt_descr
  42. gdt_descr:
  43. .word . - gdt
  44. .quad gdt