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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [gdb/] [config/] [m68k/] [tm-linux.h] - Blame information for rev 578

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
/* Definitions to target GDB to Linux on m680x0
2
   Copyright 1996, 1998, 1999, 2000 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 "regcache.h"
22
 
23
/* Number of traps that happen between exec'ing the shell to run an
24
   inferior, and when we finally get to the inferior code.  This is 2
25
   on most implementations.  */
26
 
27
#define START_INFERIOR_TRAPS_EXPECTED 2
28
 
29
/* The following definitions are appropriate when using the ELF
30
   format, where floating point values are returned in fp0, pointer
31
   values in a0 and other values in d0.  */
32
 
33
/* Extract from an array REGBUF containing the (raw) register state a
34
   function return value of type TYPE, and copy that, in virtual
35
   format, into VALBUF.  */
36
 
37
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
38
{                                                                       \
39
  if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)                                \
40
    {                                                                   \
41
       REGISTER_CONVERT_TO_VIRTUAL (FP0_REGNUM, TYPE,                   \
42
                                    ((char *) (REGBUF)                  \
43
                                     + REGISTER_BYTE (FP0_REGNUM)),     \
44
                                    VALBUF);                            \
45
    }                                                                   \
46
  else if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)                           \
47
    memcpy (VALBUF, (char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM),      \
48
            TYPE_LENGTH (TYPE));                                        \
49
  else                                                                  \
50
    memcpy (VALBUF,                                                     \
51
            ((char *) (REGBUF)                                          \
52
             + (TYPE_LENGTH (TYPE) >= 4 ? 0 : 4 - TYPE_LENGTH (TYPE))),  \
53
            TYPE_LENGTH (TYPE));                                        \
54
}
55
 
56
/* Write into appropriate registers a function return value of type
57
   TYPE, given in virtual format.  */
58
 
59
#define STORE_RETURN_VALUE(TYPE,VALBUF) \
60
{                                                                       \
61
  if (TYPE_CODE (TYPE) == TYPE_CODE_FLT)                                \
62
    {                                                                   \
63
      char raw_buffer[REGISTER_RAW_SIZE (FP0_REGNUM)];                  \
64
      REGISTER_CONVERT_TO_RAW (TYPE, FP0_REGNUM, VALBUF, raw_buffer);   \
65
      write_register_bytes (REGISTER_BYTE (FP0_REGNUM),                 \
66
                            raw_buffer, TYPE_LENGTH (TYPE));            \
67
    }                                                                   \
68
  else                                                                  \
69
    {                                                                   \
70
      if (TYPE_CODE (TYPE) == TYPE_CODE_PTR)                            \
71
        write_register_bytes (REGISTER_BYTE (A0_REGNUM), VALBUF,        \
72
                              TYPE_LENGTH (TYPE));                      \
73
      write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE));              \
74
    }                                                                   \
75
}
76
 
77
#include "tm-linux.h"
78
#include "m68k/tm-m68k.h"
79
 
80
/* Extract from an array REGBUF containing the (raw) register state
81
   the address in which a function should return its structure value,
82
   as a CORE_ADDR (or an expression that can be used as one).  */
83
 
84
#undef EXTRACT_STRUCT_VALUE_ADDRESS
85
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
86
  (*(CORE_ADDR *)((char *) (REGBUF) + REGISTER_BYTE (A0_REGNUM)))
87
 
88
/* Offsets (in target ints) into jmp_buf.  */
89
 
90
#define JB_ELEMENT_SIZE 4
91
#define JB_PC 7
92
 
93
/* Figure out where the longjmp will land.  Slurp the args out of the stack.
94
   We expect the first arg to be a pointer to the jmp_buf structure from which
95
   we extract the pc (JB_PC) that we will land at.  The pc is copied into ADDR.
96
   This routine returns true on success */
97
 
98
#define GET_LONGJMP_TARGET(ADDR) m68k_get_longjmp_target(ADDR)
99
 
100
/* Offset to saved PC in sigcontext, from <asm/sigcontext.h>.  */
101
#define SIGCONTEXT_PC_OFFSET 26
102
 
103
#undef FRAME_SAVED_PC
104
#define FRAME_SAVED_PC(FRAME) \
105
  (((FRAME)->signal_handler_caller \
106
    ? sigtramp_saved_pc (FRAME) \
107
    : read_memory_integer ((FRAME)->frame + 4, 4)))
108
 
109
extern CORE_ADDR sigtramp_saved_pc (struct frame_info *);
110
 
111
#define IN_SIGTRAMP(pc,name) in_sigtramp (pc)
112
extern int in_sigtramp (CORE_ADDR pc);

powered by: WebSVN 2.1.0

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