head.S 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /* Copyright (C) 2021 Rain */
  2. /* This file is part of XNIX. */
  3. /*
  4. XNIX is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) and later version.
  8. */
  9. /*
  10. XNIX 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. /*
  16. You should have received a copy of the GNU General Public License
  17. along with XNIX. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. .text
  20. .align 8
  21. .globl _start
  22. _start:
  23. leaq message(%rip), %rsi
  24. call print
  25. die: hlt
  26. jmp die
  27. print:
  28. movq framebuffer(%rip), %rdi
  29. cld
  30. print_loop:
  31. lodsb
  32. testb %al, %al
  33. jz print_ret
  34. movb $0x07, %ah
  35. stosw
  36. jmp print_loop
  37. print_ret:
  38. /* update frame buffer */
  39. movq %rdi, framebuffer(%rip)
  40. ret
  41. .data
  42. .align 8
  43. message:
  44. .asciz "XNIX Kernel is starting..."
  45. .globl framebuffer
  46. framebuffer:
  47. .quad 0x00000000000b8000