WKern
Loading...
Searching...
No Matches
asm.c File Reference
#include <io/kio.h>
#include <types/nums.h>

Go to the source code of this file.

Functions

void Outb (u16 port, u8 val)
 Write a byte to the specified I/O port.
u8 Inb (u16 port)
 Read a byte from the specified I/O port.
void Outw (u16 port, u16 val)
 Write a 16-bit word to the specified I/O port.
u16 Inw (u16 port)
 Read a 16-bit word from the specified I/O port.
void Outl (u16 port, u32 val)
 Write a 32-bit value to the specified I/O port.
u32 Inl (u16 port)
 Read a 32-bit value from the specified I/O port.
void Cli ()
 Disable CPU interrupts (clear interrupt flag).
void Sti ()
 Enable CPU interrupts (set interrupt flag).

Function Documentation

◆ Cli()

void Cli ( )
inline

Disable CPU interrupts (clear interrupt flag).

This is often used before critical sections to prevent preemption by interrupt handlers.

Definition at line 96 of file asm.c.

◆ Inb()

u8 Inb ( u16 port)
inline

Read a byte from the specified I/O port.

Parameters
portI/O port to read from
Returns
Byte value read

Definition at line 40 of file asm.c.

◆ Inl()

u32 Inl ( u16 port)
inline

Read a 32-bit value from the specified I/O port.

Parameters
portI/O port to read from
Returns
32-bit value read

Definition at line 84 of file asm.c.

◆ Inw()

u16 Inw ( u16 port)
inline

Read a 16-bit word from the specified I/O port.

Parameters
portI/O port to read from
Returns
16-bit value read

Definition at line 62 of file asm.c.

◆ Outb()

void Outb ( u16 port,
u8 val )
inline

Write a byte to the specified I/O port.

Parameters
portI/O port to write to
valByte value to write

Definition at line 30 of file asm.c.

◆ Outl()

void Outl ( u16 port,
u32 val )
inline

Write a 32-bit value to the specified I/O port.

Parameters
portI/O port to write to
val32-bit value to write

Definition at line 74 of file asm.c.

◆ Outw()

void Outw ( u16 port,
u16 val )
inline

Write a 16-bit word to the specified I/O port.

Parameters
portI/O port to write to
val16-bit value to write

Definition at line 52 of file asm.c.

◆ Sti()

void Sti ( )
inline

Enable CPU interrupts (set interrupt flag).

This is used after a critical section to re-enable interrupts. NOPs are added for minor instruction delay.

Definition at line 104 of file asm.c.