process.hh (7532:3f6413fc37a2) process.hh (7741:340b6f01d69b)
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/byteswap.hh"
38#include "sim/process.hh"
39
40class ObjectFile;
41class System;
42
43class SparcLiveProcess : public LiveProcess
44{
45 protected:
46
47 const Addr StackBias;
48
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/byteswap.hh"
38#include "sim/process.hh"
39
40class ObjectFile;
41class System;
42
43class SparcLiveProcess : public LiveProcess
44{
45 protected:
46
47 const Addr StackBias;
48
49 //The locations of the fill and spill handlers
49 // The locations of the fill and spill handlers
50 Addr fillStart, spillStart;
51
52 SparcLiveProcess(LiveProcessParams * params,
53 ObjectFile *objFile, Addr _StackBias);
54
55 void initState();
56
57 template<class IntType>
58 void argsInit(int pageSize);
59
60 public:
61
50 Addr fillStart, spillStart;
51
52 SparcLiveProcess(LiveProcessParams * params,
53 ObjectFile *objFile, Addr _StackBias);
54
55 void initState();
56
57 template<class IntType>
58 void argsInit(int pageSize);
59
60 public:
61
62 //Handles traps which request services from the operating system
62 // Handles traps which request services from the operating system
63 virtual void handleTrap(int trapNum, ThreadContext *tc);
64
63 virtual void handleTrap(int trapNum, ThreadContext *tc);
64
65 Addr readFillStart()
66 { return fillStart; }
65 Addr readFillStart() { return fillStart; }
66 Addr readSpillStart() { return spillStart; }
67
67
68 Addr readSpillStart()
69 { return spillStart; }
70
71 virtual void flushWindows(ThreadContext *tc) = 0;
72 void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
73};
74
75class Sparc32LiveProcess : public SparcLiveProcess
76{
77 protected:
78
79 Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
80 SparcLiveProcess(params, objFile, 0)
81 {
82 // Set up stack. On SPARC Linux, stack goes from the top of memory
83 // downward, less the hole for the kernel address space.
84 stack_base = (Addr)0xf0000000ULL;
85
86 // Set up region for mmaps.
87 mmap_start = mmap_end = 0x70000000;
88 }
89
90 void initState();
91
92 public:
93
94 void argsInit(int intSize, int pageSize);
95
96 void flushWindows(ThreadContext *tc);
97
98 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
99 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
100};
101
102class Sparc64LiveProcess : public SparcLiveProcess
103{
104 protected:
105
106 Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
107 SparcLiveProcess(params, objFile, 2047)
108 {
109 // Set up stack. On SPARC Linux, stack goes from the top of memory
110 // downward, less the hole for the kernel address space.
111 stack_base = (Addr)0x80000000000ULL;
112
113 // Set up region for mmaps. Tru64 seems to start just above 0 and
114 // grow up from there.
115 mmap_start = mmap_end = 0xfffff80000000000ULL;
116 }
117
118 void initState();
119
120 public:
121
122 void argsInit(int intSize, int pageSize);
123
124 void flushWindows(ThreadContext *tc);
125
126 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
127 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
128};
129
130#endif // __SPARC_PROCESS_HH__
68 virtual void flushWindows(ThreadContext *tc) = 0;
69 void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
70};
71
72class Sparc32LiveProcess : public SparcLiveProcess
73{
74 protected:
75
76 Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
77 SparcLiveProcess(params, objFile, 0)
78 {
79 // Set up stack. On SPARC Linux, stack goes from the top of memory
80 // downward, less the hole for the kernel address space.
81 stack_base = (Addr)0xf0000000ULL;
82
83 // Set up region for mmaps.
84 mmap_start = mmap_end = 0x70000000;
85 }
86
87 void initState();
88
89 public:
90
91 void argsInit(int intSize, int pageSize);
92
93 void flushWindows(ThreadContext *tc);
94
95 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
96 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
97};
98
99class Sparc64LiveProcess : public SparcLiveProcess
100{
101 protected:
102
103 Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
104 SparcLiveProcess(params, objFile, 2047)
105 {
106 // Set up stack. On SPARC Linux, stack goes from the top of memory
107 // downward, less the hole for the kernel address space.
108 stack_base = (Addr)0x80000000000ULL;
109
110 // Set up region for mmaps. Tru64 seems to start just above 0 and
111 // grow up from there.
112 mmap_start = mmap_end = 0xfffff80000000000ULL;
113 }
114
115 void initState();
116
117 public:
118
119 void argsInit(int intSize, int pageSize);
120
121 void flushWindows(ThreadContext *tc);
122
123 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
124 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
125};
126
127#endif // __SPARC_PROCESS_HH__