[dv] Rewrite dpi_memutil to avoid exceptions#30397
Open
RKNAGA18 wants to merge 2 commits into
Open
Conversation
This replaces the privileged `ip netns` setup with an unprivileged `unshare` user and network namespace, allowing the airgapped build test to run successfully on GCP containerized runners without requiring host-level CAP_NET_ADMIN capabilities. Note: Local testing confirms the unshare namespace successfully blocks network access (yielding the expected Unknown Host errors when the offline cache is missing dependencies). Fixes lowRISC#19512 Signed-off-by: RKNAGA18 <rknarjun396@gmail.com>
This replaces the internal ElfError exception class and std::runtime_error throws with boolean return codes and standard error logging, adhering to the project's exception-free C++ style guide. Fixes lowRISC#5801
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR continues the effort to remove C++ exceptions from the Verilator support infrastructure to comply with the project's C++ style guide.
Specifically, this targets the memory utility bridging files (
hw/dv/verilator/cpp/dpi_memutil.ccanddpi_memutil.h).Changes Made
ElfErrorclass.ElfFileclass to use an empty constructor and a newbool Load()method, preventing exceptions during object instantiation.RegisterMemoryArea()andStageElf()to returnboolsuccess flags instead of throwingstd::runtime_error.throwstatements with explicitstd::cerrerror prints and safe returns.GetMemImageTypeByNameto returnkMemImageUnknownon failure instead of crashing.Testing
./bazelisk.sh build //hw/ip/otbn/...Fixes #5801