syscall_emul.cc (11379:bfe4c2a8ad36) | syscall_emul.cc (11380:3370547fa302) |
---|---|
1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37#include <string> 38 39#include "arch/utility.hh" 40#include "base/chunk_generator.hh" 41#include "base/trace.hh" 42#include "config/the_isa.hh" 43#include "cpu/base.hh" 44#include "cpu/thread_context.hh" | 1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 28 unchanged lines hidden (view full) --- 37#include <string> 38 39#include "arch/utility.hh" 40#include "base/chunk_generator.hh" 41#include "base/trace.hh" 42#include "config/the_isa.hh" 43#include "cpu/base.hh" 44#include "cpu/thread_context.hh" |
45#include "debug/SyscallBase.hh" |
|
45#include "debug/SyscallVerbose.hh" 46#include "mem/page_table.hh" 47#include "sim/process.hh" 48#include "sim/sim_exit.hh" 49#include "sim/syscall_emul.hh" 50#include "sim/system.hh" 51 52using namespace std; 53using namespace TheISA; 54 55void 56SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc) 57{ | 46#include "debug/SyscallVerbose.hh" 47#include "mem/page_table.hh" 48#include "sim/process.hh" 49#include "sim/sim_exit.hh" 50#include "sim/syscall_emul.hh" 51#include "sim/system.hh" 52 53using namespace std; 54using namespace TheISA; 55 56void 57SyscallDesc::doSyscall(int callnum, LiveProcess *process, ThreadContext *tc) 58{ |
58 if (DTRACE(SyscallVerbose)) { | 59 if (DTRACE(SyscallBase)) { |
59 int index = 0; | 60 int index = 0; |
60 IntReg arg[4] M5_VAR_USED; | 61 IntReg arg[6] M5_VAR_USED; |
61 62 // we can't just put the calls to getSyscallArg() in the 63 // DPRINTF arg list, because C++ doesn't guarantee their order | 62 63 // we can't just put the calls to getSyscallArg() in the 64 // DPRINTF arg list, because C++ doesn't guarantee their order |
64 for (int i = 0; i < 4; ++i) | 65 for (int i = 0; i < 6; ++i) |
65 arg[i] = process->getSyscallArg(tc, index); 66 | 66 arg[i] = process->getSyscallArg(tc, index); 67 |
67 DPRINTFNR("%d: %s: syscall %s called w/arguments %d,%d,%d,%d\n", 68 curTick(), tc->getCpuPtr()->name(), name, 69 arg[0], arg[1], arg[2], arg[3]); | 68 // Linux supports up to six system call arguments through registers 69 // so we want to print all six. Check to the relevant man page to 70 // verify how many are actually used by a given system call. 71 DPRINTF_SYSCALL(Base, 72 "%s called w/arguments %d, %d, %d, %d, %d, %d\n", 73 name, arg[0], arg[1], arg[2], arg[3], arg[4], 74 arg[5]); |
70 } 71 72 SyscallReturn retval = (*funcPtr)(this, callnum, process, tc); 73 74 if (retval.needsRetry()) { | 75 } 76 77 SyscallReturn retval = (*funcPtr)(this, callnum, process, tc); 78 79 if (retval.needsRetry()) { |
75 DPRINTFS(SyscallVerbose, tc->getCpuPtr(), "syscall %s needs retry\n", 76 name); | 80 DPRINTF_SYSCALL(Base, "%s needs retry\n", name); |
77 } else { | 81 } else { |
78 DPRINTFS(SyscallVerbose, tc->getCpuPtr(), "syscall %s returns %d\n", 79 name, retval.encodedValue()); | 82 DPRINTF_SYSCALL(Base, "%s returns %d\n", name, 83 retval.encodedValue()); |
80 } 81 82 if (!(flags & SyscallDesc::SuppressReturnValue) && !retval.needsRetry()) 83 process->setSyscallReturn(tc, retval); 84} 85 86 87SyscallReturn --- 108 unchanged lines hidden (view full) --- 196 size_needed = PageBytes - size_needed; 197 tp.memsetBlob(next_page, zero, size_needed); 198 } 199 } 200 } 201 } 202 203 p->brk_point = new_brk; | 84 } 85 86 if (!(flags & SyscallDesc::SuppressReturnValue) && !retval.needsRetry()) 87 process->setSyscallReturn(tc, retval); 88} 89 90 91SyscallReturn --- 108 unchanged lines hidden (view full) --- 200 size_needed = PageBytes - size_needed; 201 tp.memsetBlob(next_page, zero, size_needed); 202 } 203 } 204 } 205 } 206 207 p->brk_point = new_brk; |
204 DPRINTF(SyscallVerbose, "Break Point changed to: %#X\n", p->brk_point); | 208 DPRINTF_SYSCALL(Verbose, "brk: break point changed to: %#X\n", 209 p->brk_point); |
205 return p->brk_point; 206} 207 208 209SyscallReturn 210closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 211{ 212 int index = 0; --- 740 unchanged lines hidden --- | 210 return p->brk_point; 211} 212 213 214SyscallReturn 215closeFunc(SyscallDesc *desc, int num, LiveProcess *p, ThreadContext *tc) 216{ 217 int index = 0; --- 740 unchanged lines hidden --- |