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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [gdb/] [i386-sol2-nat.c] - Blame information for rev 299

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

Line No. Rev Author Line
1 24 jeremybenn
/* Native-dependent code for Solaris x86.
2
 
3
   Copyright (C) 2004, 2007, 2008 Free Software Foundation, Inc.
4
 
5
   This file is part of GDB.
6
 
7
   This program is free software; you can redistribute it and/or modify
8
   it under the terms of the GNU General Public License as published by
9
   the Free Software Foundation; either version 3 of the License, or
10
   (at your option) any later version.
11
 
12
   This program is distributed in the hope that it will be useful,
13
   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
   GNU General Public License for more details.
16
 
17
   You should have received a copy of the GNU General Public License
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
 
20
#include "defs.h"
21
#include "regcache.h"
22
 
23
#include <sys/procfs.h>
24
#include "gregset.h"
25
 
26
/* This file provids the (temporary) glue between the Solaris x86
27
   target dependent code and the machine independent SVR4 /proc
28
   support.  */
29
 
30
/* Solaris 10 (Solaris 2.10, SunOS 5.10) and up support two process
31
   data models, the traditional 32-bit data model (ILP32) and the
32
   64-bit data model (LP64).  The format of /proc depends on the data
33
   model of the observer (the controlling process, GDB in our case).
34
   The Solaris header files conveniently define PR_MODEL_NATIVE to the
35
   data model of the controlling process.  If its value is
36
   PR_MODEL_LP64, we know that GDB is being compiled as a 64-bit
37
   program.
38
 
39
   Note that a 32-bit GDB won't be able to debug a 64-bit target
40
   process using /proc on Solaris.  */
41
 
42
#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
43
 
44
#include "amd64-nat.h"
45
#include "amd64-tdep.h"
46
 
47
/* Mapping between the general-purpose registers in gregset_t format
48
   and GDB's register cache layout.  */
49
 
50
/* From <sys/regset.h>.  */
51
static int amd64_sol2_gregset64_reg_offset[] = {
52
  14 * 8,                       /* %rax */
53
  11 * 8,                       /* %rbx */
54
  13 * 8,                       /* %rcx */
55
  12 * 8,                       /* %rdx */
56
  9 * 8,                        /* %rsi */
57
  8 * 8,                        /* %rdi */
58
  10 * 8,                       /* %rbp */
59
  20 * 8,                       /* %rsp */
60
  7 * 8,                        /* %r8 ... */
61
  6 * 8,
62
  5 * 8,
63
  4 * 8,
64
  3 * 8,
65
  2 * 8,
66
  1 * 8,
67
 
68
  17 * 8,                       /* %rip */
69
  16 * 8,                       /* %eflags */
70
  18 * 8,                       /* %cs */
71
  21 * 8,                       /* %ss */
72
  25 * 8,                       /* %ds */
73
  24 * 8,                       /* %es */
74
  22 * 8,                       /* %fs */
75
  23 * 8                        /* %gs */
76
};
77
 
78
/* 32-bit registers are provided by Solaris in 64-bit format, so just
79
   give a subset of the list above.  */
80
static int amd64_sol2_gregset32_reg_offset[] = {
81
  14 * 8,                       /* %eax */
82
  13 * 8,                       /* %ecx */
83
  12 * 8,                       /* %edx */
84
  11 * 8,                       /* %ebx */
85
  20 * 8,                       /* %esp */
86
  10 * 8,                       /* %ebp */
87
  9 * 8,                        /* %esi */
88
  8 * 8,                        /* %edi */
89
  17 * 8,                       /* %eip */
90
  16 * 8,                       /* %eflags */
91
  18 * 8,                       /* %cs */
92
  21 * 8,                       /* %ss */
93
  25 * 8,                       /* %ds */
94
  24 * 8,                       /* %es */
95
  22 * 8,                       /* %fs */
96
  23 * 8                        /* %gs */
97
};
98
 
99
void
100
supply_gregset (struct regcache *regcache, const prgregset_t *gregs)
101
{
102
  amd64_supply_native_gregset (regcache, gregs, -1);
103
}
104
 
105
void
106
supply_fpregset (struct regcache *regcache, const prfpregset_t *fpregs)
107
{
108
  amd64_supply_fxsave (regcache, -1, fpregs);
109
}
110
 
111
void
112
fill_gregset (const struct regcache *regcache,
113
              prgregset_t *gregs, int regnum)
114
{
115
  amd64_collect_native_gregset (regcache, gregs, regnum);
116
}
117
 
118
void
119
fill_fpregset (const struct regcache *regcache,
120
               prfpregset_t *fpregs, int regnum)
121
{
122
  amd64_collect_fxsave (regcache, regnum, fpregs);
123
}
124
 
125
#else
126
 
127
/* For 32-bit Solaris x86, we use the Unix SVR4 code in i386v4-nat.c.  */
128
 
129
#endif
130
 
131
/* Provide a prototype to silence -Wmissing-prototypes.  */
132
extern void _initialize_amd64_sol2_nat (void);
133
 
134
void
135
_initialize_amd64_sol2_nat (void)
136
{
137
#if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64)
138
  amd64_native_gregset32_reg_offset = amd64_sol2_gregset32_reg_offset;
139
  amd64_native_gregset32_num_regs =
140
    ARRAY_SIZE (amd64_sol2_gregset32_reg_offset);
141
  amd64_native_gregset64_reg_offset = amd64_sol2_gregset64_reg_offset;
142
  amd64_native_gregset64_num_regs =
143
    ARRAY_SIZE (amd64_sol2_gregset64_reg_offset);
144
#endif
145
}

powered by: WebSVN 2.1.0

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