process.cc (2680:246e7104f744) process.cc (2686:f0d591379ac3)
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;

--- 13 unchanged lines hidden (view full) ---

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
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;

--- 13 unchanged lines hidden (view full) ---

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 * Korey Sewell
30 */
31
32#include "arch/mips/isa_traits.hh"
33#include "arch/mips/process.hh"
34#include "arch/mips/linux/process.hh"
35#include "base/loader/object_file.hh"
36#include "base/misc.hh"
37#include "cpu/thread_context.hh"

--- 13 unchanged lines hidden (view full) ---

51
52 ObjectFile *objFile = createObjectFile(executable);
53 if (objFile == NULL) {
54 fatal("Can't load object file %s", executable);
55 }
56
57
58 if (objFile->getArch() != ObjectFile::Mips)
31 */
32
33#include "arch/mips/isa_traits.hh"
34#include "arch/mips/process.hh"
35#include "arch/mips/linux/process.hh"
36#include "base/loader/object_file.hh"
37#include "base/misc.hh"
38#include "cpu/thread_context.hh"

--- 13 unchanged lines hidden (view full) ---

52
53 ObjectFile *objFile = createObjectFile(executable);
54 if (objFile == NULL) {
55 fatal("Can't load object file %s", executable);
56 }
57
58
59 if (objFile->getArch() != ObjectFile::Mips)
59 fatal("Object file does not match architecture.");
60 fatal("Object file does not match MIPS architecture.");
61
60 switch (objFile->getOpSys()) {
61 case ObjectFile::Linux:
62 process = new MipsLinuxProcess(nm, objFile, system,
63 stdin_fd, stdout_fd, stderr_fd,
64 argv, envp);
65 break;
66
67 default:

--- 6 unchanged lines hidden (view full) ---

74}
75
76MipsLiveProcess::MipsLiveProcess(const std::string &nm, ObjectFile *objFile,
77 System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
78 std::vector<std::string> &argv, std::vector<std::string> &envp)
79 : LiveProcess(nm, objFile, _system, stdin_fd, stdout_fd, stderr_fd,
80 argv, envp)
81{
62 switch (objFile->getOpSys()) {
63 case ObjectFile::Linux:
64 process = new MipsLinuxProcess(nm, objFile, system,
65 stdin_fd, stdout_fd, stderr_fd,
66 argv, envp);
67 break;
68
69 default:

--- 6 unchanged lines hidden (view full) ---

76}
77
78MipsLiveProcess::MipsLiveProcess(const std::string &nm, ObjectFile *objFile,
79 System *_system, int stdin_fd, int stdout_fd, int stderr_fd,
80 std::vector<std::string> &argv, std::vector<std::string> &envp)
81 : LiveProcess(nm, objFile, _system, stdin_fd, stdout_fd, stderr_fd,
82 argv, envp)
83{
84 // Set up stack. On MIPS, stack starts at the top of kuseg
85 // user address space. MIPS stack grows down from here
86 stack_base = 0x7FFFFFFF;
82
87
83 // XXX all the below need to be updated for SPARC - Ali
88 // Set pointer for next thread stack. Reserve 8M for main stack.
89 next_thread_stack_base = stack_base - (8 * 1024 * 1024);
90
91 // Set up break point (Top of Heap)
84 brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
85 brk_point = roundUp(brk_point, VMPageSize);
86
92 brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
93 brk_point = roundUp(brk_point, VMPageSize);
94
87 // Set up stack. On Alpha, stack goes below text section. This
88 // code should get moved to some architecture-specific spot.
89 stack_base = objFile->textBase() - (409600+4096);
90
91 // Set up region for mmaps. Tru64 seems to start just above 0 and
92 // grow up from there.
95 // Set up region for mmaps. For now, start at bottom of kuseg space.
93 mmap_start = mmap_end = 0x10000;
96 mmap_start = mmap_end = 0x10000;
94
95 // Set pointer for next thread stack. Reserve 8M for main stack.
96 next_thread_stack_base = stack_base - (8 * 1024 * 1024);
97
98}
99
100void
101MipsLiveProcess::startup()
102{
103 argsInit(MachineBytes, VMPageSize);
104}
105

--- 59 unchanged lines hidden ---
97}
98
99void
100MipsLiveProcess::startup()
101{
102 argsInit(MachineBytes, VMPageSize);
103}
104

--- 59 unchanged lines hidden ---