source: trunk/packages/xen-3.1/xen-3.1/xen/arch/x86/gdbstub.c @ 34

Last change on this file since 34 was 34, checked in by hartmans, 17 years ago

Add xen and xen-common

File size: 3.0 KB
Line 
1/*
2 * x86-specific gdb stub routines
3 * based on x86 cdb(xen/arch/x86/cdb.c), but Extensively modified.
4 *
5 * Copyright (C) 2006 Isaku Yamahata <yamahata at valinux co jp>
6 *                    VA Linux Systems Japan. K.K.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21 */
22#include <asm/debugger.h>
23
24u16
25gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
26{
27    /* XXX */
28    return 1;
29}
30
31void 
32gdb_arch_read_reg_array(struct cpu_user_regs *regs, struct gdb_context *ctx)
33{
34#define GDB_REG(r) gdb_write_to_packet_hex(r, sizeof(r), ctx);
35    GDB_REG(regs->eax);
36    GDB_REG(regs->ecx);
37    GDB_REG(regs->edx);
38    GDB_REG(regs->ebx);
39    GDB_REG(regs->esp);
40    GDB_REG(regs->ebp);
41    GDB_REG(regs->esi);
42    GDB_REG(regs->edi);
43    GDB_REG(regs->eip);
44    GDB_REG(regs->eflags);
45#undef GDB_REG
46#define GDB_SEG_REG(s)  gdb_write_to_packet_hex(s, sizeof(u32), ctx);
47    /* sizeof(segment) = 16bit */
48    /* but gdb requires its return value as 32bit value */
49    GDB_SEG_REG(regs->cs);
50    GDB_SEG_REG(regs->ss);
51    GDB_SEG_REG(regs->ds);
52    GDB_SEG_REG(regs->es);
53    GDB_SEG_REG(regs->fs);
54    GDB_SEG_REG(regs->gs);
55#undef GDB_SEG_REG
56    gdb_send_packet(ctx);
57}
58
59void 
60gdb_arch_write_reg_array(struct cpu_user_regs *regs, const char* buf,
61                         struct gdb_context *ctx)
62{
63    /* XXX TODO */
64    gdb_send_reply("E02", ctx);
65}
66
67void 
68gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
69                  struct gdb_context *ctx)
70{
71    gdb_send_reply("", ctx);
72}
73
74/* Like copy_from_user, but safe to call with interrupts disabled.
75   Trust me, and don't look behind the curtain. */
76unsigned int
77gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
78{
79    return copy_from_user(dest, src, len);
80}
81
82unsigned int 
83gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
84{
85    return copy_to_user(dest, src, len);
86}
87
88void 
89gdb_arch_resume(struct cpu_user_regs *regs,
90                unsigned long addr, unsigned long type,
91                struct gdb_context *ctx)
92{
93    /* XXX */
94    if (type == GDB_STEP) {
95        gdb_send_reply("S01", ctx);
96    }
97}
98
99void
100gdb_arch_print_state(struct cpu_user_regs *regs)
101{
102    /* XXX */
103}
104
105void
106gdb_arch_enter(struct cpu_user_regs *regs)
107{
108    /* nothing */
109}
110
111void
112gdb_arch_exit(struct cpu_user_regs *regs)
113{
114    /* nothing */
115}
116
117/*
118 * Local variables:
119 * mode: C
120 * c-set-style: "BSD"
121 * c-basic-offset: 4
122 * tab-width: 4
123 * End:
124 */
Note: See TracBrowser for help on using the repository browser.