1/* 2 * Copyright (c) 2003-2006 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; --- 254 unchanged lines hidden (view full) --- 263 264 //Each auxilliary vector is two 8 byte words 265 int aux_array_size = intSize * 2 * (auxv.size() + 1); 266 267 int envp_array_size = intSize * (envp.size() + 1); 268 int argv_array_size = intSize * (argv.size() + 1); 269 270 int argc_size = intSize; |
271 272 int space_needed = 273 mysterious_size + 274 info_block_size + 275 aux_array_size + 276 envp_array_size + 277 argv_array_size + |
278 argc_size; |
279 280 stack_min = stack_base - space_needed; 281 stack_min &= alignmentMask; 282 stack_size = stack_base - stack_min; 283 284 // map memory 285 pTable->allocate(roundDown(stack_min, pageSize), 286 roundUp(stack_size, pageSize)); 287 288 // map out initial stack contents 289 Addr mysterious_base = stack_base - mysterious_size; 290 Addr file_name_base = mysterious_base - file_name_size; 291 Addr env_data_base = file_name_base - env_data_size; 292 Addr arg_data_base = env_data_base - arg_data_size; 293 Addr auxv_array_base = arg_data_base - aux_array_size - info_block_padding; 294 Addr envp_array_base = auxv_array_base - envp_array_size; 295 Addr argv_array_base = envp_array_base - argv_array_size; 296 Addr argc_base = argv_array_base - argc_size; |
297 298 DPRINTF(X86, "The addresses of items on the initial stack:\n"); 299 DPRINTF(X86, "0x%x - file name\n", file_name_base); 300 DPRINTF(X86, "0x%x - env data\n", env_data_base); 301 DPRINTF(X86, "0x%x - arg data\n", arg_data_base); 302 DPRINTF(X86, "0x%x - auxv array\n", auxv_array_base); 303 DPRINTF(X86, "0x%x - envp array\n", envp_array_base); 304 DPRINTF(X86, "0x%x - argv array\n", argv_array_base); 305 DPRINTF(X86, "0x%x - argc \n", argc_base); |
306 DPRINTF(X86, "0x%x - stack min\n", stack_min); 307 308 // write contents to stack 309 310 // figure out argc 311 uint64_t argc = argv.size(); 312 uint64_t guestArgc = TheISA::htog(argc); 313 --- 40 unchanged lines hidden --- |