process.cc (11794:97eebddaae84) | process.cc (11851:824055fe6b30) |
---|---|
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 --- 35 unchanged lines hidden (view full) --- 44#include "sim/syscall_emul.hh" 45#include "sim/system.hh" 46 47using namespace std; 48using namespace MipsISA; 49 50/// Target uname() handler. 51static SyscallReturn | 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 --- 35 unchanged lines hidden (view full) --- 44#include "sim/syscall_emul.hh" 45#include "sim/system.hh" 46 47using namespace std; 48using namespace MipsISA; 49 50/// Target uname() handler. 51static SyscallReturn |
52unameFunc(SyscallDesc *desc, int callnum, LiveProcess *process, | 52unameFunc(SyscallDesc *desc, int callnum, Process *process, |
53 ThreadContext *tc) 54{ 55 int index = 0; 56 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 57 58 strcpy(name->sysname, "Linux"); 59 strcpy(name->nodename,"sim.gem5.org"); 60 strcpy(name->release, "3.0.0"); 61 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 62 strcpy(name->machine, "mips"); 63 64 name.copyOut(tc->getMemProxy()); 65 return 0; 66} 67 68/// Target sys_getsysyinfo() handler. Even though this call is 69/// borrowed from Tru64, the subcases that get used appear to be 70/// different in practice from those used by Tru64 processes. 71static SyscallReturn | 53 ThreadContext *tc) 54{ 55 int index = 0; 56 TypedBufferArg<Linux::utsname> name(process->getSyscallArg(tc, index)); 57 58 strcpy(name->sysname, "Linux"); 59 strcpy(name->nodename,"sim.gem5.org"); 60 strcpy(name->release, "3.0.0"); 61 strcpy(name->version, "#1 Mon Aug 18 11:32:15 EDT 2003"); 62 strcpy(name->machine, "mips"); 63 64 name.copyOut(tc->getMemProxy()); 65 return 0; 66} 67 68/// Target sys_getsysyinfo() handler. Even though this call is 69/// borrowed from Tru64, the subcases that get used appear to be 70/// different in practice from those used by Tru64 processes. 71static SyscallReturn |
72sys_getsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, | 72sys_getsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, |
73 ThreadContext *tc) 74{ 75 int index = 0; 76 unsigned op = process->getSyscallArg(tc, index); 77 unsigned bufPtr = process->getSyscallArg(tc, index); 78 // unsigned nbytes = process->getSyscallArg(tc, index); 79 80 switch (op) { --- 12 unchanged lines hidden (view full) --- 93 break; 94 } 95 96 return 1; 97} 98 99/// Target sys_setsysinfo() handler. 100static SyscallReturn | 73 ThreadContext *tc) 74{ 75 int index = 0; 76 unsigned op = process->getSyscallArg(tc, index); 77 unsigned bufPtr = process->getSyscallArg(tc, index); 78 // unsigned nbytes = process->getSyscallArg(tc, index); 79 80 switch (op) { --- 12 unchanged lines hidden (view full) --- 93 break; 94 } 95 96 return 1; 97} 98 99/// Target sys_setsysinfo() handler. 100static SyscallReturn |
101sys_setsysinfoFunc(SyscallDesc *desc, int callnum, LiveProcess *process, | 101sys_setsysinfoFunc(SyscallDesc *desc, int callnum, Process *process, |
102 ThreadContext *tc) 103{ 104 int index = 0; 105 unsigned op = process->getSyscallArg(tc, index); 106 Addr bufPtr = process->getSyscallArg(tc, index); 107 // unsigned nbytes = process->getSyscallArg(tc, index); 108 109 switch (op) { --- 13 unchanged lines hidden (view full) --- 123 abort(); 124 break; 125 } 126 127 return 1; 128} 129 130static SyscallReturn | 102 ThreadContext *tc) 103{ 104 int index = 0; 105 unsigned op = process->getSyscallArg(tc, index); 106 Addr bufPtr = process->getSyscallArg(tc, index); 107 // unsigned nbytes = process->getSyscallArg(tc, index); 108 109 switch (op) { --- 13 unchanged lines hidden (view full) --- 123 abort(); 124 break; 125 } 126 127 return 1; 128} 129 130static SyscallReturn |
131setThreadAreaFunc(SyscallDesc *desc, int callnum, LiveProcess *process, | 131setThreadAreaFunc(SyscallDesc *desc, int callnum, Process *process, |
132 ThreadContext *tc) 133{ 134 int index = 0; 135 Addr addr = process->getSyscallArg(tc, index); 136 tc->setMiscRegNoEffect(MISCREG_TP_VALUE, addr); 137 return 0; 138} 139 --- 315 unchanged lines hidden (view full) --- 455 /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc), 456 /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc), 457 /* 316 */ SyscallDesc("utimensat", unimplementedFunc), 458 /* 317 */ SyscallDesc("signalfd", unimplementedFunc), 459 /* 318 */ SyscallDesc("timerfd", unimplementedFunc), 460 /* 319 */ SyscallDesc("eventfd", unimplementedFunc) 461}; 462 | 132 ThreadContext *tc) 133{ 134 int index = 0; 135 Addr addr = process->getSyscallArg(tc, index); 136 tc->setMiscRegNoEffect(MISCREG_TP_VALUE, addr); 137 return 0; 138} 139 --- 315 unchanged lines hidden (view full) --- 455 /* 314 */ SyscallDesc("ioprio_set", unimplementedFunc), 456 /* 315 */ SyscallDesc("ioprio_get", unimplementedFunc), 457 /* 316 */ SyscallDesc("utimensat", unimplementedFunc), 458 /* 317 */ SyscallDesc("signalfd", unimplementedFunc), 459 /* 318 */ SyscallDesc("timerfd", unimplementedFunc), 460 /* 319 */ SyscallDesc("eventfd", unimplementedFunc) 461}; 462 |
463MipsLinuxProcess::MipsLinuxProcess(LiveProcessParams * params, 464 ObjectFile *objFile) 465 : MipsLiveProcess(params, objFile), 466 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) | 463MipsLinuxProcess::MipsLinuxProcess(ProcessParams * params, 464 ObjectFile *objFile) 465 : MipsProcess(params, objFile), 466 Num_Syscall_Descs(sizeof(syscallDescs) / sizeof(SyscallDesc)) |
467{ } 468 469SyscallDesc* 470MipsLinuxProcess::getDesc(int callnum) 471{ 472 //MIPS32 syscalls are in the range of 4000 - 4999 473 int m5_sys_idx = callnum - 4000; 474 475 if (m5_sys_idx < 0 || m5_sys_idx >= Num_Syscall_Descs) 476 return NULL; 477 478 return &syscallDescs[m5_sys_idx]; 479} 480 481 482 483 484 | 467{ } 468 469SyscallDesc* 470MipsLinuxProcess::getDesc(int callnum) 471{ 472 //MIPS32 syscalls are in the range of 4000 - 4999 473 int m5_sys_idx = callnum - 4000; 474 475 if (m5_sys_idx < 0 || m5_sys_idx >= Num_Syscall_Descs) 476 return NULL; 477 478 return &syscallDescs[m5_sys_idx]; 479} 480 481 482 483 484 |