Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Al Viro | 27f85f1 | 2011-08-18 20:02:59 +0100 | [diff] [blame] | 2 | #ifndef __UM_PROCESSOR_H |
| 3 | #define __UM_PROCESSOR_H |
Johannes Berg | 5bef0a1 | 2020-02-13 14:26:49 +0100 | [diff] [blame] | 4 | #include <linux/time-internal.h> |
Al Viro | 27f85f1 | 2011-08-18 20:02:59 +0100 | [diff] [blame] | 5 | |
| 6 | /* include faultinfo structure */ |
| 7 | #include <sysdep/faultinfo.h> |
| 8 | |
| 9 | #ifdef CONFIG_X86_32 |
| 10 | # include "processor_32.h" |
| 11 | #else |
| 12 | # include "processor_64.h" |
| 13 | #endif |
| 14 | |
Al Viro | a10c95d | 2011-08-18 20:12:09 +0100 | [diff] [blame] | 15 | #define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP) |
Al Viro | cc11f9e | 2011-11-21 03:52:18 +0000 | [diff] [blame] | 16 | #define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP) |
Al Viro | a10c95d | 2011-08-18 20:12:09 +0100 | [diff] [blame] | 17 | #define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP) |
| 18 | |
Al Viro | c7ea591 | 2011-08-18 20:10:19 +0100 | [diff] [blame] | 19 | #define ARCH_IS_STACKGROW(address) \ |
| 20 | (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(¤t->thread.regs.regs)) |
| 21 | |
Al Viro | c56334d | 2011-11-20 17:23:39 -0500 | [diff] [blame] | 22 | #include <asm/user.h> |
| 23 | |
| 24 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ |
Johannes Berg | 5bef0a1 | 2020-02-13 14:26:49 +0100 | [diff] [blame] | 25 | static __always_inline void rep_nop(void) |
Al Viro | c56334d | 2011-11-20 17:23:39 -0500 | [diff] [blame] | 26 | { |
| 27 | __asm__ __volatile__("rep;nop": : :"memory"); |
| 28 | } |
| 29 | |
Johannes Berg | 5bef0a1 | 2020-02-13 14:26:49 +0100 | [diff] [blame] | 30 | static __always_inline void cpu_relax(void) |
| 31 | { |
| 32 | if (time_travel_mode == TT_MODE_INFCPU || |
| 33 | time_travel_mode == TT_MODE_EXTERNAL) |
| 34 | time_travel_ndelay(1); |
| 35 | else |
| 36 | rep_nop(); |
| 37 | } |
Al Viro | c56334d | 2011-11-20 17:23:39 -0500 | [diff] [blame] | 38 | |
Richard Weinberger | f8d65d2 | 2015-05-12 00:17:28 +0200 | [diff] [blame] | 39 | #define task_pt_regs(t) (&(t)->thread.regs) |
| 40 | |
Al Viro | 27f85f1 | 2011-08-18 20:02:59 +0100 | [diff] [blame] | 41 | #include <asm/processor-generic.h> |
| 42 | |
| 43 | #endif |