direct-io.hg

view xen/arch/x86/gdbstub.c @ 14363:40a6e2280d7b

xen/x86: Tweak #PF handler. Simplify gdbstub copy to/from guest.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Tue Mar 13 14:04:31 2007 +0000 (2007-03-13)
parents d8415ebc8c87
children
line source
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>
24 u16
25 gdb_arch_signal_num(struct cpu_user_regs *regs, unsigned long cookie)
26 {
27 /* XXX */
28 return 1;
29 }
31 void
32 gdb_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 }
59 void
60 gdb_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 }
67 void
68 gdb_arch_read_reg(unsigned long regnum, struct cpu_user_regs *regs,
69 struct gdb_context *ctx)
70 {
71 gdb_send_reply("", ctx);
72 }
74 /* Like copy_from_user, but safe to call with interrupts disabled.
75 Trust me, and don't look behind the curtain. */
76 unsigned int
77 gdb_arch_copy_from_user(void *dest, const void *src, unsigned len)
78 {
79 return copy_from_user(dest, src, len);
80 }
82 unsigned int
83 gdb_arch_copy_to_user(void *dest, const void *src, unsigned len)
84 {
85 return copy_to_user(dest, src, len);
86 }
88 void
89 gdb_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 }
99 void
100 gdb_arch_print_state(struct cpu_user_regs *regs)
101 {
102 /* XXX */
103 }
105 void
106 gdb_arch_enter(struct cpu_user_regs *regs)
107 {
108 /* nothing */
109 }
111 void
112 gdb_arch_exit(struct cpu_user_regs *regs)
113 {
114 /* nothing */
115 }
117 /*
118 * Local variables:
119 * mode: C
120 * c-set-style: "BSD"
121 * c-basic-offset: 4
122 * tab-width: 4
123 * End:
124 */