Make the process objects use the Params structs in their constructors, and use a...
[gem5.git] / src / arch / sparc / process.hh
1 /*
2 * Copyright (c) 2003-2004 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Gabe Black
29 * Ali Saidi
30 */
31
32 #ifndef __SPARC_PROCESS_HH__
33 #define __SPARC_PROCESS_HH__
34
35 #include <string>
36 #include <vector>
37 #include "sim/process.hh"
38
39 class ObjectFile;
40 class System;
41
42 class SparcLiveProcess : public LiveProcess
43 {
44 protected:
45
46 //The locations of the fill and spill handlers
47 Addr fillStart, spillStart;
48
49 SparcLiveProcess(LiveProcessParams * params, ObjectFile *objFile);
50
51 public:
52
53 //Handles traps which request services from the operating system
54 virtual void handleTrap(int trapNum, ThreadContext *tc);
55
56 Addr readFillStart()
57 { return fillStart; }
58
59 Addr readSpillStart()
60 { return spillStart; }
61
62 virtual void flushWindows(ThreadContext *tc) = 0;
63 };
64
65 struct M5_32_auxv_t
66 {
67 int32_t a_type;
68 union {
69 int32_t a_val;
70 int32_t a_ptr;
71 int32_t a_fcn;
72 };
73
74 M5_32_auxv_t()
75 {}
76
77 M5_32_auxv_t(int32_t type, int32_t val);
78 };
79
80 class Sparc32LiveProcess : public SparcLiveProcess
81 {
82 protected:
83
84 std::vector<M5_32_auxv_t> auxv;
85
86 Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
87 SparcLiveProcess(params, objFile)
88 {
89 // Set up stack. On SPARC Linux, stack goes from the top of memory
90 // downward, less the hole for the kernel address space.
91 stack_base = (Addr)0xf0000000ULL;
92
93 // Set up region for mmaps.
94 mmap_start = mmap_end = 0x70000000;
95 }
96
97 void startup();
98
99 public:
100
101 void argsInit(int intSize, int pageSize);
102
103 void flushWindows(ThreadContext *tc);
104 };
105
106 struct M5_64_auxv_t
107 {
108 int64_t a_type;
109 union {
110 int64_t a_val;
111 int64_t a_ptr;
112 int64_t a_fcn;
113 };
114
115 M5_64_auxv_t()
116 {}
117
118 M5_64_auxv_t(int64_t type, int64_t val);
119 };
120
121 class Sparc64LiveProcess : public SparcLiveProcess
122 {
123 protected:
124
125 static const Addr StackBias = 2047;
126
127 std::vector<M5_64_auxv_t> auxv;
128
129 Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
130 SparcLiveProcess(params, objFile)
131 {
132 // Set up stack. On SPARC Linux, stack goes from the top of memory
133 // downward, less the hole for the kernel address space.
134 stack_base = (Addr)0x80000000000ULL;
135
136 // Set up region for mmaps. Tru64 seems to start just above 0 and
137 // grow up from there.
138 mmap_start = mmap_end = 0xfffff80000000000ULL;
139 }
140
141 void startup();
142
143 public:
144
145 void argsInit(int intSize, int pageSize);
146
147 void flushWindows(ThreadContext *tc);
148 };
149
150 #endif // __SPARC_PROCESS_HH__