-/* Macro defintions for i386.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+/* Macro definitions for i386, Unix System V.
+ Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+
+#if !defined (TM_I386V_H)
+#define TM_I386V_H 1
/*
* Changes for 80386 by Pace Willisson (pace@prep.ai.mit.edu)
#define COFF_NO_LONG_FILE_NAMES
/* turn this on when rest of gdb is ready */
-/* #define IEEE_FLOAT */
+#define IEEE_FLOAT
/* Define this if the C compiler puts an underscore at the front
of external names before giving them to the linker. */
/* #define NAMES_HAVE_UNDERSCORE */
-/* Specify debugger information format. */
-
-/* #define READ_DBX_FORMAT */
-#define COFF_FORMAT
-
/* number of traps that happen between exec'ing the shell
* to run an inferior, and when we finally get to
* the inferior code. This is 2 on most implementations.
*/
+#ifndef START_INFERIOR_TRAPS_EXPECTED
#define START_INFERIOR_TRAPS_EXPECTED 4
+#endif
/* Offset from address of function to start of its code.
Zero on most machines. */
#define SKIP_PROLOGUE(frompc) {(frompc) = i386_skip_prologue((frompc));}
+extern int
+i386_skip_prologue PARAMS ((int));
+
/* Immediately after a function call, return the saved pc.
Can't always go through the frames for this because on some machines
the new frame is not set up until the new function executes
#define SAVED_PC_AFTER_CALL(frame) \
(read_memory_integer (read_register (SP_REGNUM), 4))
-/* This is only supposed to work in execcore.c, where x == 0 and
- this is called before any other fields are filled in. */
-#define N_SET_MAGIC(aouthdr, x) \
- bzero ((char *) &aouthdr, sizeof aouthdr)
-
/* Address of end of stack space. */
#define STACK_END_ADDR 0x80000000
This is often the number of bytes in BREAKPOINT
but not always. */
+#ifndef DECR_PC_AFTER_BREAK
#define DECR_PC_AFTER_BREAK 1
+#endif
/* Nonzero if instruction at PC is a return instruction. */
do this unless we *know* we aren't cross-debugging. FIXME.
*/
#define FLOAT_INFO { i386_float_info (); }
-#endif 0
+#endif /*0*/
/* Say how long (ordinary) registers are. */
#define PC_REGNUM 8
#define PS_REGNUM 9
-#define REGISTER_U_ADDR(addr, blockend, regno) \
- (addr) = i386_register_u_addr ((blockend),(regno));
-
/* Total amount of space needed to store our copies of the machine's
register state, the array `registers'. */
#define REGISTER_BYTES (NUM_REGS * 4)
/* Convert data from raw format for register REGNUM
to virtual format for register REGNUM. */
-#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
+ {memcpy ((TO), (FROM), 4);}
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
-#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) {bcopy ((FROM), (TO), 4);}
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
+ {memcpy ((TO), (FROM), 4);}
/* Return the GDB type object for the "standard" data type
of data in register N. */
-
-#define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
+/* Perhaps si and di should go here, but potentially they could be
+ used for things other than address. */
+#define REGISTER_VIRTUAL_TYPE(N) \
+ ((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \
+ lookup_pointer_type (builtin_type_void) : builtin_type_int)
/* Store the address of the place in which to copy the structure the
subroutine will return. This is called from call_function. */
#define STORE_STRUCT_RETURN(ADDR, SP) \
{ (SP) -= sizeof (ADDR); \
- write_memory ((SP), &(ADDR), sizeof (ADDR)); }
+ write_memory ((SP), (char *) &(ADDR), sizeof (ADDR)); }
/* Extract from an array REGBUF containing the (raw) register state
a function return value of type TYPE, and copy that, in virtual format,
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
+ memcpy ((VALBUF), (REGBUF), TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
(its caller). */
/* FRAME_CHAIN takes a frame's nominal address
- and produces the frame's chain-pointer.
-
- FRAME_CHAIN_COMBINE takes the chain pointer and the frame's nominal address
- and produces the nominal address of the caller frame.
-
- However, if FRAME_CHAIN_VALID returns zero,
- it means the given frame is the outermost one and has no caller.
- In that case, FRAME_CHAIN_COMBINE is not used. */
+ and produces the frame's chain-pointer. */
#define FRAME_CHAIN(thisframe) \
- (outside_startup_file ((thisframe)->pc) ? \
+ (!inside_entry_file ((thisframe)->pc) ? \
read_memory_integer ((thisframe)->frame, 4) :\
0)
-#define FRAME_CHAIN_VALID(chain, thisframe) \
- (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
-
-#define FRAME_CHAIN_COMBINE(chain, thisframe) (chain)
-
/* Define other aspects of the stack frame. */
/* A macro that tells us whether the function invocation represented
#define FRAME_NUM_ARGS(numargs, fi) (numargs) = i386_frame_num_args(fi)
+#ifdef __STDC__ /* Forward decl's for prototypes */
+struct frame_info;
+struct frame_saved_regs;
+#endif
+
+extern int
+i386_frame_num_args PARAMS ((struct frame_info *));
+
/* Return number of bytes at start of arglist that are not really args. */
#define FRAME_ARGS_SKIP 8
#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
{ i386_frame_find_saved_regs ((frame_info), &(frame_saved_regs)); }
+extern void
+i386_frame_find_saved_regs PARAMS ((struct frame_info *,
+ struct frame_saved_regs *));
+
\f
/* Things needed for making the inferior call functions. */
#define PUSH_DUMMY_FRAME { i386_push_dummy_frame (); }
+extern void
+i386_push_dummy_frame PARAMS ((void));
+
/* Discard from the stack the innermost frame, restoring all registers. */
#define POP_FRAME { i386_pop_frame (); }
+extern void
+i386_pop_frame PARAMS ((void));
+
/* this is
* call 11223344 (32 bit relative)
* int3
from = loc + 5; \
to = (int)(fun); \
delta = to - from; \
- *(int *)((char *)(dummyname) + 1) = delta; \
+ *((char *)(dummyname) + 1) = (delta & 0xff); \
+ *((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \
+ *((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \
+ *((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \
}
+
+extern void
+print_387_control_word PARAMS ((unsigned int));
+
+extern void
+print_387_status_word PARAMS ((unsigned int));
+
+/* Offset from SP to first arg on stack at first instruction of a function */
+
+#define SP_ARG0 (1 * 4)
+
+#endif /* !defined (TM_I386V_H) */