blob: 478710384b340fe2ec28133c26dda88ca56fec11 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Al Viro27f85f12011-08-18 20:02:59 +01002#ifndef __UM_PROCESSOR_H
3#define __UM_PROCESSOR_H
Johannes Berg5bef0a12020-02-13 14:26:49 +01004#include <linux/time-internal.h>
Al Viro27f85f12011-08-18 20:02:59 +01005
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 Viroa10c95d2011-08-18 20:12:09 +010015#define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP)
Al Virocc11f9e2011-11-21 03:52:18 +000016#define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP)
Al Viroa10c95d2011-08-18 20:12:09 +010017#define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP)
18
Al Viroc7ea5912011-08-18 20:10:19 +010019#define ARCH_IS_STACKGROW(address) \
20 (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(&current->thread.regs.regs))
21
Al Viroc56334d2011-11-20 17:23:39 -050022#include <asm/user.h>
23
24/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
Johannes Berg5bef0a12020-02-13 14:26:49 +010025static __always_inline void rep_nop(void)
Al Viroc56334d2011-11-20 17:23:39 -050026{
27 __asm__ __volatile__("rep;nop": : :"memory");
28}
29
Johannes Berg5bef0a12020-02-13 14:26:49 +010030static __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 Viroc56334d2011-11-20 17:23:39 -050038
Richard Weinbergerf8d65d22015-05-12 00:17:28 +020039#define task_pt_regs(t) (&(t)->thread.regs)
40
Al Viro27f85f12011-08-18 20:02:59 +010041#include <asm/processor-generic.h>
42
43#endif