process.cc (6640:30d92d2b66a1) | process.cc (6701:4842482e1bd1) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007-2008 The Florida State University 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45using namespace std; 46using namespace ArmISA; 47 48/// Target uname() handler. 49static SyscallReturn 50unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 51 ThreadContext *tc) 52{ | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * Copyright (c) 2007-2008 The Florida State University 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions are 8 * met: redistributions of source code must retain the above copyright --- 36 unchanged lines hidden (view full) --- 45using namespace std; 46using namespace ArmISA; 47 48/// Target uname() handler. 49static SyscallReturn 50unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 51 ThreadContext *tc) 52{ |
53 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0)); | 53 int index = 0; 54 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); |
54 55 strcpy(name->sysname, "Linux"); 56 strcpy(name->nodename, "m5.eecs.umich.edu"); 57 strcpy(name->release, "2.6.16.19"); 58 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 59 strcpy(name->machine, "arm"); 60 61 name.copyOut(tc->getMemPort()); --- 350 unchanged lines hidden (view full) --- 412 /* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc), 413}; 414 415/// Target set_tls() handler. 416static SyscallReturn 417setTLSFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 418 ThreadContext *tc) 419{ | 55 56 strcpy(name->sysname, "Linux"); 57 strcpy(name->nodename, "m5.eecs.umich.edu"); 58 strcpy(name->release, "2.6.16.19"); 59 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 60 strcpy(name->machine, "arm"); 61 62 name.copyOut(tc->getMemPort()); --- 350 unchanged lines hidden (view full) --- 413 /* 346 */ SyscallDesc("epoll_pwait", unimplementedFunc), 414}; 415 416/// Target set_tls() handler. 417static SyscallReturn 418setTLSFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 419 ThreadContext *tc) 420{ |
420 uint32_t tlsPtr = process->getSyscallArg(tc, 0); | 421 int index = 0; 422 uint32_t tlsPtr = process->getSyscallArg(tc, index); |
421 422 tc->getMemPort()->writeBlob(ArmLinuxProcess::commPage + 0x0ff0, 423 (uint8_t *)&tlsPtr, sizeof(tlsPtr)); 424 return 0; 425} 426 427SyscallDesc ArmLinuxProcess::privSyscallDescs[] = { 428 /* 1 */ SyscallDesc("breakpoint", unimplementedFunc), --- 77 unchanged lines hidden (view full) --- 506 { 507 0x08, 0x00, 0x9f, 0xe5, //ldr r0, [pc, #(16 - 8)] 508 0x0e, 0xf0, 0xa0, 0xe1 //usr_ret lr 509 }; 510 tc->getMemPort()->writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls)); 511} 512 513ArmISA::IntReg | 423 424 tc->getMemPort()->writeBlob(ArmLinuxProcess::commPage + 0x0ff0, 425 (uint8_t *)&tlsPtr, sizeof(tlsPtr)); 426 return 0; 427} 428 429SyscallDesc ArmLinuxProcess::privSyscallDescs[] = { 430 /* 1 */ SyscallDesc("breakpoint", unimplementedFunc), --- 77 unchanged lines hidden (view full) --- 508 { 509 0x08, 0x00, 0x9f, 0xe5, //ldr r0, [pc, #(16 - 8)] 510 0x0e, 0xf0, 0xa0, 0xe1 //usr_ret lr 511 }; 512 tc->getMemPort()->writeBlob(commPage + 0x0fe0, get_tls, sizeof(get_tls)); 513} 514 515ArmISA::IntReg |
514ArmLinuxProcess::getSyscallArg(ThreadContext *tc, int i) | 516ArmLinuxProcess::getSyscallArg(ThreadContext *tc, int &i) |
515{ 516 // Linux apparently allows more parameter than the ABI says it should. 517 // This limit may need to be increased even further. 518 assert(i < 6); | 517{ 518 // Linux apparently allows more parameter than the ABI says it should. 519 // This limit may need to be increased even further. 520 assert(i < 6); |
519 return tc->readIntReg(ArgumentReg0 + i); | 521 return tc->readIntReg(ArgumentReg0 + i++); |
520} 521 522void 523ArmLinuxProcess::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val) 524{ 525 // Linux apparently allows more parameter than the ABI says it should. 526 // This limit may need to be increased even further. 527 assert(i < 6); 528 tc->setIntReg(ArgumentReg0 + i, val); 529} | 522} 523 524void 525ArmLinuxProcess::setSyscallArg(ThreadContext *tc, int i, ArmISA::IntReg val) 526{ 527 // Linux apparently allows more parameter than the ABI says it should. 528 // This limit may need to be increased even further. 529 assert(i < 6); 530 tc->setIntReg(ArgumentReg0 + i, val); 531} |