ladybird/Kernel/Memory
Liav A 05ba034000 Kernel: Introduce the IOWindow class
This class is intended to replace all IOAddress usages in the Kernel
codebase altogether. The idea is to ensure IO can be done in
arch-specific manner that is determined mostly in compile-time, but to
still be able to use most of the Kernel code in non-x86 builds. Specific
devices that rely on x86-specific IO instructions are already placed in
the Arch/x86 directory and are omitted for non-x86 builds.

The reason this works so well is the fact that x86 IO space acts in a
similar fashion to the traditional memory space being available in most
CPU architectures - the x86 IO space is essentially just an array of
bytes like the physical memory address space, but requires x86 IO
instructions to load and store data. Therefore, many devices allow host
software to interact with the hardware registers in both ways, with a
noticeable trend even in the modern x86 hardware to move away from the
old x86 IO space to exclusively using memory-mapped IO.

Therefore, the IOWindow class encapsulates both methods for x86 builds.
The idea is to allow PCI devices to be used in either way in x86 builds,
so when trying to map an IOWindow on a PCI BAR, the Kernel will try to
find the proper method being declared with the PCI BAR flags.
For old PCI hardware on non-x86 builds this might turn into a problem as
we can't use port mapped IO, so the Kernel will gracefully fail with
ENOTSUP error code if that's the case, as there's really nothing we can
do within such case.

For general IO, the read{8,16,32} and write{8,16,32} methods are
available as a convenient API for other places in the Kernel. There are
simply no direct 64-bit IO API methods yet, as it's not needed right now
and is not considered to be Arch-agnostic too - the x86 IO space doesn't
support generating 64 bit cycle on IO bus and instead requires two 2
32-bit accesses. If for whatever reason it appears to be necessary to do
IO in such manner, it could probably be added with some neat tricks to
do so. It is recommended to use Memory::TypedMapping struct if direct 64
bit IO is actually needed.
2022-09-23 17:22:15 +01:00
..
AddressSpace.cpp Kernel: Don't wrap AddressSpace's RegionTree in SpinlockProtected 2022-08-24 14:57:51 +02:00
AddressSpace.h Kernel: Don't wrap AddressSpace's RegionTree in SpinlockProtected 2022-08-24 14:57:51 +02:00
AllocationStrategy.h Kernel: Rename Kernel/VM/ to Kernel/Memory/ 2021-08-06 14:05:58 +02:00
AnonymousVMObject.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
AnonymousVMObject.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
InodeVMObject.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
InodeVMObject.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
MappedROM.h Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
MemoryManager.cpp Kernel/x86: Move RTC and CMOS code to x86 arch-specific subdirectory 2022-09-20 18:43:05 +01:00
MemoryManager.h Kernel: Use InterruptsState in Spinlock code 2022-08-26 12:51:57 +02:00
PageDirectory.cpp Kernel: Don't take MM lock in ~PageDirectory() 2022-08-24 14:57:51 +02:00
PageDirectory.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
PageFaultResponse.h Kernel: Send SIGBUS to threads that use after valid Inode mmaped range 2022-09-16 14:55:45 +03:00
PhysicalPage.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
PhysicalPage.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
PhysicalRegion.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
PhysicalRegion.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
PhysicalZone.cpp Kernel: Add implied auto qualifiers in Memory 2022-01-09 23:29:57 -08:00
PhysicalZone.h Kernel: Remove the kmalloc_eternal heap :^) 2021-12-28 21:02:38 +01:00
PrivateInodeVMObject.cpp Kernel: Handle mmap requests on zero-length data file inodes safely 2022-09-16 14:55:45 +03:00
PrivateInodeVMObject.h Kernel: Handle mmap requests on zero-length data file inodes safely 2022-09-16 14:55:45 +03:00
Region.cpp Kernel: Send SIGBUS to threads that use after valid Inode mmaped range 2022-09-16 14:55:45 +03:00
Region.h Kernel: Send SIGBUS to threads that use after valid Inode mmaped range 2022-09-16 14:55:45 +03:00
RegionTree.cpp Kernel: Wrap RegionTree objects in SpinlockProtected 2022-08-24 14:57:51 +02:00
RegionTree.h Kernel: Wrap process address spaces in SpinlockProtected 2022-08-24 14:57:51 +02:00
RingBuffer.cpp Everywhere: Run clang-format 2022-04-01 21:24:45 +01:00
RingBuffer.h Kernel: Require lock rank for Spinlock construction 2022-08-19 20:26:47 -07:00
ScatterGatherList.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
ScatterGatherList.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
ScopedAddressSpaceSwitcher.cpp Kernel: Implement InterruptDisabler using generic Processor functions 2022-06-02 13:14:12 +01:00
ScopedAddressSpaceSwitcher.h Kernel: Rename ProcessPagingScope => ScopedAddressSpaceSwitcher 2021-09-06 18:56:51 +02:00
SharedFramebufferVMObject.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
SharedFramebufferVMObject.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
SharedInodeVMObject.cpp Kernel: Handle mmap requests on zero-length data file inodes safely 2022-09-16 14:55:45 +03:00
SharedInodeVMObject.h Kernel: Handle mmap requests on zero-length data file inodes safely 2022-09-16 14:55:45 +03:00
TypedMapping.h Kernel: Introduce the IOWindow class 2022-09-23 17:22:15 +01:00
VirtualRange.cpp Kernel: Use AddressSpace region tree for range allocation 2022-04-03 21:51:58 +02:00
VirtualRange.h Everywhere: Add sv suffix to strings relying on StringView(char const*) 2022-07-12 23:11:35 +02:00
VMObject.cpp Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00
VMObject.h Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage 2022-08-24 18:35:41 +02:00