]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - sim/arm/gdbhost.c
sim: make nrun the default run program
[thirdparty/binutils-gdb.git] / sim / arm / gdbhost.c
CommitLineData
c906108c
SS
1/* gdbhost.c -- ARMulator RDP to gdb comms code: ARM6 Instruction Emulator.
2 Copyright (C) 1994 Advanced RISC Machines Ltd.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
3fd725ef 6 the Free Software Foundation; either version 3 of the License, or
c906108c
SS
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
51b318de 15 along with this program; if not, see <http://www.gnu.org/licenses/>. */
c906108c
SS
16
17/***********************************************************/
18/* Functions that communicate info back to the debugger... */
19/***********************************************************/
20
21#include <stdio.h>
22#include <stdarg.h>
23#include "armdefs.h"
24#include "communicate.h"
25#include "dbg_rdi.h"
26#include "armos.h"
27
28#define OS_SendNothing 0x0
29#define OS_SendChar 0x1
30#define OS_SendWord 0x2
31#define OS_SendString 0x3
32
33/* Defined in kid.c */
dfcd3bfb 34extern int wait_for_osreply (ARMword * reply);
c906108c
SS
35
36/* A pipe for handling SWI return values that goes straight from the */
37/* parent to the ARMulator host interface, bypassing the childs RDP */
38/* to RDI interpreter */
39int DebuggerARMul[2];
40
41/* The pipes between the two processes */
42int mumkid[2];
43int kidmum[2];
44
dfcd3bfb
JM
45void
46myprint (void *arg, const char *format, va_list ap)
c906108c
SS
47{
48#ifdef DEBUG
49 fprintf (stderr, "Host: myprint\n");
50#endif
51 vfprintf (stderr, format, ap);
52}
53
54
55/* Waits for a keypress on the debuggers' keyboard */
dfcd3bfb
JM
56void
57mypause (void *arg)
c906108c
SS
58{
59#ifdef DEBUG
60 fprintf (stderr, "Host: mypause\n");
61#endif
dfcd3bfb 62} /* I do love exciting functions */
c906108c 63
dfcd3bfb
JM
64void
65mywritec (void *arg, int c)
c906108c
SS
66{
67#ifdef DEBUG
dfcd3bfb 68 fprintf (stderr, "Mywrite : %c\n", c);
c906108c 69#endif
dfcd3bfb
JM
70 MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */
71 MYwrite_word (kidmum[1], SWI_WriteC); /* Print... */
72 MYwrite_char (kidmum[1], OS_SendChar); /* ...a single character */
73 MYwrite_char (kidmum[1], (unsigned char) c);
74
75 wait_for_osreply ((ARMword *) 0);
c906108c
SS
76}
77
dfcd3bfb
JM
78int
79myreadc (void *arg)
c906108c
SS
80{
81 char c;
82 ARMword x;
dfcd3bfb 83
c906108c 84#ifdef DEBUG
dfcd3bfb 85 fprintf (stderr, "Host: myreadc\n");
c906108c 86#endif
dfcd3bfb
JM
87 MYwrite_char (kidmum[1], RDP_OSOp); /* OS Operation Request Message */
88 MYwrite_word (kidmum[1], SWI_ReadC); /* Read... */
89 MYwrite_char (kidmum[1], OS_SendNothing);
90
91 c = wait_for_osreply (&x);
c906108c
SS
92 return (x);
93}
94
95
dfcd3bfb
JM
96int
97mywrite (void *arg, char const *buffer, int len)
c906108c
SS
98{
99#ifdef DEBUG
dfcd3bfb 100 fprintf (stderr, "Host: mywrite\n");
c906108c
SS
101#endif
102 return 0;
103}
104
dfcd3bfb
JM
105char *
106mygets (void *arg, char *buffer, int len)
c906108c
SS
107{
108#ifdef DEBUG
dfcd3bfb 109 fprintf (stderr, "Host: mygets\n");
c906108c
SS
110#endif
111 return buffer;
112}