process.cc (13989:e1ebe4024faf) | process.cc (13995:5d459168a680) |
---|---|
1/* 2 * Copyright (c) 2007 The Hewlett-Packard Development Company 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 --- 77 unchanged lines hidden (view full) --- 86}; 87 88X86LinuxObjectFileLoader loader; 89 90} // anonymous namespace 91 92/// Target uname() handler. 93static SyscallReturn | 1/* 2 * Copyright (c) 2007 The Hewlett-Packard Development Company 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 --- 77 unchanged lines hidden (view full) --- 86}; 87 88X86LinuxObjectFileLoader loader; 89 90} // anonymous namespace 91 92/// Target uname() handler. 93static SyscallReturn |
94unameFunc(SyscallDesc *desc, int callnum, Process *process, 95 ThreadContext *tc) | 94unameFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) |
96{ 97 int index = 0; | 95{ 96 int index = 0; |
97 auto process = tc->getProcessPtr(); |
|
98 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 99 100 strcpy(name->sysname, "Linux"); 101 strcpy(name->nodename, "sim.gem5.org"); 102 strcpy(name->release, "3.2.0"); 103 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 104 strcpy(name->machine, "x86_64"); 105 106 name.copyOut(tc->getMemProxy()); 107 108 return 0; 109} 110 111static SyscallReturn | 98 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 99 100 strcpy(name->sysname, "Linux"); 101 strcpy(name->nodename, "sim.gem5.org"); 102 strcpy(name->release, "3.2.0"); 103 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 104 strcpy(name->machine, "x86_64"); 105 106 name.copyOut(tc->getMemProxy()); 107 108 return 0; 109} 110 111static SyscallReturn |
112archPrctlFunc(SyscallDesc *desc, int callnum, Process *process, 113 ThreadContext *tc) | 112archPrctlFunc(SyscallDesc *desc, int callnum, ThreadContext *tc) |
114{ 115 enum ArchPrctlCodes 116 { 117 SetFS = 0x1002, 118 GetFS = 0x1003, 119 SetGS = 0x1001, 120 GetGS = 0x1004 121 }; 122 123 // First argument is the code, second is the address 124 int index = 0; | 113{ 114 enum ArchPrctlCodes 115 { 116 SetFS = 0x1002, 117 GetFS = 0x1003, 118 SetGS = 0x1001, 119 GetGS = 0x1004 120 }; 121 122 // First argument is the code, second is the address 123 int index = 0; |
124 auto process = tc->getProcessPtr(); |
|
125 int code = process->getSyscallArg(tc, index); 126 uint64_t addr = process->getSyscallArg(tc, index); 127 uint64_t fsBase, gsBase; 128 SETranslatingPortProxy &p = tc->getMemProxy(); 129 switch(code) 130 { 131 // Each of these valid options should actually check addr. 132 case SetFS: --- 37 unchanged lines hidden (view full) --- 170 uint32_t entry_number; 171 uint32_t __padding1; 172 uint64_t base_addr; 173 uint32_t limit; 174 uint32_t flags; 175}; 176 177static SyscallReturn | 125 int code = process->getSyscallArg(tc, index); 126 uint64_t addr = process->getSyscallArg(tc, index); 127 uint64_t fsBase, gsBase; 128 SETranslatingPortProxy &p = tc->getMemProxy(); 129 switch(code) 130 { 131 // Each of these valid options should actually check addr. 132 case SetFS: --- 37 unchanged lines hidden (view full) --- 170 uint32_t entry_number; 171 uint32_t __padding1; 172 uint64_t base_addr; 173 uint32_t limit; 174 uint32_t flags; 175}; 176 177static SyscallReturn |
178setThreadArea32Func(SyscallDesc *desc, int callnum, 179 Process *process, ThreadContext *tc) | 178setThreadArea32Func(SyscallDesc *desc, int callnum, ThreadContext *tc) |
180{ 181 const int minTLSEntry = 6; 182 const int numTLSEntries = 3; 183 const int maxTLSEntry = minTLSEntry + numTLSEntries - 1; 184 | 179{ 180 const int minTLSEntry = 6; 181 const int numTLSEntries = 3; 182 const int maxTLSEntry = minTLSEntry + numTLSEntries - 1; 183 |
184 auto process = tc->getProcessPtr(); 185 |
|
185 X86Process *x86p = dynamic_cast<X86Process *>(process); 186 assert(x86p); 187 188 assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize()); 189 190 int argIndex = 0; 191 TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex)); 192 TypedBufferArg<uint64_t> --- 740 unchanged lines hidden --- | 186 X86Process *x86p = dynamic_cast<X86Process *>(process); 187 assert(x86p); 188 189 assert((maxTLSEntry + 1) * sizeof(uint64_t) <= x86p->gdtSize()); 190 191 int argIndex = 0; 192 TypedBufferArg<UserDesc32> userDesc(process->getSyscallArg(tc, argIndex)); 193 TypedBufferArg<uint64_t> --- 740 unchanged lines hidden --- |