Deleted Added
sdiff udiff text old ( 11854:0e94e16e26ea ) new ( 11886:43b882cada33 )
full compact
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;

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

45#include "sim/system.hh"
46
47using namespace AlphaISA;
48using namespace std;
49
50AlphaProcess::AlphaProcess(ProcessParams *params, ObjectFile *objFile)
51 : Process(params, objFile)
52{
53 brk_point = objFile->dataBase() + objFile->dataSize() + objFile->bssSize();
54 brk_point = roundUp(brk_point, PageBytes);
55
56 // Set up stack. On Alpha, stack goes below text section. This
57 // code should get moved to some architecture-specific spot.
58 stack_base = objFile->textBase() - (409600+4096);
59
60 // Set up region for mmaps. Tru64 seems to start just above 0 and
61 // grow up from there.
62 mmap_end = 0x10000;
63
64 // Set pointer for next thread stack. Reserve 8M for main stack.
65 next_thread_stack_base = stack_base - (8 * 1024 * 1024);
66
67}
68
69void
70AlphaProcess::argsInit(int intSize, int pageSize)
71{
72 // Patch the ld_bias for dynamic executables.
73 updateBias();

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

125 auxv_array_size +
126 arg_data_size +
127 env_data_size;
128
129 if (space_needed < 32*1024)
130 space_needed = 32*1024;
131
132 // set bottom of stack
133 stack_min = stack_base - space_needed;
134 // align it
135 stack_min = roundDown(stack_min, pageSize);
136 stack_size = stack_base - stack_min;
137 // map memory
138 allocateMem(stack_min, roundUp(stack_size, pageSize));
139
140 // map out initial stack contents
141 Addr argv_array_base = stack_min + intSize; // room for argc
142 Addr envp_array_base = argv_array_base + argv_array_size;
143 Addr auxv_array_base = envp_array_base + envp_array_size;
144 Addr arg_data_base = auxv_array_base + auxv_array_size;
145 Addr env_data_base = arg_data_base + arg_data_size;
146
147 // write contents to stack
148 uint64_t argc = argv.size();
149 if (intSize == 8)
150 argc = htog((uint64_t)argc);
151 else if (intSize == 4)
152 argc = htog((uint32_t)argc);
153 else
154 panic("Unknown int size");
155
156 initVirtMem.writeBlob(stack_min, (uint8_t*)&argc, intSize);
157
158 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem);
159 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem);
160
161 //Copy the aux stuff
162 for (vector<auxv_t>::size_type x = 0; x < auxv.size(); x++) {
163 initVirtMem.writeBlob(auxv_array_base + x * 2 * intSize,
164 (uint8_t*)&(auxv[x].a_type), intSize);
165 initVirtMem.writeBlob(auxv_array_base + (x * 2 + 1) * intSize,
166 (uint8_t*)&(auxv[x].a_val), intSize);
167 }
168
169 ThreadContext *tc = system->getThreadContext(contextIds[0]);
170
171 setSyscallArg(tc, 0, argc);
172 setSyscallArg(tc, 1, argv_array_base);
173 tc->setIntReg(StackPointerReg, stack_min);
174
175 tc->pcState(getStartPC());
176}
177
178void
179AlphaProcess::setupASNReg()
180{
181 ThreadContext *tc = system->getThreadContext(contextIds[0]);

--- 64 unchanged lines hidden ---