processor.h 915 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * (C) Copyright 2002
  3. * Daniel Engström, Omicron Ceti AB, daniel@omicron.se
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __ASM_PROCESSOR_H_
  8. #define __ASM_PROCESSOR_H_ 1
  9. #define X86_GDT_ENTRY_SIZE 8
  10. #define X86_GDT_ENTRY_NULL 0
  11. #define X86_GDT_ENTRY_UNUSED 1
  12. #define X86_GDT_ENTRY_32BIT_CS 2
  13. #define X86_GDT_ENTRY_32BIT_DS 3
  14. #define X86_GDT_ENTRY_32BIT_FS 4
  15. #define X86_GDT_ENTRY_16BIT_CS 5
  16. #define X86_GDT_ENTRY_16BIT_DS 6
  17. #define X86_GDT_ENTRY_16BIT_FLAT_CS 7
  18. #define X86_GDT_ENTRY_16BIT_FLAT_DS 8
  19. #define X86_GDT_NUM_ENTRIES 9
  20. #define X86_GDT_SIZE (X86_GDT_NUM_ENTRIES * X86_GDT_ENTRY_SIZE)
  21. #ifndef __ASSEMBLY__
  22. #define PORT_RESET 0xcf9
  23. static inline __attribute__((always_inline)) void cpu_hlt(void)
  24. {
  25. asm("hlt");
  26. }
  27. static inline ulong cpu_get_sp(void)
  28. {
  29. ulong result;
  30. asm volatile(
  31. "mov %%esp, %%eax"
  32. : "=a" (result));
  33. return result;
  34. }
  35. #endif /* __ASSEMBLY__ */
  36. #endif