-# 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
"Standard output (stdout for gem5's terminal)")
stderr = Param.String("stderr",
"Standard error (stderr for gem5's terminal)")
+ files_root_dir = Param.String("",
+ "Host root directory for files handled by Semihosting")
mem_reserve = Param.MemorySize("32MB",
"Amount of memory to reserve at the start of the address map. This "
/*
- * 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
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 ?
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);
/*
- * 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
FILE *file;
};
+ std::string filesRootDir;
std::vector<std::unique_ptr<FileBase>> files;
FILE *stdin;
FILE *stdout;