summaryrefslogtreecommitdiff
path: root/Kernel/UserOrKernelBuffer.h
AgeCommit message (Collapse)Author
2021-09-07Kernel: Make UserOrKernelBuffer return KResult from read/write/memsetAndreas Kling
This allows us to simplify a whole bunch of call sites with TRY(). :^)
2021-09-07Kernel: Remove redundant [[nodiscard]] on KResult return valuesAndreas Kling
Both KResult and KResultOr are [[nodiscard]] at the class level, so there's no need to have functions return `[[nodiscard]] KResult`.
2021-09-05Kernel: Remove UserOrKernelBuffer::copy_into_string()Andreas Kling
All former users of this API have been converted to use KString. :^)
2021-09-01Kernel: Convert UserOrKernelBuffer callbacks to use AK::BytesBrian Gianforcaro
2021-08-06Kernel: Move Kernel/Memory/ code into Kernel::Memory namespaceAndreas Kling
2021-08-06Kernel: Rename Kernel/VM/ to Kernel/Memory/Andreas Kling
This directory isn't just about virtual memory, it's about all kinds of memory management.
2021-07-17Kernel: Add an API for turning a UserOrKernelBuffer into a KStringAndreas Kling
2021-06-17Kernel: Remove obsolete size_t castsGunnar Beutner
2021-06-16Kernel: Remove various other uses of ssize_tGunnar Beutner
2021-06-16Kernel: Use KResultOr<size_t> throughout the TTY subsystemGunnar Beutner
Previously the VirtualConsole::on_tty_write() method would return an incorrect value when an error had occurred. This prompted me to update the TTY subsystem to use KResultOr<size_t> everywhere.
2021-05-13Kernel: Make UserOrKernelBuffer R/W helpers return KResultOr<size_t>Andreas Kling
This makes error propagation less cumbersome (and also exposed some places where we were not doing it.)
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-15Kernel: Mark UserOrKernelBuffer and it's getters as [[nodicard]]Brian Gianforcaro
`UserOrKernelBuffer` objects should always be observed when created, in turn there is no reason to call a getter without observing the result. Doing either of these indicates an error in the code. Mark these methods as [[nodiscard]] to find these cases.
2020-09-15FileSystem: Use OutputMemoryStream instead of BufferStream.asynts
2020-09-13Kernel: Make copy_to/from_user safe and remove unnecessary checksTom
Since the CPU already does almost all necessary validation steps for us, we don't really need to attempt to do this. Doing it ourselves doesn't really work very reliably, because we'd have to account for other processors modifying virtual memory, and we'd have to account for e.g. pages not being able to be allocated due to insufficient resources. So change the copy_to/from_user (and associated helper functions) to use the new safe_memcpy, which will return whether it succeeded or not. The only manual validation step needed (which the CPU can't perform for us) is making sure the pointers provided by user mode aren't pointing to kernel mappings. To make it easier to read/write from/to either kernel or user mode data add the UserOrKernelBuffer helper class, which will internally either use copy_from/to_user or directly memcpy, or pass the data through directly using a temporary buffer on the stack. Last but not least we need to keep syscall params trivial as we need to copy them from/to user mode using copy_from/to_user.