L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
L4Re::Mmio_space Struct Reference

Interface for memory-like address space accessible via IPC. More...

#include <mmio_space>

+ Inheritance diagram for L4Re::Mmio_space:
+ Collaboration diagram for L4Re::Mmio_space:

Public Types

enum  Access_width { Wd_8bit = 0 , Wd_16bit = 1 , Wd_32bit = 2 , Wd_64bit = 3 }
 Actual size of the value to read or write. More...
 
typedef l4_uint64_t Addr
 Device address.
 

Public Member Functions

long mmio_read (Addr addr, char width, l4_uint64_t *value)
 Read a value from the given address.
 
long mmio_write (Addr addr, char width, l4_uint64_t value)
 Write a value to the given address.
 
- Public Member Functions inherited from L4::Kobject
l4_msgtag_t dec_refcnt (l4_mword_t diff, l4_utcb_t *utcb=l4_utcb())
 Decrement the in kernel reference counter for the object.
 

Additional Inherited Members

- Protected Types inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE >
typedef Mmio_space Class
 The target interface type (inheriting from Kobject_t)
 
typedef Typeid::Iface< PROTO, Mmio_space > __Iface
 The interface description for the derived class.
 
typedef Typeid::Merge_list< Typeid::Iface_list< __Iface >, typename Base::__Iface_list > __Iface_list
 The list of all RPC interfaces provided directly or through inheritance.
 
- Protected Member Functions inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE >
L4::Cap< Classc () const noexcept
 Get the capability to ourselves.
 
- Protected Member Functions inherited from L4::Kobject
l4_cap_idx_t cap () const noexcept
 Return capability selector.
 
- Static Protected Member Functions inherited from L4::Kobject_t< Mmio_space, L4::Kobject, L4RE_PROTO_MMIO_SPACE >
static void __check_protocols__ () noexcept
 Helper to check for protocol conflicts.
 

Detailed Description

Interface for memory-like address space accessible via IPC.

This interface defines methods for indirect access to MMIO regions.

Memory mapped IO (MMIO) is used by device drivers to control hardware devices. Access to MMIO regions is assigned to user-level device drivers via mappings of memory pages.

However, there are hardware platforms where MMIO regions for different devices share the same memory page. With respect to security and safety, it is often not allowed to map a memory page to multiple device drivers because the driver of one device could then influence operation of another device, which violates security boundaries.

A solution to that problem is to implement a third (trusted) component that gets exclusive access to the shared memory page, and that drivers can access via IPC with the Mmio_space protocol. This proxy-component can then enforce an access policy.

Include File
#include <l4/re/mmio_space>
Interface definition to emit MMIO-like accesses via IPC.

Definition at line 46 of file mmio_space.

Member Enumeration Documentation

◆ Access_width

Actual size of the value to read or write.

Enumerator
Wd_8bit 

Value is a byte.

Wd_16bit 

Value is a 2-byte word.

Wd_32bit 

Value is a 4-byte word.

Wd_64bit 

Value is a 8-byte word.

Definition at line 50 of file mmio_space.

Member Function Documentation

◆ mmio_read()

long L4Re::Mmio_space::mmio_read ( Addr  addr,
char  width,
l4_uint64_t value 
)

Read a value from the given address.

Parameters
addrDevice virtual address to read from. The address must be aligned relative to the access width.
widthAccess width of value to be read, see Access_width.
[out]valueReturn value. If width is smaller than 64 bit,the upper bits are guaranteed to be 0.
Return values
L4_EOKSuccess.
-L4_EPERMInsufficient read rights.
-L4_EINVALAddress does not exist or cannot be accessed with the given width.

◆ mmio_write()

long L4Re::Mmio_space::mmio_write ( Addr  addr,
char  width,
l4_uint64_t  value 
)

Write a value to the given address.

Parameters
addrDevice virtual address to write to. The address must be aligned relative to the access width.
widthAccess width of value to write, see Access_width.
valueValue to write. If width is smaller than 64 bit, the upper bits are ignored.
Return values
L4_EOKSuccess.
-L4_EPERMInsufficient write rights.
-L4_EINVALAddress does not exist or cannot be accessed with the given width.

The documentation for this struct was generated from the following file: