I don't think (2) is acceptable in Tock 2, because it would be a breaking change. However, I don't think we need to add as many new return variants as (1) proposes. I don't think we care about any platforms where address offsets may exceed 2 GiB (correct me if I am wrong), so we can pack offsets into i32/u32 even on our 64-bit platforms. Therefore, I think the only return variants we need to add are:
- SuccessWithMetaPtr: Used by Memops 1-9.
- SuccessWith2MetaPtr: Used by Subscribe and all three Allows.
- FailureWith2MetaPtr Used by Subscribe and all three Allows.
We would keep the current return variants for all currently-stabilized system calls on 32-bit non-CHERI platforms, and use the new return variants on all other platforms (including all 64-bit and CHERI). That keeps backwards-compatibility on platforms that Tock 2 currently supports while providing better semantics on 64-bit and CHERI platforms.
For Tock 3, it might make sense to go somewhat further than just u32, u64, usize, and MetaPtr. How about signed integer, floats, bool, etc? It would be nice if the system call layer could indicate that
the button upcall receives a (u32, bool) and the
temperature reading upcall receives an i32 (this isn't in the documentation), rather than pretending that all upcalls receive (u32, u32, u32).