Files
vystem/docs/shelter/cpu/asmint.md
2026-03-31 22:15:00 +02:00

843 B

ASM instructions

Introduction

While the Shelter kernel is made in C, somes basic CPU functions require using ASM instructions. For that, we define wrappers that can be used anywhere in the kernel. These wrappers are defined inside the header file shelter/lib/include/cpu/asm.h which act as the only place in the entire kernel where the __asm__ should be used. The subsystem prefix is sh_asm_.

Overview

Here is a list of all the wrappers available. They are all defined as static inline function:

  • inb: take a sh_uint16 in input for specifying the port and return the inputed byte
  • outb: take a sh_uint16 for specifying the port and a sh_uint8 for specifying the byte to output
  • rdtsc: take no arguments and return the current TSC as a sh_uint64
  • invlpg: take a void * as an address and return nothing