aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc/spa-system-calls.h
blob: 1ee9c1edbef7c3017ffa87ffd53d5ec63f70abc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
 * Copyright (C) 1991 Gordon Irlam.  All rights reserved.
 */

/*
 * Declaration of system calls for sparc trace generator.
 */


#if !defined(SYSCALLS_H)
#define SYSCALLS_H 1

/*
 * Imported declarations.
 */

#include "agent_msg.h"


/*
 * Declaration of table containing system calls, and their parameter profile.
 */

/*
 * Words, such as the parameters and results of system calls, are capable of
 * being displayed in a number of different formats.
 *
 * fmt_none - indicates the absense of further arguments, functions that don't
 *            return a value, etc.
 *
 * The function format_value(..) can be used to display a word in one of the
 * following formats.
 *
 * fmt_dec - a signed decimal number : 0, 21, -1
 * fmt_hex - a unsigned hex number : 0x0, 0x15, 0xffffffff
 * fmt_ptr - a pointer : NULL, 0x00000015, 0xffffffff
 * fmt_fd - a file descriptor : fd0, fd15, fd-1
 * fmt_signal - the name of a signal : 0, SIGTTIN, -1
 * fmt_error - the name of an error : 0, EISDIR, -1
 * fmt_open_flags - the flags to open : O_RDONLY, O_WRONLY|0x14, 0xffffffff
 * fmt_unknown - representation unknown : .., .., ..
 * fmt_string - if the null termintated string at word is printable displays
 *              the string within quotes, otherwise displays like fmt_ptr
 * fmt_post_string - displays like fmt_ptr, value of word is also saved,
 *                   following the system call a printable string exists at
 *                   address word the address and the string will be displayed
 * fmt_data - only permitted in argument lists, next argument must be
 *            format_data_size, if printable data exists at word having length
 *            specified by the next argument it is printed, otherwise displays
 *            like fmt_ptr
 * fmt_data_size - displays like FMT_SIZE
 * fmt_post_data - displays like fmt_ptr, value of word is also saved,
 *                 following call if a printable length delimited string exists
 *                 it will be displayed
 * fmt_post_data_size - displays like FMT_SIZE, value is saved for use as
 *                      length for fmt_post_data display format
 * fmt_string_array - word is the address of a null terminted array of strings
 *                    to be printed if possible
 *
 * Unlike the string formats which typically represent filenames it is not so
 * important that length delimited data be fully displayed.  When printable,
 * it will be truncate much more harshly than the string formats.
 *
 * Only one item can be pending for display at the end of a system call.
 *
 * At a later date this program may be extended to display length delimited
 * data as a hex dump if it is not printable.
 *
 * The following macros are employed to make it easy to alter how a whole
 * class of values is displayed by changing their definition.
 *
 *     FMT_STATUS - function calls that return 0 on success and -1 on error
 *     FMT_FLAGS - bit field objects
 *     FMT_SIZE - length of an object in bytes
 */
typedef enum fmt_type {fmt_none = 0, fmt_dec, fmt_hex, fmt_ptr, fmt_fd,
    fmt_signal, fmt_error, fmt_open_flags, fmt_unknown, fmt_string,
    fmt_post_string, fmt_data, fmt_post_data, fmt_data_size,
    fmt_post_data_size, fmt_string_array} fmt_type;

#define FMT_STATUS fmt_none
#define FMT_FLAGS  fmt_hex
#define FMT_SIZE   fmt_dec

typedef struct _spa_call_desc {
    char *name;
    fmt_type arg[NO_PARAMS];
    fmt_type result;
} spa_call_desc;

extern spa_call_desc spa_system_calls[];

extern int no_system_calls;

extern spa_call_desc spa_system_call_open_simple;

#define SPA_DATA_SIZE_LIMIT    20
#define SPA_STRING_SIZE_LIMIT 201
#define SPA_ARRAY_SIZE_LIMIT   21


/*
 * Declaration of table containing signal names.
 */

extern char *spa_signal_names[];

extern int spa_no_signal_names;


/*
 * Declaration of table containing error messages.
 */

char *spa_error_names[];

extern int spa_no_error_names;

#endif