process.cc (4772:f08370a81812) process.cc (4793:315e1db6bd39)
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;

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

189 else
190 filename = argv[0];
191
192 Addr alignmentMask = ~(intSize - 1);
193
194 // load object file into target memory
195 objFile->loadSections(initVirtMem);
196
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;

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

189 else
190 filename = argv[0];
191
192 Addr alignmentMask = ~(intSize - 1);
193
194 // load object file into target memory
195 objFile->loadSections(initVirtMem);
196
197 //These are the auxilliary vector types
198 enum auxTypes
199 {
200 SPARC_AT_HWCAP = 16,
201 SPARC_AT_PAGESZ = 6,
202 SPARC_AT_CLKTCK = 17,
203 SPARC_AT_PHDR = 3,
204 SPARC_AT_PHENT = 4,
205 SPARC_AT_PHNUM = 5,
206 SPARC_AT_BASE = 7,
207 SPARC_AT_FLAGS = 8,
208 SPARC_AT_ENTRY = 9,
209 SPARC_AT_UID = 11,
210 SPARC_AT_EUID = 12,
211 SPARC_AT_GID = 13,
212 SPARC_AT_EGID = 14,
213 SPARC_AT_SECURE = 23
214 };
215
216 enum hardwareCaps
217 {
218 M5_HWCAP_SPARC_FLUSH = 1,
219 M5_HWCAP_SPARC_STBAR = 2,
220 M5_HWCAP_SPARC_SWAP = 4,
221 M5_HWCAP_SPARC_MULDIV = 8,
222 M5_HWCAP_SPARC_V9 = 16,
223 //This one should technically only be set

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

236
237
238 //Setup the auxilliary vectors. These will already have endian conversion.
239 //Auxilliary vectors are loaded only for elf formatted executables.
240 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
241 if(elfObject)
242 {
243 //Bits which describe the system hardware capabilities
197 enum hardwareCaps
198 {
199 M5_HWCAP_SPARC_FLUSH = 1,
200 M5_HWCAP_SPARC_STBAR = 2,
201 M5_HWCAP_SPARC_SWAP = 4,
202 M5_HWCAP_SPARC_MULDIV = 8,
203 M5_HWCAP_SPARC_V9 = 16,
204 //This one should technically only be set

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

217
218
219 //Setup the auxilliary vectors. These will already have endian conversion.
220 //Auxilliary vectors are loaded only for elf formatted executables.
221 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile);
222 if(elfObject)
223 {
224 //Bits which describe the system hardware capabilities
244 auxv.push_back(auxv_t(SPARC_AT_HWCAP, hwcap));
225 auxv.push_back(auxv_t(M5_AT_HWCAP, hwcap));
245 //The system page size
226 //The system page size
246 auxv.push_back(auxv_t(SPARC_AT_PAGESZ, SparcISA::VMPageSize));
227 auxv.push_back(auxv_t(M5_AT_PAGESZ, SparcISA::VMPageSize));
247 //Defined to be 100 in the kernel source.
248 //Frequency at which times() increments
228 //Defined to be 100 in the kernel source.
229 //Frequency at which times() increments
249 auxv.push_back(auxv_t(SPARC_AT_CLKTCK, 100));
230 auxv.push_back(auxv_t(M5_AT_CLKTCK, 100));
250 // For statically linked executables, this is the virtual address of the
251 // program header tables if they appear in the executable image
231 // For statically linked executables, this is the virtual address of the
232 // program header tables if they appear in the executable image
252 auxv.push_back(auxv_t(SPARC_AT_PHDR, elfObject->programHeaderTable()));
233 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable()));
253 // This is the size of a program header entry from the elf file.
234 // This is the size of a program header entry from the elf file.
254 auxv.push_back(auxv_t(SPARC_AT_PHENT, elfObject->programHeaderSize()));
235 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize()));
255 // This is the number of program headers from the original elf file.
236 // This is the number of program headers from the original elf file.
256 auxv.push_back(auxv_t(SPARC_AT_PHNUM, elfObject->programHeaderCount()));
237 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount()));
257 //This is the address of the elf "interpreter", It should be set
258 //to 0 for regular executables. It should be something else
259 //(not sure what) for dynamic libraries.
238 //This is the address of the elf "interpreter", It should be set
239 //to 0 for regular executables. It should be something else
240 //(not sure what) for dynamic libraries.
260 auxv.push_back(auxv_t(SPARC_AT_BASE, 0));
241 auxv.push_back(auxv_t(M5_AT_BASE, 0));
261 //This is hardwired to 0 in the elf loading code in the kernel
242 //This is hardwired to 0 in the elf loading code in the kernel
262 auxv.push_back(auxv_t(SPARC_AT_FLAGS, 0));
243 auxv.push_back(auxv_t(M5_AT_FLAGS, 0));
263 //The entry point to the program
244 //The entry point to the program
264 auxv.push_back(auxv_t(SPARC_AT_ENTRY, objFile->entryPoint()));
245 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint()));
265 //Different user and group IDs
246 //Different user and group IDs
266 auxv.push_back(auxv_t(SPARC_AT_UID, uid()));
267 auxv.push_back(auxv_t(SPARC_AT_EUID, euid()));
268 auxv.push_back(auxv_t(SPARC_AT_GID, gid()));
269 auxv.push_back(auxv_t(SPARC_AT_EGID, egid()));
247 auxv.push_back(auxv_t(M5_AT_UID, uid()));
248 auxv.push_back(auxv_t(M5_AT_EUID, euid()));
249 auxv.push_back(auxv_t(M5_AT_GID, gid()));
250 auxv.push_back(auxv_t(M5_AT_EGID, egid()));
270 //Whether to enable "secure mode" in the executable
251 //Whether to enable "secure mode" in the executable
271 auxv.push_back(auxv_t(SPARC_AT_SECURE, 0));
252 auxv.push_back(auxv_t(M5_AT_SECURE, 0));
272 }
273
274 //Figure out how big the initial stack needs to be
275
276 // The unaccounted for 0 at the top of the stack
277 int mysterious_size = intSize;
278
279 //This is the name of the file which is present on the initial stack

--- 366 unchanged lines hidden ---
253 }
254
255 //Figure out how big the initial stack needs to be
256
257 // The unaccounted for 0 at the top of the stack
258 int mysterious_size = intSize;
259
260 //This is the name of the file which is present on the initial stack

--- 366 unchanged lines hidden ---