process.cc (6650:f23a18fec0ef) | process.cc (6701:4842482e1bd1) |
---|---|
1/* 2 * Copyright (c) 2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 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 --- 37 unchanged lines hidden (view full) --- 46using namespace std; 47using namespace MipsISA; 48 49/// Target uname() handler. 50static SyscallReturn 51unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 52 ThreadContext *tc) 53{ | 1/* 2 * Copyright (c) 2005 The Regents of The University of Michigan 3 * Copyright (c) 2007 MIPS Technologies, Inc. 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 --- 37 unchanged lines hidden (view full) --- 46using namespace std; 47using namespace MipsISA; 48 49/// Target uname() handler. 50static SyscallReturn 51unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 52 ThreadContext *tc) 53{ |
54 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, 0)); | 54 int index = 0; 55 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); |
55 56 strcpy(name->sysname, "Linux"); 57 strcpy(name->nodename,"m5.eecs.umich.edu"); 58 strcpy(name->release, "2.4.20"); 59 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 60 strcpy(name->machine, "mips"); 61 62 name.copyOut(tc->getMemPort()); 63 return 0; 64} 65 66/// Target sys_getsysyinfo() handler. Even though this call is 67/// borrowed from Tru64, the subcases that get used appear to be 68/// different in practice from those used by Tru64 processes. 69static SyscallReturn 70sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 71 ThreadContext *tc) 72{ | 56 57 strcpy(name->sysname, "Linux"); 58 strcpy(name->nodename,"m5.eecs.umich.edu"); 59 strcpy(name->release, "2.4.20"); 60 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 61 strcpy(name->machine, "mips"); 62 63 name.copyOut(tc->getMemPort()); 64 return 0; 65} 66 67/// Target sys_getsysyinfo() handler. Even though this call is 68/// borrowed from Tru64, the subcases that get used appear to be 69/// different in practice from those used by Tru64 processes. 70static SyscallReturn 71sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 72 ThreadContext *tc) 73{ |
73 unsigned op = process->getSyscallArg(tc, 0); 74 // unsigned nbytes = process->getSyscallArg(tc, 2); | 74 int index = 0; 75 unsigned op = process->getSyscallArg(tc, index); 76 unsigned bufPtr = process->getSyscallArg(tc, index); 77 // unsigned nbytes = process->getSyscallArg(tc, index); |
75 76 switch (op) { 77 case 45: 78 { 79 // GSI_IEEE_FP_CONTROL | 78 79 switch (op) { 80 case 45: 81 { 82 // GSI_IEEE_FP_CONTROL |
80 TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1)); | 83 TypedBufferArg<uint64_t> fpcr(bufPtr); |
81 // I don't think this exactly matches the HW FPCR 82 *fpcr = 0; 83 fpcr.copyOut(tc->getMemPort()); 84 return 0; 85 } 86 default: 87 cerr << "sys_getsysinfo: unknown op " << op << endl; 88 abort(); 89 break; 90 } 91 92 return 1; 93} 94 95/// Target sys_setsysinfo() handler. 96static SyscallReturn 97sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 98 ThreadContext *tc) 99{ | 84 // I don't think this exactly matches the HW FPCR 85 *fpcr = 0; 86 fpcr.copyOut(tc->getMemPort()); 87 return 0; 88 } 89 default: 90 cerr << "sys_getsysinfo: unknown op " << op << endl; 91 abort(); 92 break; 93 } 94 95 return 1; 96} 97 98/// Target sys_setsysinfo() handler. 99static SyscallReturn 100sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, 101 ThreadContext *tc) 102{ |
100 unsigned op = process->getSyscallArg(tc, 0); 101 // unsigned nbytes = process->getSyscallArg(tc, 2); | 103 int index = 0; 104 unsigned op = process->getSyscallArg(tc, index); 105 Addr bufPtr = process->getSyscallArg(tc, index); 106 // unsigned nbytes = process->getSyscallArg(tc, index); |
102 103 switch (op) { 104 105 case 14: 106 { 107 // SSI_IEEE_FP_CONTROL | 107 108 switch (op) { 109 110 case 14: 111 { 112 // SSI_IEEE_FP_CONTROL |
108 TypedBufferArg<uint64_t> fpcr(process->getSyscallArg(tc, 1)); | 113 TypedBufferArg<uint64_t> fpcr(bufPtr); |
109 // I don't think this exactly matches the HW FPCR 110 fpcr.copyIn(tc->getMemPort()); 111 DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): " 112 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr)); 113 return 0; 114 } 115 default: 116 cerr << "sys_setsysinfo: unknown op " << op << endl; --- 315 unchanged lines hidden --- | 114 // I don't think this exactly matches the HW FPCR 115 fpcr.copyIn(tc->getMemPort()); 116 DPRINTFR(SyscallVerbose, "sys_setsysinfo(SSI_IEEE_FP_CONTROL): " 117 " setting FPCR to 0x%x\n", gtoh(*(uint64_t*)fpcr)); 118 return 0; 119 } 120 default: 121 cerr << "sys_setsysinfo: unknown op " << op << endl; --- 315 unchanged lines hidden --- |