| 1 | /* Remote target system call callback support.
|
|---|
| 2 | Copyright 1997 Free Software Foundation, Inc.
|
|---|
| 3 | Contributed by Cygnus Solutions.
|
|---|
| 4 |
|
|---|
| 5 | This file is part of GDB.
|
|---|
| 6 |
|
|---|
| 7 | This program is free software; you can redistribute it and/or modify
|
|---|
| 8 | it under the terms of the GNU General Public License as published by
|
|---|
| 9 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 10 | (at your option) any later version.
|
|---|
| 11 |
|
|---|
| 12 | This program is distributed in the hope that it will be useful,
|
|---|
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | GNU General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | You should have received a copy of the GNU General Public License
|
|---|
| 18 | along with this program; if not, write to the Free Software
|
|---|
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|---|
| 20 |
|
|---|
| 21 | /* This interface isn't intended to be specific to any particular kind
|
|---|
| 22 | of remote (hardware, simulator, whatever). As such, support for it
|
|---|
| 23 | (e.g. sim/common/callback.c) should *not* live in the simulator source
|
|---|
| 24 | tree, nor should it live in the gdb source tree. */
|
|---|
| 25 |
|
|---|
| 26 | /* There are various ways to handle system calls:
|
|---|
| 27 |
|
|---|
| 28 | 1) Have a simulator intercept the appropriate trap instruction and
|
|---|
| 29 | directly perform the system call on behalf of the target program.
|
|---|
| 30 | This is the typical way of handling system calls for embedded targets.
|
|---|
| 31 | [Handling system calls for embedded targets isn't that much of an
|
|---|
| 32 | oxymoron as running compiler testsuites make use of the capability.]
|
|---|
| 33 |
|
|---|
| 34 | This method of system call handling is done when STATE_ENVIRONMENT
|
|---|
| 35 | is ENVIRONMENT_USER.
|
|---|
| 36 |
|
|---|
| 37 | 2) Have a simulator emulate the hardware as much as possible.
|
|---|
| 38 | If the program running on the real hardware communicates with some sort
|
|---|
| 39 | of target manager, one would want to be able to run this program on the
|
|---|
| 40 | simulator as well.
|
|---|
| 41 |
|
|---|
| 42 | This method of system call handling is done when STATE_ENVIRONMENT
|
|---|
| 43 | is ENVIRONMENT_OPERATING.
|
|---|
| 44 | */
|
|---|
| 45 |
|
|---|
| 46 | #ifndef CALLBACK_H
|
|---|
| 47 | #define CALLBACK_H
|
|---|
| 48 |
|
|---|
| 49 | /* ??? The reason why we check for va_start here should be documented. */
|
|---|
| 50 |
|
|---|
| 51 | #ifndef va_start
|
|---|
| 52 | #include <ansidecl.h>
|
|---|
| 53 | #ifdef ANSI_PROTOTYPES
|
|---|
| 54 | #include <stdarg.h>
|
|---|
| 55 | #else
|
|---|
| 56 | #include <varargs.h>
|
|---|
| 57 | #endif
|
|---|
| 58 | #endif
|
|---|
| 59 | |
|---|
| 60 |
|
|---|
| 61 | /* Mapping of host/target values. */
|
|---|
| 62 | /* ??? For debugging purposes, one might want to add a string of the
|
|---|
| 63 | name of the symbol. */
|
|---|
| 64 |
|
|---|
| 65 | typedef struct {
|
|---|
| 66 | int host_val;
|
|---|
| 67 | int target_val;
|
|---|
|
|---|