aboutsummaryrefslogtreecommitdiff
path: root/fesvr
AgeCommit message (Collapse)AuthorFilesLines
2024-05-29add support to load ET_DYN elfClément Léger6-14/+25
When compiled as PIE, executable can be loaded at any memory address. Lately, OpenSBI switched to such behavior and spike was not able to load it anymore. This patch add an additional load_offset parameter for load_elf(). This load_offset value is passed as DRAM_BASE and used only for ET_DYN elfs. Signed-off-by: Clément Léger <cleger@rivosinc.com>
2024-03-22Implement syscall readlinkatMing-Yi Lai2-0/+15
2023-11-09fesvr/htif: allow exit on SIGINT.Volodymyr Fialko1-1/+1
Currently signal handler would call exit() only on second received signal, this prevent proper program cleanup. Instead use signal flag to exit loop. Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
2023-10-09Update dtm.h with switch_to_* functionsAbraham Gonzalez1-0/+10
Signed-off-by: Abraham Gonzalez <abe.j.gonza@gmail.com>
2023-08-16Include cerrno in fesvr/elfloader.ccMark Lai1-0/+1
It caused compile error "use of undeclared identifier 'errno'" at line 26 and 33. I Add #include <cerrno> in fesvr/elfloader.cc to fix error and compile successfully.
2023-06-19fesvr: support int128_t/uint128_tGianluca Guida1-0/+7
Also remove now duplicate definition for types.
2023-05-19Add Spike's meta files for pkg-configWojciech Bartczak1-0/+2
This commit adds the *.pc files for Spike's simulation library, enabling dynamic and static linking without the need to directly reference Spike sources. Using Spike as a stand-alone library provides an interesting option for developing tools and applications based on Spike.
2023-04-20Close file descriptors in destructor of syscall_tYinan Xu2-3/+12
2023-04-12Make some dtm_t interfaces protectedJerry Zhao1-8/+10
* This enables useful functionality in inheritors
2023-04-12Unify fesvr/debug_defines.h and riscv/debug_defines.hJerry Zhao2-1478/+60
* fesvr/debug_defines.h is removed
2023-03-15fesvr: fix compilation with gcc 13Julien Olivain1-0/+1
Compiling spike with gcc 13 (for example, included in Fedora 38 prerelease) fails with error: In file included from fesvr/syscall.h:6, from fesvr/syscall.cc:4: fesvr/device.h:15:30: error: ‘uint64_t’ was not declared in this scope 15 | typedef std::function<void(uint64_t)> callback_t; | ^~~~~~~~ This is due to a gcc header dependency change. See for reference: https://gcc.gnu.org/gcc-13/porting_to.html#header-dep-changes This commit explicitly adds the missing <cstdint> header inclusion to fix this build failure. Signed-off-by: Julien Olivain <ju.o@free.fr>
2023-03-07fesvr: Add --symbol-elf flag to populate htif-t::symbol_elfsJerry Zhao2-0/+10
2023-03-07fesvr: Add symbol_elfs field to htif_tJerry Zhao2-0/+17
When populated, symbol_elfs are additional elf files that populate the addr2symbol map in htif
2023-03-07fesvr: Fix brace style in htif_t::load_programJerry Zhao1-11/+9
2023-03-07fesvr: fix +signature-granularity opt parsing to be required_argJerry Zhao1-1/+1
2023-03-07fesvr: Add +target-argument= flag to htif parsingJerry Zhao2-0/+8
2023-03-07fesvr: Fix spacing in parse_argumentsJerry Zhao1-4/+3
2023-03-07fesvr: target_args() should return a constJerry Zhao1-1/+1
2023-03-07make target_args() protected instead of private to allow subclasses to ↵Sagar Karandikar1-2/+1
inject args
2023-02-24fesvr: elfloader: replace asserts after open and mmap by exceptionsViktor Prutyanov1-2/+4
Asserts (especially without a message) aren't human readable way of error reporting. So, replace them by exceptions with messages with errno string.
2023-02-02Make htif->get_to/fromhost_addr methods publicJerry Zhao1-3/+3
2023-01-17Add htif_t tohost/fromhost accessorsJerry Zhao1-0/+3
Signed-off-by: Jerry Zhao <jerryz123@berkeley.edu>
2023-01-16Add more hint when searched path is wrong gr816ox1-0/+6
Delete the old branch and pull a new one, because of a wrong force push. Git is not as easy as I think. Signed-off-by: gr816ox <50945677+gr816ox@users.noreply.github.com>
2022-12-22Remove non-installed header lists from Makefile fragmentsAndrew Waterman1-3/+1
It's just dead code. (Dependences on headers are auto-generated as `.d` files.)
2022-12-15Use relative include paths to support public usage of these headersJerry Zhao1-1/+1
2022-12-15Add config.h includes directly to source files instead of relying on header ↵Jerry Zhao3-0/+3
chaining This step is to ensure that removing config.h out of headers will not cause regressions.
2022-12-15Rename memif_endianness_t to endianness_tJerry Zhao3-11/+11
2022-12-15Pull memif_endianness_t into cfg.hJerry Zhao2-8/+1
2022-10-25Remove set_target_endianness | add --big-endian flagJerry Zhao2-7/+6
Set target endianess in constructors
2022-10-25Remove memif_endianness_undecided, change default to little-endianJerry Zhao1-2/+1
2022-10-04Fixed -Wnon-virtual-dtor warningsJerin Joy1-0/+2
Signed-off-by: Jerin Joy <joy@rivosinc.com>
2022-10-04Silence remaining unused-parameter warningsAndrew Waterman1-0/+4
Suppressing these individually would add too much clutter.
2022-10-04Delete unused parameter in rfb_t::fb_updateAndrew Waterman2-3/+3
2022-10-04Suppress several unused-parameter warnings in fesvrAndrew Waterman4-4/+5
2022-09-20detects the loading of isa-incompatible (i.e. 32 bit code to 64bit HART) ↵Iman Hosseini5-6/+24
code and emits an error message to help avoid unintentionally loading wrong elf.
2022-09-01Substantially increase context_t stack sizeAndrew Waterman1-1/+1
It's nearly free to do so, because it's just virtual address space. @davidbiancolin recently fell into this pit when using context_t with VCS.
2022-07-17remove unnecessary ifdef for RISCV_ENABLE_DUAL_ENDIANWeiwei Li1-8/+0
the default target endian is always little endian: - mmu::is_target_big_endian() return false - sim_t::get_target_endianness() return memif_endianness_little when RISCV_ENABLE_DUAL_ENDIAN macro is undefined
2022-04-07Fix build of dtm.cc on RISC-V targetsAndrew Waterman1-1/+0
We don't actually need encoding.h, so don't include it.
2022-04-06Tick devices even when tohost != 0Andrew Waterman1-9/+10
Fixes regression introduced by 1fea2afbf46d2641d77f2db3d6108e0897431a84 Resolves #964
2022-03-17Improve error message when HTIF accesses invalid memoryAndrew Waterman1-10/+41
...which includes program loading.
2022-03-17Don't respond to invalid HTIF operations with assertion failuresAndrew Waterman1-1/+0
They should cause bad behavior in target land rather than crashing the simulator.
2021-09-23Fix torture signature (#808)John Fang1-0/+2
2021-08-26fesvr: replace use of `std::vector::operator[0]`Saleem Abdulrasool4-41/+41
This replaces multiple uses of `std::vector::operator[]` where the parameter is a constant `0` with the use of C++11's `std::vector::data` method. This fixes the root cause of invalid memory accesses. `std::vector::operator[]` is an unchecked memory access, and when the buffers are zero-sized (that is the buffer container is empty) either due to a 0 padding in the case of elfloader or NULL parameters to syscalls where permitted, the unchecked access may cause an invalid memory access. The use of `std::vector::data` is permitted even in such a case, though the returned memory may not be dereferenced. The general usage of the returned pointer is to pass to `memif_t`, which is careful about 0-sized buffer accesses, and so passing the result of `std::vector::data` is safe. This is theoretically a better access pattern as it also avoids having the compiler to re-materialize the pointer from the de-referenced location.
2021-08-26fesvr: avoid an invalid memory accessSaleem Abdulrasool1-3/+5
`std::vector::operator[]` does not perform a bounds check when accessing the underlying memory. If the length of the padding is 0, this would access an invalid memory location. Guard against this by ensuring that we have any padding to apply by constant hoisting the length computation and checking the value.
2021-08-26fesvr: format `LOAD_ELF` macro (NFC)Saleem Abdulrasool1-43/+50
This simply uses clang-format to reflow the text of the macro, which makes it easier to read and edit.
2021-07-28Significantly speed up compilation with GCCAndrew Waterman1-2/+0
Precompiled headers were broken because they weren't compiled with the same -fPIC setting as the rest of the code. Fix by just making everything use -fPIC.
2021-06-04encoding: udpate and move platform-related define outChih-Min Chao1-1/+1
Signed-off-by: Chih-Min Chao <chihmin.chao@sifive.com>
2021-03-25Fix statx configure checkAndrew Waterman1-1/+1
2021-03-25Fix Ubuntu 16.04 buildAndrew Waterman2-0/+11
Was broken by #681.
2021-03-25Add `statx` syscallhuaixv3-0/+100