genode/repos/base
Martin Stein 1336b0a751 mmio: upper-bounds checks
The classes Genode::Mmio, Genode::Register_set, Genode::Attached_mmio, and
Platform::Device::Mmio now receive a template parameter 'size_t SIZE'. In each
type that derives from one of these classes, it is now statically checked that
the range of each Genode::Register::Register- and
Genode::Register_set::Register_array-deriving sub-type is within [0..SIZE).

That said, SIZE is the minimum size of the memory region provided to the above
mentioned Mmio classes in order to avoid page faults or memory corruption when
accessing the registers and register arrays declared inside.

Note, that the range end of a register array is not the end of the last item
but the end of integer access that is used for accessing the last bit in the
last item.

The constructors of Genode::Mmio, Genode::Attached_mmio, and
Platform::Device::Mmio now receive an argument 'Byte_range_ptr range' that is
expected to be the range of the backing memory region. In each type that derives
from on of these classes, it is now dynamically checked that 'range.num_bytes
>= SIZE', thereby implementing the above mention protection against page faults
and memory corruption.

The rest of the commit adapts the code throughout the Genode Labs repositories
regarding the changes. Note that for that code inside Core, the commits mostly
uses a simplified approach by constructing MMIO objects with range
[base..base+SIZE) and not with a mapping- or specification-related range size.
This should be fixed in the future.

Furthermore, there are types that derive from an MMIO class but don't declare
any registers or register arrays (especially with Platform::Device::Mmio). In
this case SIZE is set to 0. This way, the parameters must be actively corrected
by someone who later wants to add registers or register arrays, plus the places
can be easily found by grep'ing for Mmio<0>.

Fix #4081
2024-02-26 08:59:07 +01:00
..
board qemu: set default cpu model for x86_64 explicitly 2023-06-16 11:24:25 +02:00
etc tool chain: update version to 23.05 2023-05-30 12:03:27 +02:00
include mmio: upper-bounds checks 2024-02-26 08:59:07 +01:00
lib mk: remove implicit build of shared libraries 2023-11-28 14:44:29 +01:00
mk mk: .lib.so and .abi.so depend on linker scripts 2023-12-01 09:49:31 +01:00
ports grub2: add small default font 2023-02-27 08:20:46 +01:00
recipes depot: update recipe hashes 2023-12-13 12:33:05 +01:00
run Adapt run scripts to trace-subject filtering 2023-12-13 12:28:52 +01:00
src mmio: upper-bounds checks 2024-02-26 08:59:07 +01:00
xsd base_types.xsd: allow session labels of length 0 2018-11-16 14:37:19 +01:00
README Update README files 2023-03-13 14:32:53 +01:00

This is the generic Genode base system, which consists of two parts:

:_Core_: is the root of the Genode component tree. It provides abstractions for
  the lowest-level hardware resources such as RAM, ROM, CPU, and device access.
  All generic parts of core can be found here. For kernel-specific parts,
  refer to the appropriate 'base-<kernel>' directory.

:_Base libraries and interfaces: that are used by each Genode component
  to interact with other components. This is the glue that holds everything
  together.

Depending on the used kernel, core may export information about the hardware
platform as a ROM called 'platform_info'. For example, if the ACPI RSDT and
XSDT physical pointer are reported by the used kernel and/or bootloader, core
provides this information in the ROM as follows.

!<platform_info>
! <acpi revision="2" rsdt="0x1fe93074" xsdt="0x1fe930e8"/>
! <boot>
!   <framebuffer phys="0x7300000" width="1024" height="768" bpp="32"/>
! </boot>
!</platform_info>

If the graphics device is initialised and can be directly used by a
framebuffer driver, core provides the physical pointer to the framebuffer, the
resolution, and color depth in bits.