debuggers.hg

diff xen/include/asm-x86/x86_64/regs.h @ 3635:ed902e5c4b49

bitkeeper revision 1.1159.212.62 (41fff40aESe4aWS82z_rLHeonXpxuQ)

More x86/64 stuff.
Signed-off-by: keir.fraser@cl.cam.ac.uk
author kaf24@scramble.cl.cam.ac.uk
date Tue Feb 01 21:26:34 2005 +0000 (2005-02-01)
parents 61a55dee09d8
children 9a9c5a491401 e6af5d8f8b39 fd1dd0663b09
line diff
     1.1 --- a/xen/include/asm-x86/x86_64/regs.h	Tue Feb 01 09:24:57 2005 +0000
     1.2 +++ b/xen/include/asm-x86/x86_64/regs.h	Tue Feb 01 21:26:34 2005 +0000
     1.3 @@ -1,114 +1,38 @@
     1.4  #ifndef _X86_64_REGS_H
     1.5  #define _X86_64_REGS_H
     1.6  
     1.7 -#if defined(__ASSEMBLY__) || defined(__FRAME_OFFSETS) 
     1.8 -#define R15 0
     1.9 -#define R14 8
    1.10 -#define R13 16
    1.11 -#define R12 24
    1.12 -#define RBP 36
    1.13 -#define RBX 40
    1.14 -/* arguments: interrupts/hypercalls only save upto here*/
    1.15 -#define R11 48
    1.16 -#define R10 56	
    1.17 -#define R9 64
    1.18 -#define R8 72
    1.19 -#define RAX 80
    1.20 -#define RCX 88
    1.21 -#define RDX 96
    1.22 -#define RSI 104
    1.23 -#define RDI 112
    1.24 -#define ORIG_RAX 120       /* = ERROR */ 
    1.25 -/* end of arguments */ 	
    1.26 -/* cpu exception frame or undefined in case of fast hypercall. */
    1.27 -#define RIP 128
    1.28 -#define CS 136
    1.29 -#define EFLAGS 144
    1.30 -#define RSP 152
    1.31 -#define SS 160
    1.32 -#define ARGOFFSET R11
    1.33 -#endif /* __ASSEMBLY__ */
    1.34 -
    1.35 -/* top of stack page */ 
    1.36 -#define FRAME_SIZE 168
    1.37 -
    1.38 -#define PTRACE_SETOPTIONS         21
    1.39 +#include <asm/types.h>
    1.40  
    1.41 -/* options set using PTRACE_SETOPTIONS */
    1.42 -#define PTRACE_O_TRACESYSGOOD     0x00000001
    1.43 -
    1.44 -/* Dummy values for ptrace */ 
    1.45 -#define FS 1000 
    1.46 -#define GS 1008
    1.47 -
    1.48 -#ifndef __ASSEMBLY__ 
    1.49 +struct xen_regs
    1.50 +{
    1.51 +    u64 r15;
    1.52 +    u64 r14;
    1.53 +    u64 r13;
    1.54 +    u64 r12;
    1.55 +    u64 rbp;
    1.56 +    u64 rbx;
    1.57 +    u64 r11;
    1.58 +    u64 r10;	
    1.59 +    u64 r9;
    1.60 +    u64 r8;
    1.61 +    u64 rax;
    1.62 +    u64 rcx;
    1.63 +    u64 rdx;
    1.64 +    u64 rsi;
    1.65 +    u64 rdi;
    1.66 +    u32 error_code;
    1.67 +    u32 entry_vector;
    1.68 +    u64 rip;
    1.69 +    u64 cs;
    1.70 +    u64 eflags;
    1.71 +    u64 rsp;
    1.72 +    u64 ss;
    1.73 +} __attribute__ ((packed));
    1.74  
    1.75 -struct xen_regs {
    1.76 -	unsigned long r15;
    1.77 -	unsigned long r14;
    1.78 -	unsigned long r13;
    1.79 -	unsigned long r12;
    1.80 -	unsigned long rbp;
    1.81 -	unsigned long rbx;
    1.82 -/* arguments: non interrupts/hypercalls only save upto here*/
    1.83 - 	unsigned long r11;
    1.84 -	unsigned long r10;	
    1.85 -	unsigned long r9;
    1.86 -	unsigned long r8;
    1.87 -	unsigned long rax;
    1.88 -	unsigned long rcx;
    1.89 -	unsigned long rdx;
    1.90 -	unsigned long rsi;
    1.91 -	unsigned long rdi;
    1.92 -	unsigned long orig_rax;
    1.93 -/* end of arguments */ 	
    1.94 -/* cpu exception frame or undefined */
    1.95 -	unsigned long rip;
    1.96 -	unsigned long cs;
    1.97 -	unsigned long eflags; 
    1.98 -	unsigned long rsp; 
    1.99 -	unsigned long ss;
   1.100 -/* top of stack page */ 
   1.101 -};
   1.102 +#define VM86_MODE(_r) ((_r)->eflags & EF_VM)
   1.103 +#define RING_0(_r)    (((_r)->cs & 3) == 0)
   1.104 +#define RING_1(_r)    (((_r)->cs & 3) == 1)
   1.105 +#define RING_2(_r)    (((_r)->cs & 3) == 2)
   1.106 +#define RING_3(_r)    (((_r)->cs & 3) == 3)
   1.107  
   1.108  #endif
   1.109 -
   1.110 -/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
   1.111 -#define PTRACE_GETREGS            12
   1.112 -#define PTRACE_SETREGS            13
   1.113 -#define PTRACE_GETFPREGS          14
   1.114 -#define PTRACE_SETFPREGS          15
   1.115 -#define PTRACE_GETFPXREGS         18
   1.116 -#define PTRACE_SETFPXREGS         19
   1.117 -
   1.118 -#if !defined(__ASSEMBLY__) 
   1.119 -
   1.120 -#define instruction_pointer(regs) ((regs)->rip)
   1.121 -extern void show_regs(struct xen_regs *);
   1.122 -
   1.123 -enum {
   1.124 -        EF_CF   = 0x00000001,
   1.125 -        EF_PF   = 0x00000004,
   1.126 -        EF_AF   = 0x00000010,
   1.127 -        EF_ZF   = 0x00000040,
   1.128 -        EF_SF   = 0x00000080,
   1.129 -        EF_TF   = 0x00000100,
   1.130 -        EF_IE   = 0x00000200,
   1.131 -        EF_DF   = 0x00000400,
   1.132 -        EF_OF   = 0x00000800,
   1.133 -        EF_IOPL = 0x00003000,
   1.134 -        EF_IOPL_RING0 = 0x00000000,
   1.135 -        EF_IOPL_RING1 = 0x00001000,
   1.136 -        EF_IOPL_RING2 = 0x00002000,
   1.137 -        EF_NT   = 0x00004000,   /* nested task */
   1.138 -        EF_RF   = 0x00010000,   /* resume */
   1.139 -        EF_VM   = 0x00020000,   /* virtual mode */
   1.140 -        EF_AC   = 0x00040000,   /* alignment */
   1.141 -        EF_VIF  = 0x00080000,   /* virtual interrupt */
   1.142 -        EF_VIP  = 0x00100000,   /* virtual interrupt pending */
   1.143 -        EF_ID   = 0x00200000,   /* id */
   1.144 -};
   1.145 -
   1.146 -#endif
   1.147 -
   1.148 -#endif