1###############################################################################
2#
3# MN10300 Low-level gdbstub routines
4#
5# Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
6# Written by David Howells (dhowells@redhat.com)
7#
8# This program is free software; you can redistribute it and/or
9# modify it under the terms of the GNU General Public Licence
10# as published by the Free Software Foundation; either version
11# 2 of the Licence, or (at your option) any later version.
12#
13###############################################################################
14#include <linux/sys.h>
15#include <linux/linkage.h>
16#include <asm/smp.h>
17#include <asm/cache.h>
18#include <asm/cpu-regs.h>
19#include <asm/exceptions.h>
20#include <asm/frame.inc>
21#include <asm/serial-regs.h>
22
23	.text
24
25###############################################################################
26#
27# GDB stub read memory with guard
28# - D0 holds the memory address to read
29# - D1 holds the address to store the byte into
30#
31###############################################################################
32	.globl gdbstub_read_byte_guard
33	.globl gdbstub_read_byte_cont
34ENTRY(gdbstub_read_byte)
35	mov	d0,a0
36	mov	d1,a1
37	clr	d0
38gdbstub_read_byte_guard:
39	movbu	(a0),d1
40gdbstub_read_byte_cont:
41	movbu	d1,(a1)
42	ret	[],0
43
44	.globl gdbstub_read_word_guard
45	.globl gdbstub_read_word_cont
46ENTRY(gdbstub_read_word)
47	mov	d0,a0
48	mov	d1,a1
49	clr	d0
50gdbstub_read_word_guard:
51	movhu	(a0),d1
52gdbstub_read_word_cont:
53	movhu	d1,(a1)
54	ret	[],0
55
56	.globl gdbstub_read_dword_guard
57	.globl gdbstub_read_dword_cont
58ENTRY(gdbstub_read_dword)
59	mov	d0,a0
60	mov	d1,a1
61	clr	d0
62gdbstub_read_dword_guard:
63	mov	(a0),d1
64gdbstub_read_dword_cont:
65	mov	d1,(a1)
66	ret	[],0
67
68###############################################################################
69#
70# GDB stub write memory with guard
71# - D0 holds the byte to store
72# - D1 holds the memory address to write
73#
74###############################################################################
75	.globl gdbstub_write_byte_guard
76	.globl gdbstub_write_byte_cont
77ENTRY(gdbstub_write_byte)
78	mov	d0,a0
79	mov	d1,a1
80	clr	d0
81gdbstub_write_byte_guard:
82	movbu	a0,(a1)
83gdbstub_write_byte_cont:
84	ret	[],0
85
86	.globl gdbstub_write_word_guard
87	.globl gdbstub_write_word_cont
88ENTRY(gdbstub_write_word)
89	mov	d0,a0
90	mov	d1,a1
91	clr	d0
92gdbstub_write_word_guard:
93	movhu	a0,(a1)
94gdbstub_write_word_cont:
95	ret	[],0
96
97	.globl gdbstub_write_dword_guard
98	.globl gdbstub_write_dword_cont
99ENTRY(gdbstub_write_dword)
100	mov	d0,a0
101	mov	d1,a1
102	clr	d0
103gdbstub_write_dword_guard:
104	mov	a0,(a1)
105gdbstub_write_dword_cont:
106	ret	[],0
107
108###############################################################################
109#
110# GDB stub BUG() trap
111#
112###############################################################################
113ENTRY(__gdbstub_bug_trap)
114	.byte	0xF7,0xF7	# don't use 0xFF as the JTAG unit preempts that
115	ret	[],0
116