diff options
Diffstat (limited to 'src/arch/arm/semihosting.cc')
-rw-r--r-- | src/arch/arm/semihosting.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/arch/arm/semihosting.cc b/src/arch/arm/semihosting.cc index 2fe5373b8..a0c865d8b 100644 --- a/src/arch/arm/semihosting.cc +++ b/src/arch/arm/semihosting.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 ARM Limited + * Copyright (c) 2018, 2019 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -138,6 +138,9 @@ ArmSemihosting::ArmSemihosting(const ArmSemihostingParams *p) timeBase([p]{ struct tm t = p->time; return mkutctime(&t); }()), tickShift(calcTickShift()), semiErrno(0), + filesRootDir(!p->files_root_dir.empty() && + p->files_root_dir.back() != '/' ? + p->files_root_dir + '/' : p->files_root_dir), stdin(getSTDIO("stdin", p->stdin, "r")), stdout(getSTDIO("stdout", p->stdout, "w")), stderr(p->stderr == p->stdout ? @@ -291,6 +294,8 @@ ArmSemihosting::callOpen(ThreadContext *tc, bool aarch64, return retError(EINVAL); std::string fname = readString(tc, name_base, name_size); + if (!fname.empty() && fname.front() != '/') + fname = filesRootDir + fname; std::unique_ptr<ArmSemihosting::FileBase> file = FileBase::create(*this, fname, mode); |