Hardware Monad Interface (work in progress)ContentsIndex
H.UserMode
Description
User-space Execution (section 3.3 in the paper)
Synopsis
data Context = Context {
edi, esi, ebp, esp, ebx, edx, ecx, eax, eip, eflags :: Word32
}
execContext :: PageMap -> Context -> H (Interrupt, Context)
data Interrupt
= DivideError
| NMIInterrupt
| Breakpoint
| Overflow
| BoundRangeExceeded
| InvalidOpcode
| DeviceNotAvailable
| DoubleFault ErrorCode
| InvalidTSS ErrorCode
| SegmentNotPresent ErrorCode
| StackSegmentFault ErrorCode
| GeneralProtection ErrorCode
| PageFault PageFaultErrorCode VAddr
| FPUError
| AlignmentCheck ErrorCode
| MachineCheck
| SIMDException
| ExternalInterrupt IRQ
| ProgrammedException Word8
type ErrorCode = Word32
data PageFaultErrorCode = PageFaultErrorCode {
userMode :: Bool
write :: Bool
protection :: Bool
}
Documentation
data Context
Context describes the (non-memory) state of the processor, including the values of the program-accessible registers and control flags. This is the definition for the IA32 architecture.
Constructors
Context
edi, esi, ebp, esp, ebx, edx, ecx, eax, eip, eflags :: Word32
Instances
Show Context
execContext :: PageMap -> Context -> H (Interrupt, Context)

execContext is the operator for executing code in a user address space.

Invoking execContext installs the specified page map and context into the appropriate hardware registers and puts the processor into user mode. User code then executes (starting at the eip recorded in the Context) and can access the physical addresses visible to it through its page map. When user-mode execution is interrupted the processor records the new current context and returns to kernel mode; execContext then returns with that Context and the nature of the Interrupt.

data Interrupt
Constructors
DivideError
NMIInterrupt
Breakpoint
Overflow
BoundRangeExceeded
InvalidOpcode
DeviceNotAvailable
DoubleFault ErrorCode
InvalidTSS ErrorCode
SegmentNotPresent ErrorCode
StackSegmentFault ErrorCode
GeneralProtection ErrorCode
PageFault PageFaultErrorCode VAddr
FPUError
AlignmentCheck ErrorCode
MachineCheck
SIMDException
ExternalInterrupt IRQ
ProgrammedException Word8
Instances
Show Interrupt
type ErrorCode = Word32
data PageFaultErrorCode
Constructors
PageFaultErrorCode
userMode :: Bool
write :: Bool
protection :: Bool
Instances
Show PageFaultErrorCode
Produced by Haddock version 0.6