Currently all syscalls are being handled in a single syscall handler, which won't be too scalable considering that there are a total number of ~700 syscalls in Besta RTOS and some may require more than a few lines of code to handle.
We should make it more scalable by allowing routing a syscall to the appropriate handler modules/classes.
Proposed solution
Breaking syscall handler into different classes and have a special handler that dispatch syscalls to its children
Use a decorator class to wrap around syscall handler methods so they can be automatically indexed by the class itself by inspecting all methods.
Also declare syscall signature using the decorator.
Some initial work is already done in SyscallDefinition
The handler classes shall
implement the process() method that either
handles the host-guest data conversion, calls the corresponding handler with the decoded parameters, and pass the return value back to the guest.
forwards the request to its children.
process() for handler classes shall not handle syscall to function call transform (i.e. converting stack frame format and setting PC after function returns). This should be handled by the top level SVC handler.
Implement a method that allows its parent to index it.
Problem
Currently all syscalls are being handled in a single syscall handler, which won't be too scalable considering that there are a total number of ~700 syscalls in Besta RTOS and some may require more than a few lines of code to handle.
We should make it more scalable by allowing routing a syscall to the appropriate handler modules/classes.
Proposed solution
SyscallDefinition
process()
method that eitherprocess()
for handler classes shall not handle syscall to function call transform (i.e. converting stack frame format and setting PC after function returns). This should be handled by the top level SVC handler.