processor.h 997 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __UM_PROCESSOR_H
  3. #define __UM_PROCESSOR_H
  4. #include <linux/time-internal.h>
  5. /* include faultinfo structure */
  6. #include <sysdep/faultinfo.h>
  7. #ifdef CONFIG_X86_32
  8. # include "processor_32.h"
  9. #else
  10. # include "processor_64.h"
  11. #endif
  12. #define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP)
  13. #define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP)
  14. #define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP)
  15. #define ARCH_IS_STACKGROW(address) \
  16. (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
  17. #include <asm/user.h>
  18. /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
  19. static __always_inline void rep_nop(void)
  20. {
  21. __asm__ __volatile__("rep;nop": : :"memory");
  22. }
  23. static __always_inline void cpu_relax(void)
  24. {
  25. if (time_travel_mode == TT_MODE_INFCPU ||
  26. time_travel_mode == TT_MODE_EXTERNAL)
  27. time_travel_ndelay(1);
  28. else
  29. rep_nop();
  30. }
  31. #define task_pt_regs(t) (&(t)->thread.regs)
  32. #include <asm/processor-generic.h>
  33. #endif