Path: blob/master/arch/um/sys-i386/asm/processor.h
17477 views
/*1* Copyright (C) 2002 Jeff Dike ([email protected])2* Licensed under the GPL3*/45#ifndef __UM_PROCESSOR_I386_H6#define __UM_PROCESSOR_I386_H78#include "linux/string.h"9#include <sysdep/host_ldt.h>10#include "asm/segment.h"1112extern int host_has_cmov;1314/* include faultinfo structure */15#include "sysdep/faultinfo.h"1617struct uml_tls_struct {18struct user_desc tls;19unsigned flushed:1;20unsigned present:1;21};2223struct arch_thread {24struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES];25unsigned long debugregs[8];26int debugregs_seq;27struct faultinfo faultinfo;28};2930#define INIT_ARCH_THREAD { \31.tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \32{ .present = 0, .flushed = 0 } }, \33.debugregs = { [ 0 ... 7 ] = 0 }, \34.debugregs_seq = 0, \35.faultinfo = { 0, 0, 0 } \36}3738static inline void arch_flush_thread(struct arch_thread *thread)39{40/* Clear any TLS still hanging */41memset(&thread->tls_array, 0, sizeof(thread->tls_array));42}4344static inline void arch_copy_thread(struct arch_thread *from,45struct arch_thread *to)46{47memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));48}4950#include <asm/user.h>5152/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */53static inline void rep_nop(void)54{55__asm__ __volatile__("rep;nop": : :"memory");56}5758#define cpu_relax() rep_nop()5960/*61* Default implementation of macro that returns current62* instruction pointer ("program counter"). Stolen63* from asm-i386/processor.h64*/65#define current_text_addr() \66({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })6768#define ARCH_IS_STACKGROW(address) \69(address + 32 >= UPT_SP(¤t->thread.regs.regs))7071#define KSTK_EIP(tsk) KSTK_REG(tsk, EIP)72#define KSTK_ESP(tsk) KSTK_REG(tsk, UESP)73#define KSTK_EBP(tsk) KSTK_REG(tsk, EBP)7475#include "asm/processor-generic.h"7677#endif787980