Pip
Architecture-dependent parts of Pip: MAL, IAL and boot
Functions
port.c File Reference

IO-ports for x86. More...

#include "port.h"
#include "mal.h"
#include "x86int.h"
#include "debug.h"
#include "pic8259.h"

Functions

static uint32_t ioAccessValid (uint16_t port)
 
void outb (uint16_t port, uint8_t value)
 IO port write byte. More...
 
void outw (uint16_t port, uint16_t value)
 IO port write word. More...
 
void outl (uint16_t port, uint32_t value)
 Out operation on 4-byte value. More...
 
uint8_t inb (uint16_t port)
 IO port read byte. More...
 
uint16_t inw (uint16_t port)
 IO port read word. More...
 
uint32_t inl (uint16_t port)
 In operation on a 4-bytes value. More...
 
void faultToParent (uint32_t data1, uint32_t data2, gate_ctx_t *ctx)
 Dispatch an access fault to the parent partition. More...
 
void outbGlue (gate_ctx_t *ctx, uint32_t port, uint32_t value)
 Glue function for outb callgate. More...
 
void outwGlue (gate_ctx_t *ctx, uint32_t port, uint32_t value)
 Glue function for outw callgate. More...
 
void outlGlue (gate_ctx_t *ctx, uint32_t port, uint32_t value)
 Glue function for outl callgate. More...
 
void outaddrlGlue (gate_ctx_t *ctx, uint32_t port, uint32_t value)
 Glue function for outaddrl callgate. More...
 
uint32_t inbGlue (gate_ctx_t *ctx, uint32_t port)
 Glue function for inb callgate. More...
 
uint32_t inwGlue (gate_ctx_t *ctx, uint32_t port)
 Glue function for inw callgate. More...
 
uint32_t inlGlue (gate_ctx_t *ctx, uint32_t port)
 Glue function for inl callgate. More...
 
uint32_t timerGlue (void)
 Glue function for timer callgate. More...
 

Detailed Description

IO-ports for x86.

Function Documentation

◆ faultToParent()

void faultToParent ( uint32_t  data1,
uint32_t  data2,
gate_ctx_t ctx 
)

Dispatch an access fault to the parent partition.

Parameters
data1First data to pass
data2Second data to pass
ctxInterrupted context
Returns
This function does not return.
Note
The parent partition should resume the caller on its own

◆ inb()

uint8_t inb ( uint16_t  port)

IO port read byte.

In operation on 1-byte value.

Parameters
portThe port number
Returns
The value returned by the IO operation

◆ inbGlue()

uint32_t inbGlue ( gate_ctx_t ctx,
uint32_t  port 
)

Glue function for inb callgate.

Parameters
portTarget IO port
ctxInterrupted context
Returns
IO port read value
Note
Trigger a fault in parent partition if not authorized

◆ inl()

uint32_t inl ( uint16_t  port)

In operation on a 4-bytes value.

Parameters
portThe port number
Returns
The value returned by the IO operation

◆ inlGlue()

uint32_t inlGlue ( gate_ctx_t ctx,
uint32_t  port 
)

Glue function for inl callgate.

Parameters
portTarget IO port
ctxInterrupted context
Returns
IO port read value
Note
Trigger a fault in parent partition if not authorized

◆ inw()

uint16_t inw ( uint16_t  port)

IO port read word.

In operation on a 2-bytes value.

Parameters
portThe port number
Returns
The value returned by the IO operation

◆ inwGlue()

uint32_t inwGlue ( gate_ctx_t ctx,
uint32_t  port 
)

Glue function for inw callgate.

Parameters
portTarget IO port
ctxInterrupted context
Returns
IO port read value
Note
Trigger a fault in parent partition if not authorized

◆ ioAccessValid()

static uint32_t ioAccessValid ( uint16_t  port)
static

◆ outaddrlGlue()

void outaddrlGlue ( gate_ctx_t ctx,
uint32_t  port,
uint32_t  value 
)

Glue function for outaddrl callgate.

Parameters
portTarget IO port
valueThe value to write
ctxInterrupted context
Note
Trigger a fault in parent partition if not authorized

◆ outb()

void outb ( uint16_t  port,
uint8_t  value 
)

IO port write byte.

Out operation on 1-byte value.

Parameters
portThe port number
valueThe value to write

◆ outbGlue()

void outbGlue ( gate_ctx_t ctx,
uint32_t  port,
uint32_t  value 
)

Glue function for outb callgate.

Parameters
portTarget IO port
valueThe value to write
ctxInterrupted context
Note
Trigger a fault in parent partition if not authorized

◆ outl()

void outl ( uint16_t  port,
uint32_t  value 
)

Out operation on 4-byte value.

Parameters
portThe port number
valueThe value to write

◆ outlGlue()

void outlGlue ( gate_ctx_t ctx,
uint32_t  port,
uint32_t  value 
)

Glue function for outl callgate.

Parameters
portTarget IO port
valueThe value to write
ctxInterrupted context
Note
Trigger a fault in parent partition if not authorized

◆ outw()

void outw ( uint16_t  port,
uint16_t  value 
)

IO port write word.

Out operation on 2-byte value.

Parameters
portThe port number
valueThe value to write

◆ outwGlue()

void outwGlue ( gate_ctx_t ctx,
uint32_t  port,
uint32_t  value 
)

Glue function for outw callgate.

Parameters
portTarget IO port
valueThe value to write
ctxInterrupted context
Note
Trigger a fault in parent partition if not authorized

◆ timerGlue()

uint32_t timerGlue ( void  )

Glue function for timer callgate.

Returns
Current timer ticks