1 /* Target-dependent code for Intel 386 running LynxOS.
2 Copyright 1993, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
28 #include "i386-tdep.h"
30 /* Return the PC of the caller from the call frame. Assumes the subr
31 prologue has already been executed, and the frame pointer setup.
32 If this is the outermost frame, we check to see if we are in a
33 system call by examining the previous instruction. If so, then the
34 return PC is actually at SP+4 because system calls use a different
38 i386lynx_saved_pc_after_call (struct frame_info *frame)
41 static const unsigned char call_inst[] =
42 { 0x9a, 0, 0, 0, 0, 8, 0 }; /* lcall 0x8,0x0 */
44 deprecated_read_memory_nobpt (frame->pc - 7, opcode, 7);
45 if (memcmp (opcode, call_inst, 7) == 0)
46 return read_memory_unsigned_integer (read_register (SP_REGNUM) + 4, 4);
48 return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
54 i386lynx_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
56 set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call);
61 i386lynx_coff_osabi_sniffer (bfd *abfd)
63 if (strcmp (bfd_get_target (abfd), "coff-i386-lynx") == 0)
64 return GDB_OSABI_LYNXOS;
66 return GDB_OSABI_UNKNOWN;
70 /* Provide a prototype to silence -Wmissing-prototypes. */
71 void _initialize_i386lynx_tdep (void);
74 _initialize_i386lynx_tdep (void)
76 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
77 i386lynx_coff_osabi_sniffer);
79 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LYNXOS,