process.hh (11877:5ea85692a53e) process.hh (11886:43b882cada33)
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
38#include "mem/page_table.hh"
39#include "sim/byteswap.hh"
40#include "sim/process.hh"
41
42class ObjectFile;
43
44class SparcProcess : public Process
45{
46 protected:
47
48 const Addr StackBias;
49
50 // The locations of the fill and spill handlers
51 Addr fillStart, spillStart;
52
53 SparcProcess(ProcessParams * params, ObjectFile *objFile,
54 Addr _StackBias);
55
56 void initState();
57
58 template<class IntType>
59 void argsInit(int pageSize);
60
61 public:
62
63 // Handles traps which request services from the operating system
64 virtual void handleTrap(int trapNum, ThreadContext *tc, Fault *fault);
65
66 Addr readFillStart() { return fillStart; }
67 Addr readSpillStart() { return spillStart; }
68
69 virtual void flushWindows(ThreadContext *tc) = 0;
70 void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
71};
72
73class Sparc32Process : public SparcProcess
74{
75 protected:
76
77 Sparc32Process(ProcessParams * params, ObjectFile *objFile)
78 : SparcProcess(params, objFile, 0)
79 {
80 // Set up stack. On SPARC Linux, stack goes from the top of memory
81 // downward, less the hole for the kernel address space.
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
38#include "mem/page_table.hh"
39#include "sim/byteswap.hh"
40#include "sim/process.hh"
41
42class ObjectFile;
43
44class SparcProcess : public Process
45{
46 protected:
47
48 const Addr StackBias;
49
50 // The locations of the fill and spill handlers
51 Addr fillStart, spillStart;
52
53 SparcProcess(ProcessParams * params, ObjectFile *objFile,
54 Addr _StackBias);
55
56 void initState();
57
58 template<class IntType>
59 void argsInit(int pageSize);
60
61 public:
62
63 // Handles traps which request services from the operating system
64 virtual void handleTrap(int trapNum, ThreadContext *tc, Fault *fault);
65
66 Addr readFillStart() { return fillStart; }
67 Addr readSpillStart() { return spillStart; }
68
69 virtual void flushWindows(ThreadContext *tc) = 0;
70 void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
71};
72
73class Sparc32Process : public SparcProcess
74{
75 protected:
76
77 Sparc32Process(ProcessParams * params, ObjectFile *objFile)
78 : SparcProcess(params, objFile, 0)
79 {
80 // Set up stack. On SPARC Linux, stack goes from the top of memory
81 // downward, less the hole for the kernel address space.
82 stack_base = (Addr)0xf0000000ULL;
82 memState->stackBase = (Addr)0xf0000000ULL;
83
84 // Set up region for mmaps.
83
84 // Set up region for mmaps.
85 mmap_end = 0x70000000;
85 memState->mmapEnd = 0x70000000;
86 }
87
88 void initState();
89
90 public:
91
92 void argsInit(int intSize, int pageSize);
93
94 void flushWindows(ThreadContext *tc);
95
96 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
97 /// Explicitly import the otherwise hidden getSyscallArg
98 using Process::getSyscallArg;
99
100 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
101};
102
103class Sparc64Process : public SparcProcess
104{
105 protected:
106
107 Sparc64Process(ProcessParams * params, ObjectFile *objFile)
108 : SparcProcess(params, objFile, 2047)
109 {
110 // Set up stack. On SPARC Linux, stack goes from the top of memory
111 // downward, less the hole for the kernel address space.
86 }
87
88 void initState();
89
90 public:
91
92 void argsInit(int intSize, int pageSize);
93
94 void flushWindows(ThreadContext *tc);
95
96 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
97 /// Explicitly import the otherwise hidden getSyscallArg
98 using Process::getSyscallArg;
99
100 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
101};
102
103class Sparc64Process : public SparcProcess
104{
105 protected:
106
107 Sparc64Process(ProcessParams * params, ObjectFile *objFile)
108 : SparcProcess(params, objFile, 2047)
109 {
110 // Set up stack. On SPARC Linux, stack goes from the top of memory
111 // downward, less the hole for the kernel address space.
112 stack_base = (Addr)0x80000000000ULL;
112 memState->stackBase = (Addr)0x80000000000ULL;
113
114 // Set up region for mmaps.
113
114 // Set up region for mmaps.
115 mmap_end = 0xfffff80000000000ULL;
115 memState->mmapEnd = 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 /// Explicitly import the otherwise hidden getSyscallArg
128 using Process::getSyscallArg;
129
130 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
131};
132
133/* No architectural page table defined for this ISA */
134typedef NoArchPageTable ArchPageTable;
135
136#endif // __SPARC_PROCESS_HH__
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 /// Explicitly import the otherwise hidden getSyscallArg
128 using Process::getSyscallArg;
129
130 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
131};
132
133/* No architectural page table defined for this ISA */
134typedef NoArchPageTable ArchPageTable;
135
136#endif // __SPARC_PROCESS_HH__