xref: /linux/arch/x86/um/asm/processor.h (revision ead5d1f4d877e92c051e1a1ade623d0d30e71619)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
25c48b108SAl Viro #ifndef __UM_PROCESSOR_H
35c48b108SAl Viro #define __UM_PROCESSOR_H
4*5bef0a15SJohannes Berg #include <linux/time-internal.h>
55c48b108SAl Viro 
65c48b108SAl Viro /* include faultinfo structure */
75c48b108SAl Viro #include <sysdep/faultinfo.h>
85c48b108SAl Viro 
95c48b108SAl Viro #ifdef CONFIG_X86_32
105c48b108SAl Viro # include "processor_32.h"
115c48b108SAl Viro #else
125c48b108SAl Viro # include "processor_64.h"
135c48b108SAl Viro #endif
145c48b108SAl Viro 
15a10c95d8SAl Viro #define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP)
16cc11f9edSAl Viro #define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP)
17a10c95d8SAl Viro #define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP)
18a10c95d8SAl Viro 
19c7ea591cSAl Viro #define ARCH_IS_STACKGROW(address) \
20c7ea591cSAl Viro        (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
21c7ea591cSAl Viro 
22c56334dbSAl Viro #include <asm/user.h>
23c56334dbSAl Viro 
24c56334dbSAl Viro /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
rep_nop(void)25*5bef0a15SJohannes Berg static __always_inline void rep_nop(void)
26c56334dbSAl Viro {
27c56334dbSAl Viro 	__asm__ __volatile__("rep;nop": : :"memory");
28c56334dbSAl Viro }
29c56334dbSAl Viro 
cpu_relax(void)30*5bef0a15SJohannes Berg static __always_inline void cpu_relax(void)
31*5bef0a15SJohannes Berg {
32*5bef0a15SJohannes Berg 	if (time_travel_mode == TT_MODE_INFCPU ||
33*5bef0a15SJohannes Berg 	    time_travel_mode == TT_MODE_EXTERNAL)
34*5bef0a15SJohannes Berg 		time_travel_ndelay(1);
35*5bef0a15SJohannes Berg 	else
36*5bef0a15SJohannes Berg 		rep_nop();
37*5bef0a15SJohannes Berg }
38c56334dbSAl Viro 
39f8d65d27SRichard Weinberger #define task_pt_regs(t) (&(t)->thread.regs)
40f8d65d27SRichard Weinberger 
415c48b108SAl Viro #include <asm/processor-generic.h>
425c48b108SAl Viro 
435c48b108SAl Viro #endif
44