-
Notifications
You must be signed in to change notification settings - Fork 60
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
Implement Kernel
syscall.*
wrappers
#173
Comments
I think we can address this issue in the context of another issue. Specifically, we will probably want to cleanly separate "internal" from "user-facing" procedures so that users don't need to know when to use One idea described in #89 (comment) is to move most (all?) modules in
I think this will get us only partially there, and we'll need to modify this idea somewhat. The properties we want to achieve are as follows:
One way to achieve the above is to put extra logic into procedures defined in First, the user-facing
And
Basically, the user-facing wrapper pads the stack as needed (and may do other input processing) and makes the Kernel procedures would also be the right place to enforce access control logic. For example, in
I think the above would work fairly well, except for one downside: when we make updates, we'll need to update the entire procedure chain starting from user-facing procedures, to kernel procedures, to the internal procedures. But hopefully, such changes would be not very frequent. |
This makes sense to me. One thing we may also want to consider in the context of this change is the visibility / scope of procedures. We probably don't want any of the |
Yes, there is an issue for this already: 0xPolygonMiden/miden-vm#822 and I've been thinking about it. However, at of yet I haven't found a way to do this without adding quite a bit of complexity to the assembler. One of this issues is how procedure cache works. Once a procedure is in procedure cache, it can be called by any other procedure either by name, alias, or MAST root. So, technically, even non-exported procedures may be referenced right now if there were added to the procedure cache (this could happen under some conditions). |
Something that hasn't been detailed in proposal above is the way in which account procedure are invoked using the |
I think for accounts this will be a bit more challenging - or at least we won't be able to hide the complexity as easily. So, we'll need to come up with a convention which others would need to follow. There are several ways to do it. For example:
There could be some other options too. |
I think these are both viable options. I wonder if we could provide first class support for this in the |
closed by #174. |
One of the constraints the virtual machine implements when exiting from a context is that the number of elements on the stack must be exactly 16. This has implications for
syscall
invocations where thesyscall
procedure returns more elements than it consumes. E.g. consumes one elmenent from the stack and returns 4. To address this we should add a prologue in thesyscall.*
wrapper that adds additional padding the top of the stack before the kernel procedure is invoked to ensure that unintended data is not overwritten.Additionally
syscall
procedures should account for the fact that when the stack depth is 16 and items are dropped this results in 0's being padded to the bottom of the stack. If we need to return less elements then we consume then we should pad the top of the stack before exiting the root context.The text was updated successfully, but these errors were encountered: