Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 10 | /* include faultinfo structure */ |
| 11 | #include "sysdep/faultinfo.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | |
| 13 | struct arch_thread { |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 14 | unsigned long debugregs[8]; |
| 15 | int debugregs_seq; |
Jeff Dike | f355559 | 2007-02-10 01:44:29 -0800 | [diff] [blame] | 16 | unsigned long fs; |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 17 | struct faultinfo faultinfo; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | }; |
| 19 | |
| 20 | /* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */ |
Jeff Dike | b21d4b0 | 2007-10-16 01:27:10 -0700 | [diff] [blame] | 21 | static inline void rep_nop(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | { |
| 23 | __asm__ __volatile__("rep;nop": : :"memory"); |
| 24 | } |
| 25 | |
| 26 | #define cpu_relax() rep_nop() |
| 27 | |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 28 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ |
Jeff Dike | 5aaf5f7 | 2008-02-08 04:22:10 -0800 | [diff] [blame^] | 29 | .debugregs_seq = 0, \ |
Jeff Dike | f355559 | 2007-02-10 01:44:29 -0800 | [diff] [blame] | 30 | .fs = 0, \ |
| 31 | .faultinfo = { 0, 0, 0 } } |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 32 | |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 33 | static inline void arch_flush_thread(struct arch_thread *thread) |
| 34 | { |
| 35 | } |
| 36 | |
| 37 | static inline void arch_copy_thread(struct arch_thread *from, |
| 38 | struct arch_thread *to) |
| 39 | { |
Jeff Dike | 5aaf5f7 | 2008-02-08 04:22:10 -0800 | [diff] [blame^] | 40 | to->fs = from->fs; |
Paolo 'Blaisorblade' Giarrusso | aa6758d | 2006-03-31 02:30:22 -0800 | [diff] [blame] | 41 | } |
| 42 | |
Bodo Stroesser | c578455 | 2005-05-05 16:15:31 -0700 | [diff] [blame] | 43 | #include "asm/arch/user.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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(¤t->thread.regs.regs)) |
| 50 | |
Allan Graves | fad1c45 | 2005-10-04 14:53:52 -0400 | [diff] [blame] | 51 | #define KSTK_EIP(tsk) KSTK_REG(tsk, RIP) |
| 52 | #define KSTK_ESP(tsk) KSTK_REG(tsk, RSP) |
| 53 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | #include "asm/processor-generic.h" |
| 55 | |
| 56 | #endif |