Hardware Monad Interface (work in progress)ContentsIndex
H.PhysicalMemory
Description
Physical Pages and Addresses (section 3.1 in the paper)
Synopsis
type PAddr = (PhysPage, POffset)
data PhysPage
type POffset = Word12
pageSize :: Int
getPAddr :: PAddr -> H Word8
setPAddr :: PAddr -> Word8 -> H ()
allocPhysPage :: H (Maybe PhysPage)
freePhysPage :: PhysPage -> H ()
fromPhysPage :: PhysPage -> Page Word8
Documentation
type PAddr = (PhysPage, POffset)
The type PAddr represents byte addresses in the machine's raw physical memory. It is composed from an abstract type PhysPage, representing a physical page, and a numeric POffset, representing the offset of a byte within that page.
data PhysPage
PhysPages correspond to physical pages that are available for accesses by user-mode processes, which form a subset of the raw physical memory installed in the machine.
Instances
Eq PhysPage
Show PhysPage
type POffset = Word12
The POffset type behaves just like a standard unsigned integer type (e.g. Word8) with bounds [0..pageSize-1], except that arithmetic operations are checked for overflow rather than silently "wrapping around."
pageSize :: Int
getPAddr :: PAddr -> H Word8
The contents of individual addresses can be read using getPAddr.
setPAddr :: PAddr -> Word8 -> H ()
The contents of individual addresses can be written using setPAddr.
allocPhysPage :: H (Maybe PhysPage)
New physical pages are obtained using allocPhysPage, which returns Nothing if no more pages are available. Each allocated page is distinct.
freePhysPage :: PhysPage -> H ()
fromPhysPage :: PhysPage -> Page Word8
Produced by Haddock version 0.6