2 * Copyright (c) 2003-2004 The Regents of The University of Michigan
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.
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.
32 #ifndef __SPARC_PROCESS_HH__
33 #define __SPARC_PROCESS_HH__
38 #include "sim/byteswap.hh"
39 #include "sim/process.hh"
44 class SparcLiveProcess : public LiveProcess
50 // The locations of the fill and spill handlers
51 Addr fillStart, spillStart;
53 SparcLiveProcess(LiveProcessParams * params,
54 ObjectFile *objFile, Addr _StackBias);
58 template<class IntType>
59 void argsInit(int pageSize);
63 // Handles traps which request services from the operating system
64 virtual void handleTrap(int trapNum, ThreadContext *tc);
66 Addr readFillStart() { return fillStart; }
67 Addr readSpillStart() { return spillStart; }
69 virtual void flushWindows(ThreadContext *tc) = 0;
70 void setSyscallReturn(ThreadContext *tc, SyscallReturn return_value);
73 class Sparc32LiveProcess : public SparcLiveProcess
77 Sparc32LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
78 SparcLiveProcess(params, objFile, 0)
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;
84 // Set up region for mmaps.
85 mmap_start = mmap_end = 0x70000000;
92 void argsInit(int intSize, int pageSize);
94 void flushWindows(ThreadContext *tc);
96 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
97 /// Explicitly import the otherwise hidden getSyscallArg
98 using LiveProcess::getSyscallArg;
100 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
103 class Sparc64LiveProcess : public SparcLiveProcess
107 Sparc64LiveProcess(LiveProcessParams * params, ObjectFile *objFile) :
108 SparcLiveProcess(params, objFile, 2047)
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;
114 // Set up region for mmaps. Tru64 seems to start just above 0 and
115 // grow up from there.
116 mmap_start = mmap_end = 0xfffff80000000000ULL;
123 void argsInit(int intSize, int pageSize);
125 void flushWindows(ThreadContext *tc);
127 SparcISA::IntReg getSyscallArg(ThreadContext *tc, int &i);
128 /// Explicitly import the otherwise hidden getSyscallArg
129 using LiveProcess::getSyscallArg;
131 void setSyscallArg(ThreadContext *tc, int i, SparcISA::IntReg val);
134 /* No architectural page table defined for this ISA */
135 typedef NoArchPageTable ArchPageTable;
137 #endif // __SPARC_PROCESS_HH__