head32.S 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /* arch/x86/init/head32.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. .code32
  19. .globl _start
  20. _start:
  21. /* we are now in the protected-mode, just
  22. * do some initializes, and call main */
  23. lgdt gdt_descr
  24. movl $0xc0000000, %eax
  25. leal 1f, %ecx
  26. orl %ecx, %eax
  27. pushl %eax
  28. movl $0xc0000000, %eax
  29. leal init, %ecx
  30. orl %ecx, %eax
  31. pushl %eax
  32. retl
  33. 1: hlt
  34. jmp 1b
  35. .globl __stack_chk_fail, __stack_chk_fail_local
  36. __stack_chk_fail_local:
  37. __stack_chk_fail:
  38. hlt
  39. jmp __stack_chk_fail
  40. .data
  41. .align 16
  42. .globl gdt
  43. gdt: .long 0x00000000, 0x00000000
  44. .long 0x0000ffff, 0x00cf9a00
  45. .long 0x0000ffff, 0x00cf9200
  46. .globl gdt_descr
  47. gdt_descr:
  48. .word . - gdt
  49. .long gdt