* gdb.c++/psmang.exp: Doc fix.
[deliverable/binutils-gdb.git] / gdb / i386ly-tdep.c
CommitLineData
c906108c 1/* Target-dependent code for Intel 386 running LynxOS.
82b47e62 2 Copyright 1993, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
c906108c 3
c5aa993b 4 This file is part of GDB.
c906108c 5
c5aa993b
JM
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.
c906108c 10
c5aa993b
JM
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.
c906108c 15
c5aa993b
JM
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. */
c906108c
SS
20
21#include "defs.h"
c906108c 22#include "gdbcore.h"
82b47e62 23#include "inferior.h"
4e052eda 24#include "regcache.h"
82b47e62
MK
25#include "target.h"
26
27#include "i386-tdep.h"
c906108c 28
82b47e62
MK
29/* Return the PC of the caller from the call frame. Assumes the subr
30 prologue has already been executed, and the frame pointer setup.
31 If this is the outermost frame, we check to see if we are in a
32 system call by examining the previous instruction. If so, then the
33 return PC is actually at SP+4 because system calls use a different
34 calling sequence. */
c906108c 35
82b47e62 36static CORE_ADDR
fba45db2 37i386lynx_saved_pc_after_call (struct frame_info *frame)
c906108c
SS
38{
39 char opcode[7];
c5aa993b 40 static const unsigned char call_inst[] =
82b47e62 41 { 0x9a, 0, 0, 0, 0, 8, 0 }; /* lcall 0x8,0x0 */
c906108c 42
82b47e62 43 read_memory_nobpt (frame->pc - 7, opcode, 7);
c906108c 44 if (memcmp (opcode, call_inst, 7) == 0)
82b47e62
MK
45 return read_memory_unsigned_integer (read_register (SP_REGNUM) + 4, 4);
46
47 return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
48}
49\f
50
51/* LynxOS. */
52static void
53i386lynx_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
54{
55 set_gdbarch_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call);
56}
57\f
58
59static enum gdb_osabi
60i386lynx_coff_osabi_sniffer (bfd *abfd)
61{
62 if (strcmp (bfd_get_target (abfd), "coff-i386-lynx") == 0)
63 return GDB_OSABI_LYNXOS;
64
65 return GDB_OSABI_UNKNOWN;
66}
67
68\f
69/* Provide a prototype to silence -Wmissing-prototypes. */
70void _initialize_i386lynx_tdep (void);
71
72void
05816f70 73_initialize_i386lynx_tdep (void)
82b47e62
MK
74{
75 gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
76 i386lynx_coff_osabi_sniffer);
c906108c 77
05816f70 78 gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LYNXOS,
82b47e62 79 i386lynx_init_abi);
c906108c 80}
This page took 0.2289 seconds and 4 git commands to generate.