blob: e50933175e9105206e207afcdc61ec46d0d49463 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
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 Stroesserc5784552005-05-05 16:15:31 -070010/* include faultinfo structure */
11#include "sysdep/faultinfo.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070012
13struct arch_thread {
Bodo Stroesserc5784552005-05-05 16:15:31 -070014 unsigned long debugregs[8];
15 int debugregs_seq;
Jeff Dikef3555592007-02-10 01:44:29 -080016 unsigned long fs;
Bodo Stroesserc5784552005-05-05 16:15:31 -070017 struct faultinfo faultinfo;
Linus Torvalds1da177e2005-04-16 15:20:36 -070018};
19
20/* REP NOP (PAUSE) is a good thing to insert into busy-wait loops. */
Jeff Dikeb21d4b02007-10-16 01:27:10 -070021static inline void rep_nop(void)
Linus Torvalds1da177e2005-04-16 15:20:36 -070022{
23 __asm__ __volatile__("rep;nop": : :"memory");
24}
25
26#define cpu_relax() rep_nop()
27
Bodo Stroesserc5784552005-05-05 16:15:31 -070028#define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \
Jeff Dike5aaf5f72008-02-08 04:22:10 -080029 .debugregs_seq = 0, \
Jeff Dikef3555592007-02-10 01:44:29 -080030 .fs = 0, \
31 .faultinfo = { 0, 0, 0 } }
Bodo Stroesserc5784552005-05-05 16:15:31 -070032
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080033static inline void arch_flush_thread(struct arch_thread *thread)
34{
35}
36
37static inline void arch_copy_thread(struct arch_thread *from,
38 struct arch_thread *to)
39{
Jeff Dike5aaf5f72008-02-08 04:22:10 -080040 to->fs = from->fs;
Paolo 'Blaisorblade' Giarrussoaa6758d2006-03-31 02:30:22 -080041}
42
Bodo Stroesserc5784552005-05-05 16:15:31 -070043#include "asm/arch/user.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070044
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
Allan Gravesfad1c452005-10-04 14:53:52 -040051#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP)
52#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP)
53
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#include "asm/processor-generic.h"
55
56#endif