-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
X/C Buffers #229
X/C Buffers #229
Conversation
c4048b2
to
1c9da0e
Compare
IPC Type-X: Prevent multiple writes to a C-buffer?Do I need to prevent multiple writes to the same buffer ID? In theory, I could use coff as a bitmap of used buffers, and prevent reuse this way, but I'm unsure of how the nintendo switch behaves here. This comment was generated by todo based on a
|
Move pack to a non-generic functionRight now the pack and unpack functions are duplicated for every instanciation of Message. This probably has a huge penalty on codesize. We should make a function taking everything as slices instead This comment was generated by todo based on a
|
Pointer Buf should take its size as a generic parameter.The Pointer Buffer size should be configurable by the sysmodule. We'll wait for const generics to do it however, as otherwise we'd have to bend over backwards with typenum. This comment was generated by todo based on a
|
buf_map: Check that from_mem has the right permissionsbuf_map currently remaps without checking the permissions. This could allow a user to read non-user-accessible memory, or write to non-writable memory. This comment was generated by todo based on a
|
25fa8d8
to
f3f808f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Use plain to ensure T is a valid POD typePlain would give us two benefits: it would do the alignment and size checks for us, and it would give a type-system guarantee that our T is valid for any arbitrary type. This comment was generated by todo based on a
|
We add a new function, share_existing_mapping, which turns an existing Normal mapping into a Shared mapping, without removing it from the page table, avoiding potential race conditions.
Introduce the InPointer and InBuffer types, which are smart pointers representing a specific kind of IPC Buffer for an IPC Server. Introduce two functions to pop those buffers: Message::pop_in_pointer and Message::pop_in_buffer. Add functions to push in and out pointers (type-C and type-X).
We do lots of shifting operations on the address and sizes. Unfortunately, it's come to my attention that x1 >> x2 has a completely broken behavior if x2 is higher than the bitwidth of x1 (instead of returning the obvious 0). This breaks the implementation on 32-bit. To remediate this, we simply move all the addresses and sizes to u64.
Instead of panicking in find_ty_cmdid, we return None. The server will then return the appropriate error.
For now, the C Buffer size is hardcoded to 0x300. In the future, that should probably be a const generic.
Check that the address/size of the x and buffer fits an usize.
Buffer should check that the address has the correct alignment for the type T, otherwise we might get some nasty UB.
Support for IPC buffers.