process.cc (11800:54436a1784dc) process.cc (11806:ada5603bdb1c)
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

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

212 ThreadContext *tc = system->getThreadContext(contextIds[0]);
213 tc->setIntReg(StackPointerReg, stack_min);
214 tc->pcState(getStartPC());
215}
216
217RiscvISA::IntReg
218RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
219{
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

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

212 ThreadContext *tc = system->getThreadContext(contextIds[0]);
213 tc->setIntReg(StackPointerReg, stack_min);
214 tc->pcState(getStartPC());
215}
216
217RiscvISA::IntReg
218RiscvLiveProcess::getSyscallArg(ThreadContext *tc, int &i)
219{
220 return tc->readIntReg(SyscallArgumentRegs[i++]);
220 // RISC-V only has four system call argument registers by convention, so
221 // if a larger index is requested return 0
222 RiscvISA::IntReg retval = 0;
223 if (i < 4)
224 retval = tc->readIntReg(SyscallArgumentRegs[i]);
225 i++;
226 return retval;
221}
222
223void
224RiscvLiveProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val)
225{
226 tc->setIntReg(SyscallArgumentRegs[i], val);
227}
228
229void
230RiscvLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
231{
232 if (sysret.successful()) {
233 // no error
234 tc->setIntReg(SyscallPseudoReturnReg, sysret.returnValue());
235 } else {
236 // got an error, return details
237 tc->setIntReg(SyscallPseudoReturnReg, sysret.errnoValue());
238 }
239}
227}
228
229void
230RiscvLiveProcess::setSyscallArg(ThreadContext *tc, int i, RiscvISA::IntReg val)
231{
232 tc->setIntReg(SyscallArgumentRegs[i], val);
233}
234
235void
236RiscvLiveProcess::setSyscallReturn(ThreadContext *tc, SyscallReturn sysret)
237{
238 if (sysret.successful()) {
239 // no error
240 tc->setIntReg(SyscallPseudoReturnReg, sysret.returnValue());
241 } else {
242 // got an error, return details
243 tc->setIntReg(SyscallPseudoReturnReg, sysret.errnoValue());
244 }
245}