process.cc (10318:98771a936b61) | process.cc (10810:683ab55819fd) |
---|---|
1/* 2 * Copyright (c) 2010, 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 167 unchanged lines hidden (view full) --- 176 Arm_Vfpv3 = 1 << 13, 177 Arm_Vfpv3d16 = 1 << 14 178 }; 179 180 //Setup the auxilliary vectors. These will already have endian conversion. 181 //Auxilliary vectors are loaded only for elf formatted executables. 182 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); 183 if (elfObject) { | 1/* 2 * Copyright (c) 2010, 2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 167 unchanged lines hidden (view full) --- 176 Arm_Vfpv3 = 1 << 13, 177 Arm_Vfpv3d16 = 1 << 14 178 }; 179 180 //Setup the auxilliary vectors. These will already have endian conversion. 181 //Auxilliary vectors are loaded only for elf formatted executables. 182 ElfObject * elfObject = dynamic_cast<ElfObject *>(objFile); 183 if (elfObject) { |
184 IntType features = 185 Arm_Swp | 186 Arm_Half | 187 Arm_Thumb | 188// Arm_26Bit | 189 Arm_FastMult | 190// Arm_Fpa | 191 Arm_Vfp | 192 Arm_Edsp | 193// Arm_Java | 194// Arm_Iwmmxt | 195// Arm_Crunch | 196 Arm_ThumbEE | 197 Arm_Neon | 198 Arm_Vfpv3 | 199 Arm_Vfpv3d16 | 200 0; | |
201 | 184 |
202 //Bits which describe the system hardware capabilities 203 //XXX Figure out what these should be 204 auxv.push_back(auxv_t(M5_AT_HWCAP, features)); | 185 if (objFile->getOpSys() == ObjectFile::Linux) { 186 IntType features = 187 Arm_Swp | 188 Arm_Half | 189 Arm_Thumb | 190// Arm_26Bit | 191 Arm_FastMult | 192// Arm_Fpa | 193 Arm_Vfp | 194 Arm_Edsp | 195// Arm_Java | 196// Arm_Iwmmxt | 197// Arm_Crunch | 198 Arm_ThumbEE | 199 Arm_Neon | 200 Arm_Vfpv3 | 201 Arm_Vfpv3d16 | 202 0; 203 204 //Bits which describe the system hardware capabilities 205 //XXX Figure out what these should be 206 auxv.push_back(auxv_t(M5_AT_HWCAP, features)); 207 //Frequency at which times() increments 208 auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); 209 //Whether to enable "secure mode" in the executable 210 auxv.push_back(auxv_t(M5_AT_SECURE, 0)); 211 // Pointer to 16 bytes of random data 212 auxv.push_back(auxv_t(M5_AT_RANDOM, 0)); 213 //The filename of the program 214 auxv.push_back(auxv_t(M5_AT_EXECFN, 0)); 215 //The string "v71" -- ARM v7 architecture 216 auxv.push_back(auxv_t(M5_AT_PLATFORM, 0)); 217 } 218 |
205 //The system page size 206 auxv.push_back(auxv_t(M5_AT_PAGESZ, ArmISA::PageBytes)); | 219 //The system page size 220 auxv.push_back(auxv_t(M5_AT_PAGESZ, ArmISA::PageBytes)); |
207 //Frequency at which times() increments 208 auxv.push_back(auxv_t(M5_AT_CLKTCK, 0x64)); | |
209 // For statically linked executables, this is the virtual address of the 210 // program header tables if they appear in the executable image 211 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable())); 212 // This is the size of a program header entry from the elf file. 213 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize())); 214 // This is the number of program headers from the original elf file. 215 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount())); 216 //This is the address of the elf "interpreter", It should be set 217 //to 0 for regular executables. It should be something else 218 //(not sure what) for dynamic libraries. 219 auxv.push_back(auxv_t(M5_AT_BASE, 0)); | 221 // For statically linked executables, this is the virtual address of the 222 // program header tables if they appear in the executable image 223 auxv.push_back(auxv_t(M5_AT_PHDR, elfObject->programHeaderTable())); 224 // This is the size of a program header entry from the elf file. 225 auxv.push_back(auxv_t(M5_AT_PHENT, elfObject->programHeaderSize())); 226 // This is the number of program headers from the original elf file. 227 auxv.push_back(auxv_t(M5_AT_PHNUM, elfObject->programHeaderCount())); 228 //This is the address of the elf "interpreter", It should be set 229 //to 0 for regular executables. It should be something else 230 //(not sure what) for dynamic libraries. 231 auxv.push_back(auxv_t(M5_AT_BASE, 0)); |
220 | |
221 //XXX Figure out what this should be. 222 auxv.push_back(auxv_t(M5_AT_FLAGS, 0)); 223 //The entry point to the program 224 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint())); 225 //Different user and group IDs 226 auxv.push_back(auxv_t(M5_AT_UID, uid())); 227 auxv.push_back(auxv_t(M5_AT_EUID, euid())); 228 auxv.push_back(auxv_t(M5_AT_GID, gid())); 229 auxv.push_back(auxv_t(M5_AT_EGID, egid())); | 232 //XXX Figure out what this should be. 233 auxv.push_back(auxv_t(M5_AT_FLAGS, 0)); 234 //The entry point to the program 235 auxv.push_back(auxv_t(M5_AT_ENTRY, objFile->entryPoint())); 236 //Different user and group IDs 237 auxv.push_back(auxv_t(M5_AT_UID, uid())); 238 auxv.push_back(auxv_t(M5_AT_EUID, euid())); 239 auxv.push_back(auxv_t(M5_AT_GID, gid())); 240 auxv.push_back(auxv_t(M5_AT_EGID, egid())); |
230 //Whether to enable "secure mode" in the executable 231 auxv.push_back(auxv_t(M5_AT_SECURE, 0)); 232 233 // Pointer to 16 bytes of random data 234 auxv.push_back(auxv_t(M5_AT_RANDOM, 0)); 235 236 //The filename of the program 237 auxv.push_back(auxv_t(M5_AT_EXECFN, 0)); 238 //The string "v71" -- ARM v7 architecture 239 auxv.push_back(auxv_t(M5_AT_PLATFORM, 0)); | |
240 } 241 242 //Figure out how big the initial stack nedes to be 243 244 // A sentry NULL void pointer at the top of the stack. 245 int sentry_size = intSize; 246 247 string platform = "v71"; --- 203 unchanged lines hidden (view full) --- 451{ 452 assert(i < 8); 453 tc->setIntReg(ArgumentReg0 + i, val); 454} 455 456void 457ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) 458{ | 241 } 242 243 //Figure out how big the initial stack nedes to be 244 245 // A sentry NULL void pointer at the top of the stack. 246 int sentry_size = intSize; 247 248 string platform = "v71"; --- 203 unchanged lines hidden (view full) --- 452{ 453 assert(i < 8); 454 tc->setIntReg(ArgumentReg0 + i, val); 455} 456 457void 458ArmLiveProcess32::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) 459{ |
460 461 if (objFile->getOpSys() == ObjectFile::FreeBSD) { 462 // Decode return value 463 if (sysret.encodedValue() >= 0) 464 // FreeBSD checks the carry bit to determine if syscall is succeeded 465 tc->setCCReg(CCREG_C, 0); 466 else { 467 sysret = -sysret.encodedValue(); 468 } 469 } 470 |
|
459 tc->setIntReg(ReturnValueReg, sysret.encodedValue()); 460} 461 462void 463ArmLiveProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) 464{ | 471 tc->setIntReg(ReturnValueReg, sysret.encodedValue()); 472} 473 474void 475ArmLiveProcess64::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret) 476{ |
477 478 if (objFile->getOpSys() == ObjectFile::FreeBSD) { 479 // Decode return value 480 if (sysret.encodedValue() >= 0) 481 // FreeBSD checks the carry bit to determine if syscall is succeeded 482 tc->setCCReg(CCREG_C, 0); 483 else { 484 sysret = -sysret.encodedValue(); 485 } 486 } 487 |
|
465 tc->setIntReg(ReturnValueReg, sysret.encodedValue()); 466} | 488 tc->setIntReg(ReturnValueReg, sysret.encodedValue()); 489} |