18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __UM_PROCESSOR_H 38c2ecf20Sopenharmony_ci#define __UM_PROCESSOR_H 48c2ecf20Sopenharmony_ci#include <linux/time-internal.h> 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci/* include faultinfo structure */ 78c2ecf20Sopenharmony_ci#include <sysdep/faultinfo.h> 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#ifdef CONFIG_X86_32 108c2ecf20Sopenharmony_ci# include "processor_32.h" 118c2ecf20Sopenharmony_ci#else 128c2ecf20Sopenharmony_ci# include "processor_64.h" 138c2ecf20Sopenharmony_ci#endif 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#define KSTK_EIP(tsk) KSTK_REG(tsk, HOST_IP) 168c2ecf20Sopenharmony_ci#define KSTK_ESP(tsk) KSTK_REG(tsk, HOST_SP) 178c2ecf20Sopenharmony_ci#define KSTK_EBP(tsk) KSTK_REG(tsk, HOST_BP) 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#define ARCH_IS_STACKGROW(address) \ 208c2ecf20Sopenharmony_ci (address + 65536 + 32 * sizeof(unsigned long) >= UPT_SP(¤t->thread.regs.regs)) 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#include <asm/user.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ 258c2ecf20Sopenharmony_cistatic __always_inline void rep_nop(void) 268c2ecf20Sopenharmony_ci{ 278c2ecf20Sopenharmony_ci __asm__ __volatile__("rep;nop": : :"memory"); 288c2ecf20Sopenharmony_ci} 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_cistatic __always_inline void cpu_relax(void) 318c2ecf20Sopenharmony_ci{ 328c2ecf20Sopenharmony_ci if (time_travel_mode == TT_MODE_INFCPU || 338c2ecf20Sopenharmony_ci time_travel_mode == TT_MODE_EXTERNAL) 348c2ecf20Sopenharmony_ci time_travel_ndelay(1); 358c2ecf20Sopenharmony_ci else 368c2ecf20Sopenharmony_ci rep_nop(); 378c2ecf20Sopenharmony_ci} 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define task_pt_regs(t) (&(t)->thread.regs) 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#include <asm/processor-generic.h> 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#endif 44