OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [i386ly-tdep.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
/* Target-dependent code for Intel 386 running LynxOS.
2
   Copyright 1993, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
3
 
4
   This file is part of GDB.
5
 
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.
10
 
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.
15
 
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.  */
20
 
21
#include "defs.h"
22
#include "gdbcore.h"
23
#include "inferior.h"
24
#include "regcache.h"
25
#include "target.h"
26
 
27
#include "i386-tdep.h"
28
 
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.  */
35
 
36
static CORE_ADDR
37
i386lynx_saved_pc_after_call (struct frame_info *frame)
38
{
39
  char opcode[7];
40
  static const unsigned char call_inst[] =
41
  { 0x9a, 0, 0, 0, 0, 8, 0 };        /* lcall 0x8,0x0 */
42
 
43
  read_memory_nobpt (frame->pc - 7, opcode, 7);
44
  if (memcmp (opcode, call_inst, 7) == 0)
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
 
50
 
51
/* LynxOS.  */
52
static void
53
i386lynx_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
 
58
 
59
static enum gdb_osabi
60
i386lynx_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
 
69
/* Provide a prototype to silence -Wmissing-prototypes.  */
70
void _initialize_i386lynx_tdep (void);
71
 
72
void
73
_initialize_i386bsd_tdep (void)
74
{
75
  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
76
                                  i386lynx_coff_osabi_sniffer);
77
 
78
  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_LYNXOS,
79
                          i386lynx_init_abi);
80
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.