process.cc (4434:2ea7b6e0b78f) | process.cc (4607:262812b24142) |
---|---|
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; | 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 int window_save_size = intSize * 16; | |
272 273 int space_needed = 274 mysterious_size + 275 info_block_size + 276 aux_array_size + 277 envp_array_size + 278 argv_array_size + | 271 272 int space_needed = 273 mysterious_size + 274 info_block_size + 275 aux_array_size + 276 envp_array_size + 277 argv_array_size + |
279 argc_size + 280 window_save_size; | 278 argc_size; |
281 282 stack_min = stack_base - space_needed; 283 stack_min &= alignmentMask; 284 stack_size = stack_base - stack_min; 285 286 // map memory 287 pTable->allocate(roundDown(stack_min, pageSize), 288 roundUp(stack_size, pageSize)); 289 290 // map out initial stack contents 291 Addr mysterious_base = stack_base - mysterious_size; 292 Addr file_name_base = mysterious_base - file_name_size; 293 Addr env_data_base = file_name_base - env_data_size; 294 Addr arg_data_base = env_data_base - arg_data_size; 295 Addr auxv_array_base = arg_data_base - aux_array_size - info_block_padding; 296 Addr envp_array_base = auxv_array_base - envp_array_size; 297 Addr argv_array_base = envp_array_base - argv_array_size; 298 Addr argc_base = argv_array_base - 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; |
299#ifndef NDEBUG 300 // only used in DPRINTF 301 Addr window_save_base = argc_base - window_save_size; 302#endif | |
303 304 DPRINTF(X86, "The addresses of items on the initial stack:\n"); 305 DPRINTF(X86, "0x%x - file name\n", file_name_base); 306 DPRINTF(X86, "0x%x - env data\n", env_data_base); 307 DPRINTF(X86, "0x%x - arg data\n", arg_data_base); 308 DPRINTF(X86, "0x%x - auxv array\n", auxv_array_base); 309 DPRINTF(X86, "0x%x - envp array\n", envp_array_base); 310 DPRINTF(X86, "0x%x - argv array\n", argv_array_base); 311 DPRINTF(X86, "0x%x - argc \n", argc_base); | 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); |
312 DPRINTF(X86, "0x%x - window save\n", window_save_base); | |
313 DPRINTF(X86, "0x%x - stack min\n", stack_min); 314 315 // write contents to stack 316 317 // figure out argc 318 uint64_t argc = argv.size(); 319 uint64_t guestArgc = TheISA::htog(argc); 320 --- 40 unchanged lines hidden --- | 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 --- |