From e5fe2b82b7cf8842a5a202da69c003d2a2c6af3f Mon Sep 17 00:00:00 2001 From: Brandon Potter Date: Wed, 1 Mar 2017 13:18:49 -0600 Subject: style: Correct some style issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This changeset fixes line alignment issues, spacing, spelling, etc. for files that are used during SE Mode. Change-Id: Ie61b8d0eb4ebb5af554d72f1297808027833616e Reviewed-on: https://gem5-review.googlesource.com/2264 Maintainer: Jason Lowe-Power Reviewed-by: Tony Gutierrez Reviewed-by: Michael LeBeane Reviewed-by: Andreas Sandberg Reviewed-by: Pierre-Yves PĂ©neau --- src/sim/process.cc | 2 +- src/sim/syscall_emul.cc | 32 +++++++++++++++---------------- src/sim/syscall_emul.hh | 51 ++++++++++++++++++++++++------------------------- 3 files changed, 41 insertions(+), 44 deletions(-) (limited to 'src/sim') diff --git a/src/sim/process.cc b/src/sim/process.cc index e516e2a05..71f398893 100644 --- a/src/sim/process.cc +++ b/src/sim/process.cc @@ -340,7 +340,7 @@ Process::fixupStackFault(Addr vaddr) fatal("Maximum stack size exceeded\n"); allocateMem(stack_min, TheISA::PageBytes); inform("Increasing stack size by one page."); - }; + } memState->setStackMin(stack_min); return true; } diff --git a/src/sim/syscall_emul.cc b/src/sim/syscall_emul.cc index f61de229c..2459c801f 100644 --- a/src/sim/syscall_emul.cc +++ b/src/sim/syscall_emul.cc @@ -177,8 +177,7 @@ brkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) tp.memsetBlob(gen.addr(), zero, size_needed); if (gen.addr() + PageBytes > next_page && next_page < new_brk && - p->pTable->translate(next_page)) - { + p->pTable->translate(next_page)) { size_needed = PageBytes - size_needed; tp.memsetBlob(next_page, zero, size_needed); } @@ -218,7 +217,7 @@ readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); - Addr bufPtr = p->getSyscallArg(tc, index); + Addr buf_ptr = p->getSyscallArg(tc, index); int nbytes = p->getSyscallArg(tc, index); auto hbfdp = std::dynamic_pointer_cast((*p->fds)[tgt_fd]); @@ -226,7 +225,7 @@ readFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) return -EBADF; int sim_fd = hbfdp->getSimFD(); - BufferArg bufArg(bufPtr, nbytes); + BufferArg bufArg(buf_ptr, nbytes); int bytes_read = read(sim_fd, bufArg.bufferPtr(), nbytes); if (bytes_read > 0) @@ -240,7 +239,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; int tgt_fd = p->getSyscallArg(tc, index); - Addr bufPtr = p->getSyscallArg(tc, index); + Addr buf_ptr = p->getSyscallArg(tc, index); int nbytes = p->getSyscallArg(tc, index); auto hbfdp = std::dynamic_pointer_cast((*p->fds)[tgt_fd]); @@ -248,7 +247,7 @@ writeFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) return -EBADF; int sim_fd = hbfdp->getSimFD(); - BufferArg bufArg(bufPtr, nbytes); + BufferArg bufArg(buf_ptr, nbytes); bufArg.copyIn(tc->getMemProxy()); int bytes_written = write(sim_fd, bufArg.bufferPtr(), nbytes); @@ -324,9 +323,9 @@ SyscallReturn gethostnameFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int index = 0; - Addr bufPtr = p->getSyscallArg(tc, index); + Addr buf_ptr = p->getSyscallArg(tc, index); int name_len = p->getSyscallArg(tc, index); - BufferArg name(bufPtr, name_len); + BufferArg name(buf_ptr, name_len); strncpy((char *)name.bufferPtr(), hostname, name_len); @@ -340,9 +339,9 @@ getcwdFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) { int result = 0; int index = 0; - Addr bufPtr = p->getSyscallArg(tc, index); + Addr buf_ptr = p->getSyscallArg(tc, index); unsigned long size = p->getSyscallArg(tc, index); - BufferArg buf(bufPtr, size); + BufferArg buf(buf_ptr, size); // Is current working directory defined? string cwd = p->getcwd(); @@ -386,10 +385,10 @@ readlinkFunc(SyscallDesc *desc, int num, Process *p, ThreadContext *tc, // Adjust path for current working directory path = p->fullPath(path); - Addr bufPtr = p->getSyscallArg(tc, index); + Addr buf_ptr = p->getSyscallArg(tc, index); size_t bufsiz = p->getSyscallArg(tc, index); - BufferArg buf(bufPtr, bufsiz); + BufferArg buf(buf_ptr, bufsiz); int result = -1; if (path != "/proc/self/exe") { @@ -539,7 +538,7 @@ truncate64Func(SyscallDesc *desc, int num, string path; if (!tc->getMemProxy().tryReadString(path, process->getSyscallArg(tc, index))) - return -EFAULT; + return -EFAULT; int64_t length = process->getSyscallArg(tc, index, 64); @@ -729,7 +728,6 @@ fcntl64Func(SyscallDesc *desc, int num, Process *p, ThreadContext *tc) // to the underlying OS warn("fcntl64(%d, %d) passed through to host\n", tgt_fd, cmd); return fcntl(sim_fd, cmd); - // return 0; } } @@ -823,8 +821,8 @@ getuidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, // simulation to be deterministic. // EUID goes in r20. - tc->setIntReg(SyscallPseudoReturnReg, process->euid()); //EUID - return process->uid(); // UID + tc->setIntReg(SyscallPseudoReturnReg, process->euid()); // EUID + return process->uid(); // UID } @@ -833,7 +831,7 @@ getgidPseudoFunc(SyscallDesc *desc, int callnum, Process *process, ThreadContext *tc) { // Get current group ID. EGID goes in r20. - tc->setIntReg(SyscallPseudoReturnReg, process->egid()); //EGID + tc->setIntReg(SyscallPseudoReturnReg, process->egid()); // EGID return process->gid(); } diff --git a/src/sim/syscall_emul.hh b/src/sim/syscall_emul.hh index 8cca6ebcb..099ff58d9 100644 --- a/src/sim/syscall_emul.hh +++ b/src/sim/syscall_emul.hh @@ -285,8 +285,8 @@ SyscallReturn accessFunc(SyscallDesc *desc, int num, int index); /// Futex system call -/// Implemented by Daniel Sanchez -/// Used by printf's in multi-threaded apps +/// Implemented by Daniel Sanchez +/// Used by printf's in multi-threaded apps template SyscallReturn futexFunc(SyscallDesc *desc, int callnum, Process *process, @@ -477,7 +477,7 @@ convertStatBuf(target_stat &tgt, host_stat *host, bool fakeTTY = false) tgt->st_mtimeX = TheISA::htog(tgt->st_mtimeX); tgt->st_ctimeX = host->st_ctime; tgt->st_ctimeX = TheISA::htog(tgt->st_ctimeX); - // Force the block size to be 8k. This helps to ensure buffered io works + // Force the block size to be 8KB. This helps to ensure buffered io works // consistently across different hosts. tgt->st_blksize = 0x2000; tgt->st_blksize = TheISA::htog(tgt->st_blksize); @@ -508,11 +508,11 @@ convertStat64Buf(target_stat &tgt, host_stat64 *host, bool fakeTTY = false) #endif } -//Here are a couple convenience functions +// Here are a couple of convenience functions template static void copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr, - hst_stat *host, bool fakeTTY = false) + hst_stat *host, bool fakeTTY = false) { typedef TypedBufferArg tgt_stat_buf; tgt_stat_buf tgt(addr); @@ -523,7 +523,7 @@ copyOutStatBuf(SETranslatingPortProxy &mem, Addr addr, template static void copyOutStat64Buf(SETranslatingPortProxy &mem, Addr addr, - hst_stat64 *host, bool fakeTTY = false) + hst_stat64 *host, bool fakeTTY = false) { typedef TypedBufferArg tgt_stat_buf; tgt_stat_buf tgt(addr); @@ -1604,24 +1604,24 @@ getrlimitFunc(SyscallDesc *desc, int callnum, Process *process, TypedBufferArg rlp(process->getSyscallArg(tc, index)); switch (resource) { - case OS::TGT_RLIMIT_STACK: - // max stack size in bytes: make up a number (8MB for now) - rlp->rlim_cur = rlp->rlim_max = 8 * 1024 * 1024; - rlp->rlim_cur = TheISA::htog(rlp->rlim_cur); - rlp->rlim_max = TheISA::htog(rlp->rlim_max); - break; - - case OS::TGT_RLIMIT_DATA: - // max data segment size in bytes: make up a number - rlp->rlim_cur = rlp->rlim_max = 256 * 1024 * 1024; - rlp->rlim_cur = TheISA::htog(rlp->rlim_cur); - rlp->rlim_max = TheISA::htog(rlp->rlim_max); - break; - - default: - warn("getrlimit: unimplemented resource %d", resource); - return -EINVAL; - break; + case OS::TGT_RLIMIT_STACK: + // max stack size in bytes: make up a number (8MB for now) + rlp->rlim_cur = rlp->rlim_max = 8 * 1024 * 1024; + rlp->rlim_cur = TheISA::htog(rlp->rlim_cur); + rlp->rlim_max = TheISA::htog(rlp->rlim_max); + break; + + case OS::TGT_RLIMIT_DATA: + // max data segment size in bytes: make up a number + rlp->rlim_cur = rlp->rlim_max = 256 * 1024 * 1024; + rlp->rlim_cur = TheISA::htog(rlp->rlim_cur); + rlp->rlim_max = TheISA::htog(rlp->rlim_max); + break; + + default: + warn("getrlimit: unimplemented resource %d", resource); + return -EINVAL; + break; } rlp.copyOut(tc->getMemProxy()); @@ -1703,8 +1703,7 @@ utimesFunc(SyscallDesc *desc, int callnum, Process *process, tp.copyIn(tc->getMemProxy()); struct timeval hostTimeval[2]; - for (int i = 0; i < 2; ++i) - { + for (int i = 0; i < 2; ++i) { hostTimeval[i].tv_sec = TheISA::gtoh((*tp)[i].tv_sec); hostTimeval[i].tv_usec = TheISA::gtoh((*tp)[i].tv_usec); } -- cgit v1.2.3