process.cc (13028:9a09c342891e) process.cc (13612:12ae022f3a30)
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * Copyright (c) 2016 The University of Virginia
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

--- 205 unchanged lines hidden (view full) ---

214
215 ThreadContext *tc = system->getThreadContext(contextIds[0]);
216 tc->setIntReg(StackPointerReg, memState->getStackMin());
217 tc->pcState(getStartPC());
218
219 memState->setStackMin(roundDown(memState->getStackMin(), pageSize));
220}
221
1/*
2 * Copyright (c) 2004-2005 The Regents of The University of Michigan
3 * Copyright (c) 2016 The University of Virginia
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

--- 205 unchanged lines hidden (view full) ---

214
215 ThreadContext *tc = system->getThreadContext(contextIds[0]);
216 tc->setIntReg(StackPointerReg, memState->getStackMin());
217 tc->pcState(getStartPC());
218
219 memState->setStackMin(roundDown(memState->getStackMin(), pageSize));
220}
221
222RiscvISA::IntReg
222RegVal
223RiscvProcess::getSyscallArg(ThreadContext *tc, int &i)
224{
225 // If a larger index is requested than there are syscall argument
226 // registers, return 0
223RiscvProcess::getSyscallArg(ThreadContext *tc, int &i)
224{
225 // If a larger index is requested than there are syscall argument
226 // registers, return 0
227 RiscvISA::IntReg retval = 0;
227 RegVal retval = 0;
228 if (i < SyscallArgumentRegs.size())
229 retval = tc->readIntReg(SyscallArgumentRegs[i]);
230 i++;
231 return retval;
232}
233
234void
228 if (i < SyscallArgumentRegs.size())
229 retval = tc->readIntReg(SyscallArgumentRegs[i]);
230 i++;
231 return retval;
232}
233
234void
235RiscvProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val)
235RiscvProcess::setSyscallArg(ThreadContext *tc, int i, RegVal val)
236{
237 tc->setIntReg(SyscallArgumentRegs[i], val);
238}
239
240void
241RiscvProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
242{
243 if (sysret.successful()) {
244 // no error
245 tc->setIntReg(SyscallPseudoReturnReg, sysret.returnValue());
246 } else {
247 // got an error, return details
248 tc->setIntReg(SyscallPseudoReturnReg, sysret.errnoValue());
249 }
250}
236{
237 tc->setIntReg(SyscallArgumentRegs[i], val);
238}
239
240void
241RiscvProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
242{
243 if (sysret.successful()) {
244 // no error
245 tc->setIntReg(SyscallPseudoReturnReg, sysret.returnValue());
246 } else {
247 // got an error, return details
248 tc->setIntReg(SyscallPseudoReturnReg, sysret.errnoValue());
249 }
250}