doc/wg/core/notes/core-notes-2022-03-04.md
Attendees:
auipc instructions followed by jalr. That loads
an address and then jumps to it, rather than just jumping to it. One of the
optimizations that linker relaxation enables is replacing those two
instructions with a single direct jump instruction.register_bitfields!. You can essentially create a
reference to MMIO memory, which is generally not a great thing to do. Or more
specifically, read from a reference..copy_from_slice() which, from my understanding, is not guaranteed to work
because of the way volatile memory works with MMIO.tock_registers crate creates a reference to a type that has the MMIO memory
inside of it and LLVM can insert arbitrary dereferences to it.usize-sized syscall return values (#2981)usize-sized return values? Jett posted issue #2981 -- he wants to have
FailureUsize and SuccessUsize return variants.usize is 64 bits. You can't really return pointers
from Command anymore. [Editor's note: Alyssa's last sentence was hard to hear]FailureUsize of any sort that allows doing so. That makes it hard to
write code that works on both the 64-bit host emulation platform and a 32-bit
platform that returns pointers.usize variant
always be the u64 variant, and on 32-bit systems just drop the top half.libtock-rs has encountered a similar issue
which I resolved without noticing it. libtock-rs' unit test environment is
portable and runs on 64-bit systems. The advantage we have is number 1,
Command doesn't return pointers -- simply don't support that in libtock-rs.
The other syscall types use like Success with u32, consistent with TRD 104,
and shove pointer-sized values into the registers anyway. It ends up all kind
of working because libtock_unittest and libtock_platform are part of the
same project and have their own ABI between them. The ABI is identical to TRD
104 in the 32-bit case but a little bit different in the 64-bit case. I didn't
even recognize that when I wrote it.[Editor's note: Phil had to leave the meeting at this point]
const_fn_trait_bound stuff to work itself out, but it's been long enough at
this point that I guess would should merge now. We can update again if we want
to.const_fn_trait_bound?asm_sym.const functions in the chip crates,
I think for peripherals?impl From<Option<T>> for const T.bors r+'d the PR, Brad.const contexts that
doesn't use mut refs?OptionalCell, and you
can contain a reference in an OptionalCell or a TakeCell. You may want to
initialize it as empty, and use a const constructor so you can initialize
something as a static mut global, then later the type still needs to be a
mutable reference as it is a global you may change it to a non-None value. I
believe it is less of an issue now because we got rid of a lot of the static mut peripherals, but I'm guessing there's still a couple static mut things
that require const constructors and also contain
OptionalCell/TakeCell/MapCell, which therefore need to have const
constructors. It's maybe possible there's something we can do here, but I
don't think it will be very straightforward..copy_from_slice()". The
problem is that the Rust .copy_from_slice() API is that the slices must be
the same length, and in a lot of cases we don't want that. We want to copy as
much as we can, and then tell me how much you copied, and we'll iterate
anyways because it's event-driven. I tried to add a new API that will handle
all that internally for you. I got a little ways into that and got distracted
or something. I can share what I have or find some time today to try to get
that working, but that's as far as I got..copy_from_slice() or
.copy_to_slice(). I've also been using Rust's iterators, which are
implemented by the ProcessSlice types, which you can combine using zip().
That may be an option to avoid re-implementing the API.[]
operator, then you have to use Result.zip, then it's automatically bounded to the
minimum of the length of the two slices lengths.unsafe get_unchecked, which would be great. If you've got a prototype of
that or something, that sounds great.usize (#2958)Grant
in the meantime it should be okay.