process.cc (13894:8603648c1679) | process.cc (14010:0e1e887507c0) |
---|---|
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; --- 350 unchanged lines hidden (view full) --- 359 // write contents to stack 360 361 // figure out argc 362 IntType argc = argv.size(); 363 IntType guestArgc = SparcISA::htog(argc); 364 365 // Write out the sentry void * 366 uint64_t sentry_NULL = 0; | 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; --- 350 unchanged lines hidden (view full) --- 359 // write contents to stack 360 361 // figure out argc 362 IntType argc = argv.size(); 363 IntType guestArgc = SparcISA::htog(argc); 364 365 // Write out the sentry void * 366 uint64_t sentry_NULL = 0; |
367 initVirtMem.writeBlob(sentry_base, 368 (uint8_t*)&sentry_NULL, sentry_size); | 367 initVirtMem.writeBlob(sentry_base, &sentry_NULL, sentry_size); |
369 370 // Write the file name 371 initVirtMem.writeString(file_name_base, filename.c_str()); 372 373 // Copy the aux stuff 374 Addr auxv_array_end = auxv_array_base; 375 for (const auto &aux: auxv) { 376 initVirtMem.write(auxv_array_end, aux, GuestByteOrder); 377 auxv_array_end += sizeof(aux); 378 } 379 380 // Write out the terminating zeroed auxilliary vector 381 const AuxVector<IntType> zero(0, 0); 382 initVirtMem.write(auxv_array_end, zero); 383 auxv_array_end += sizeof(zero); 384 385 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); 386 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); 387 | 368 369 // Write the file name 370 initVirtMem.writeString(file_name_base, filename.c_str()); 371 372 // Copy the aux stuff 373 Addr auxv_array_end = auxv_array_base; 374 for (const auto &aux: auxv) { 375 initVirtMem.write(auxv_array_end, aux, GuestByteOrder); 376 auxv_array_end += sizeof(aux); 377 } 378 379 // Write out the terminating zeroed auxilliary vector 380 const AuxVector<IntType> zero(0, 0); 381 initVirtMem.write(auxv_array_end, zero); 382 auxv_array_end += sizeof(zero); 383 384 copyStringArray(envp, envp_array_base, env_data_base, initVirtMem); 385 copyStringArray(argv, argv_array_base, arg_data_base, initVirtMem); 386 |
388 initVirtMem.writeBlob(argc_base, (uint8_t*)&guestArgc, intSize); | 387 initVirtMem.writeBlob(argc_base, &guestArgc, intSize); |
389 390 // Set up space for the trap handlers into the processes address space. 391 // Since the stack grows down and there is reserved address space abov 392 // it, we can put stuff above it and stay out of the way. 393 fillStart = memState->getStackBase(); 394 spillStart = fillStart + sizeof(MachInst) * numFillInsts; 395 396 ThreadContext *tc = system->getThreadContext(contextIds[0]); --- 15 unchanged lines hidden (view full) --- 412 413void 414Sparc64Process::argsInit(int intSize, int pageSize) 415{ 416 SparcProcess::argsInit<uint64_t>(pageSize); 417 418 // Stuff the trap handlers into the process address space 419 initVirtMem.writeBlob(fillStart, | 388 389 // Set up space for the trap handlers into the processes address space. 390 // Since the stack grows down and there is reserved address space abov 391 // it, we can put stuff above it and stay out of the way. 392 fillStart = memState->getStackBase(); 393 spillStart = fillStart + sizeof(MachInst) * numFillInsts; 394 395 ThreadContext *tc = system->getThreadContext(contextIds[0]); --- 15 unchanged lines hidden (view full) --- 411 412void 413Sparc64Process::argsInit(int intSize, int pageSize) 414{ 415 SparcProcess::argsInit<uint64_t>(pageSize); 416 417 // Stuff the trap handlers into the process address space 418 initVirtMem.writeBlob(fillStart, |
420 (uint8_t*)fillHandler64, sizeof(MachInst) * numFillInsts); | 419 fillHandler64, sizeof(MachInst) * numFillInsts); |
421 initVirtMem.writeBlob(spillStart, | 420 initVirtMem.writeBlob(spillStart, |
422 (uint8_t*)spillHandler64, sizeof(MachInst) * numSpillInsts); | 421 spillHandler64, sizeof(MachInst) * numSpillInsts); |
423} 424 425void 426Sparc32Process::argsInit(int intSize, int pageSize) 427{ 428 SparcProcess::argsInit<uint32_t>(pageSize); 429 430 // Stuff the trap handlers into the process address space 431 initVirtMem.writeBlob(fillStart, | 422} 423 424void 425Sparc32Process::argsInit(int intSize, int pageSize) 426{ 427 SparcProcess::argsInit<uint32_t>(pageSize); 428 429 // Stuff the trap handlers into the process address space 430 initVirtMem.writeBlob(fillStart, |
432 (uint8_t*)fillHandler32, sizeof(MachInst) * numFillInsts); | 431 fillHandler32, sizeof(MachInst) * numFillInsts); |
433 initVirtMem.writeBlob(spillStart, | 432 initVirtMem.writeBlob(spillStart, |
434 (uint8_t*)spillHandler32, sizeof(MachInst) * numSpillInsts); | 433 spillHandler32, sizeof(MachInst) * numSpillInsts); |
435} 436 437void Sparc32Process::flushWindows(ThreadContext *tc) 438{ 439 RegVal Cansave = tc->readIntReg(NumIntArchRegs + 3); 440 RegVal Canrestore = tc->readIntReg(NumIntArchRegs + 4); 441 RegVal Otherwin = tc->readIntReg(NumIntArchRegs + 6); 442 RegVal CWP = tc->readMiscReg(MISCREG_CWP); --- 116 unchanged lines hidden --- | 434} 435 436void Sparc32Process::flushWindows(ThreadContext *tc) 437{ 438 RegVal Cansave = tc->readIntReg(NumIntArchRegs + 3); 439 RegVal Canrestore = tc->readIntReg(NumIntArchRegs + 4); 440 RegVal Otherwin = tc->readIntReg(NumIntArchRegs + 6); 441 RegVal CWP = tc->readMiscReg(MISCREG_CWP); --- 116 unchanged lines hidden --- |