~ubuntu-branches/ubuntu/utopic/xen/utopic

« back to all changes in this revision

Viewing changes to tools/debugger/gdbsx/xg/xg_public.h

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2010-05-06 15:47:38 UTC
  • mto: (1.3.1) (15.1.1 sid) (4.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20100506154738-agoz0rlafrh1fnq7
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2009, Mukesh Rathor, Oracle Corp.  All rights reserved.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU General Public
 
6
 * License v2 as published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public
 
14
 * License along with this program; if not, write to the
 
15
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
16
 * Boston, MA 021110-1307, USA.
 
17
 */
 
18
 
 
19
#define XGERR(...)   \
 
20
           do {(xgprt(__FUNCTION__,__VA_ARGS__));} while (0)
 
21
#define XGTRC(...)   \
 
22
           do {(xgtrc_on) ? (xgtrc(__FUNCTION__,__VA_ARGS__)):0;} while (0)
 
23
#define XGTRC1(...)  \
 
24
           do {(xgtrc_on==2) ? (xgtrc(__FUNCTION__,__VA_ARGS__)):0;} while (0)
 
25
 
 
26
#if defined(__x86_64__)
 
27
    #define  XGFM64  "%lx"
 
28
    #define  XGF64   "%016lx"
 
29
#else
 
30
    #define  XGFM64  "%llx"
 
31
    #define  XGF64   "%016llx"
 
32
#endif
 
33
 
 
34
 
 
35
typedef enum {
 
36
    XG_GPRS=1,          /* general purpose user regs */
 
37
    XG_FPRS=2,          /* floating point user regs */
 
38
} regstype_t;
 
39
 
 
40
 
 
41
typedef uint32_t vcpuid_t;
 
42
 
 
43
extern int xgtrc_on;
 
44
 
 
45
/* what gdb wants to receive during register read, or sends during write.
 
46
 * this from : regformats/reg-i386-linux.dat in gdbserver */
 
47
struct xg_gdb_regs32 {
 
48
    uint32_t  eax;
 
49
    uint32_t  ecx;
 
50
    uint32_t  edx;
 
51
    uint32_t  ebx;
 
52
    uint32_t  esp;
 
53
    uint32_t  ebp;
 
54
    uint32_t  esi;
 
55
    uint32_t  edi;
 
56
    uint32_t  eip;
 
57
    uint32_t  eflags;
 
58
    uint32_t  cs;
 
59
    uint32_t  ss;
 
60
    uint32_t  ds;
 
61
    uint32_t  es;
 
62
    uint32_t  fs;
 
63
    uint32_t  gs;
 
64
};  
 
65
 
 
66
/* this from: regformats/reg-x86-64.dat in gdbserver */
 
67
struct xg_gdb_regs64 {
 
68
    uint64_t  rax;
 
69
    uint64_t  rbx;
 
70
    uint64_t  rcx;
 
71
    uint64_t  rdx;
 
72
    uint64_t  rsi;
 
73
    uint64_t  rdi;
 
74
    uint64_t  rbp;
 
75
    uint64_t  rsp;
 
76
    uint64_t  r8;
 
77
    uint64_t  r9;
 
78
    uint64_t  r10;
 
79
    uint64_t  r11;
 
80
    uint64_t  r12;
 
81
    uint64_t  r13;
 
82
    uint64_t  r14;
 
83
    uint64_t  r15;
 
84
    uint64_t  rip;
 
85
    uint64_t  rflags;
 
86
    uint64_t  cs;
 
87
    uint64_t  ss;
 
88
    uint64_t  ds;
 
89
    uint64_t  es;
 
90
    uint64_t  fs;
 
91
    uint64_t  gs;
 
92
};
 
93
 
 
94
union xg_gdb_regs {
 
95
    struct xg_gdb_regs32 gregs_32;
 
96
    struct xg_gdb_regs64 gregs_64;
 
97
};
 
98
 
 
99
 
 
100
int xg_init(void);
 
101
int xg_attach(int, int);
 
102
void xg_detach_deinit(void);
 
103
int xg_step(vcpuid_t, int);
 
104
vcpuid_t xg_resume_n_wait(int);
 
105
int xg_regs_read(regstype_t, vcpuid_t, union xg_gdb_regs *, int);
 
106
int xg_regs_write(regstype_t, vcpuid_t, union xg_gdb_regs *, int);
 
107
int xg_read_mem(uint64_t, char *, int, uint64_t);
 
108
int xg_write_mem(uint64_t, char *, int, uint64_t);
 
109
void xgprt(const char *fn, const char *fmt, ...);
 
110
void xgtrc(const char *fn, const char *fmt, ...);