4 * Copyright (c) 2006 CodeSourcery Inc
6 * The authors hereby grant permission to use, copy, modify, distribute,
7 * and license this software and its documentation for any purpose, provided
8 * that existing copyright notices are retained in all copies and that this
9 * notice is included verbatim in any distributions. No written agreement,
10 * license, or royalty fee is required for any of the authorized uses.
11 * Modifications to this software may be copyrighted by their authors
12 * and need not follow the licensing terms described here, provided that
13 * the new terms are clearly indicated on the first page of each file where
18 #include <sys/types.h>
23 #define HOSTED_INIT_SIM 1
25 #define HOSTED_CLOSE 3
27 #define HOSTED_WRITE 5
28 #define HOSTED_LSEEK 6
29 #define HOSTED_RENAME 7
30 #define HOSTED_UNLINK 8
32 #define HOSTED_FSTAT 10
33 #define HOSTED_GETTIMEOFDAY 11
34 #define HOSTED_ISATTY 12
35 #define HOSTED_SYSTEM 13
37 /* This function is provided by the board's BSP, because the precise
38 mechanism of informing gdb is board specific. */
39 extern int __io_hosted (int func
, void *args
);
41 /* Protocol specific representation of datatypes, as specified in D.9.11
43 * Note that since the m68k is big-endian, we can use native
44 * representations of integer datatypes in structured datatypes. */
46 typedef uint32_t gdb_mode_t
;
47 typedef uint32_t gdb_time_t
;
50 uint32_t st_dev
; /* device */
51 uint32_t st_ino
; /* inode */
52 gdb_mode_t st_mode
; /* protection */
53 uint32_t st_nlink
; /* number of hard links */
54 uint32_t st_uid
; /* user ID of owner */
55 uint32_t st_gid
; /* group ID of owner */
56 uint32_t st_rdev
; /* device type (if inode device) */
57 uint64_t st_size
; /* total size, in bytes */
58 uint64_t st_blksize
; /* blocksize for filesystem I/O */
59 uint64_t st_blocks
; /* number of blocks allocated */
60 gdb_time_t st_atim
; /* time of last access */
61 gdb_time_t st_mtim
; /* time of last modification */
62 gdb_time_t st_ctim
; /* time of last change */
66 gdb_time_t tv_sec
; /* second */
67 uint64_t tv_usec
; /* microsecond */
71 /* Parameters are passed between the library and the debugging stub
72 * in a fixed-size buffer.
75 typedef uint32_t gdb_parambuf_t
[4];
79 #define GDB_O_RDONLY 0x0
80 #define GDB_O_WRONLY 0x1
81 #define GDB_O_RDWR 0x2
82 #define GDB_O_APPEND 0x8
83 #define GDB_O_CREAT 0x200
84 #define GDB_O_TRUNC 0x400
85 #define GDB_O_EXCL 0x800
89 #define GDB_S_IFREG 0100000
90 #define GDB_S_IFDIR 040000
91 #define GDB_S_IRUSR 0400
92 #define GDB_S_IWUSR 0200
93 #define GDB_S_IXUSR 0100
94 #define GDB_S_IRGRP 040
95 #define GDB_S_IWGRP 020
96 #define GDB_S_IXGRP 010
97 #define GDB_S_IROTH 04
98 #define GDB_S_IWOTH 02
99 #define GDB_S_IXOTH 01
107 #define GDB_EACCES 13
108 #define GDB_EFAULT 14
110 #define GDB_EEXIST 17
111 #define GDB_ENODEV 19
112 #define GDB_ENOTDIR 20
113 #define GDB_EISDIR 21
114 #define GDB_EINVAL 22
115 #define GDB_ENFILE 23
116 #define GDB_EMFILE 24
118 #define GDB_ENOSPC 28
119 #define GDB_ESPIPE 29
121 #define GDB_ENAMETOOLONG 91
122 #define GDB_EUNKNOWN 9999
126 #define GDB_SEEK_SET 0
127 #define GDB_SEEK_CUR 1
128 #define GDB_SEEK_END 2
131 /* conversion functions */
133 extern gdb_mode_t
__hosted_to_gdb_mode_t (mode_t m
);
134 extern int32_t __hosted_to_gdb_open_flags (int f
);
135 extern int32_t __hosted_to_gdb_lseek_flags (int f
);
137 extern void __hosted_from_gdb_stat (const struct gdb_stat
*gs
,
139 extern void __hosted_from_gdb_timeval (const struct gdb_timeval
*gt
,
141 extern int __hosted_from_gdb_errno (int32_t err
);