• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2003 PathScale, Inc.
3  *
4  * Licensed under the GPL
5  */
6 
7 #ifndef __UM_PROCESSOR_X86_64_H
8 #define __UM_PROCESSOR_X86_64_H
9 
10 /* include faultinfo structure */
11 #include "sysdep/faultinfo.h"
12 
13 struct arch_thread {
14         unsigned long debugregs[8];
15         int debugregs_seq;
16         unsigned long fs;
17         struct faultinfo faultinfo;
18 };
19 
20 /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
rep_nop(void)21 static inline void rep_nop(void)
22 {
23 	__asm__ __volatile__("rep;nop": : :"memory");
24 }
25 
26 #define cpu_relax()   rep_nop()
27 
28 #define INIT_ARCH_THREAD { .debugregs  		= { [ 0 ... 7 ] = 0 }, \
29 			   .debugregs_seq	= 0, \
30 			   .fs			= 0, \
31 			   .faultinfo		= { 0, 0, 0 } }
32 
arch_flush_thread(struct arch_thread * thread)33 static inline void arch_flush_thread(struct arch_thread *thread)
34 {
35 }
36 
arch_copy_thread(struct arch_thread * from,struct arch_thread * to)37 static inline void arch_copy_thread(struct arch_thread *from,
38                                     struct arch_thread *to)
39 {
40 	to->fs = from->fs;
41 }
42 
43 #include <asm/user.h>
44 
45 #define current_text_addr() \
46 	({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; })
47 
48 #define ARCH_IS_STACKGROW(address) \
49         (address + 128 >= UPT_SP(&current->thread.regs.regs))
50 
51 #define KSTK_EIP(tsk) KSTK_REG(tsk, RIP)
52 #define KSTK_ESP(tsk) KSTK_REG(tsk, RSP)
53 
54 #include "asm/processor-generic.h"
55 
56 #endif
57