Skip to content

detecting unsupported ECALLs and test checking improvements #374

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

kpgriesser
Copy link
Collaborator

@kpgriesser kpgriesser commented Jun 14, 2025

The majority of ecall routines perform no operation but return 'SUCCESS'. This can lead to a false sense of security when writing RV code for REV that that does system calls that are essentially NOPs. This PR provides a compile time overridable macro to print an error string for these ECALLs. Originally I was going to make this a fatal error but it would have required adding a compile pragma to suppress the 'maybe no return' compiler warning. Also, I thought other projects might be running code with a rich mix of 'NOP' system calls that would not appreciate these kinds of failures. In the worst case, we can revert to NOP functionality using CMAKE_CXX_FLAGS = -D _REV_ECALL_OVERRIDE.

For regression testing, the test/CMakeList.txt was updated to provide a fail regular expression that detects these kinds of error strings. I ran the regressions on Ubuntu and MacOs as well as for both Debug and Release compilations and all current tests continue to pass.

I should also mention that the error string check is added to allow self checking tests to print error strings to the log file (standing for console output for now) and generate a regression test failure that is independent from the simulation return status code

@@ -29,7 +29,7 @@
parser.add_argument("--machine", help="Machine type/configuration", default="[CORES:RV64GC]")
parser.add_argument("--args", help="Command line arguments to pass to the target executable", default="")
parser.add_argument("--startSymbol", help="ELF Symbol Rev should begin execution at", default="[0:main]")
parser.add_argument("--trcStartCycle", help="Starting cycle for rev tracer [default: 0 (off)]")
parser.add_argument("--trcStartCycle", help="Starting cycle for rev tracer [default: 0 (off)]", default=0)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not related to the PR. Not having the default value causes SST to error out if trcStartCycle is not set because it is set to Python 'None' type. The default=0 disables the tracer

@@ -62,6 +68,7 @@ EcallStatus RevCore::ECALL_io_setup() {
output->verbose(
CALL_INFO, 2, 0, "ECALL: io_setup called by thread %" PRIu32 " on hart %" PRIu32 "\n", ActiveThreadID, HartToExecID
);
UNIMPLEMENTED_BEHAVIOR;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UNIMPLEMENTED();

would seem better.

@leekillough
Copy link
Collaborator

Also note that I am getting a strange error in Release builds but not in Debug builds:

FATAL:  SST Core: can't find requested element library 'Statistic' with element type 'sst.AccumulatorStatistic'

It happens with RevMem tests (--enableMemH=0), which is strange, because sst.AccumulatorStatistic is not used unless MemH is enabled.

@kpgriesser kpgriesser requested a review from leekillough June 16, 2025 16:24
@kpgriesser
Copy link
Collaborator Author

@leekillough I've merged your requested changes and retested on Mac and ubuntu for Release and Debug builds. Everything appears to be passing. Are you still seeing failures for --enabledMemH=0?

Copy link
Collaborator

@leekillough leekillough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It passes with both Debug and Release builds with my latest tests

…nt an error string but will continue the simulation. For regression testing, ctest will now search for a fail string. Minor unrelated change to SDL to provide default value for trcStartCycle
@kpgriesser kpgriesser merged commit 69647cf into devel Jun 17, 2025
@kpgriesser kpgriesser deleted the badsyscall branch June 17, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants