Keurnel Assembly Syntax
This page provides a comprehensive reference for the Keurnel Assembly language used to interact directly with the system's core execution layer. Select an architecture below to view architecture-specific syntax documentation.
Overview
This documentation serves as the definitive guide to the structure, rules, and conventions that govern how low-level instructions are written, interpreted, and executed within the kernel environment. Each architecture page contains specific information about registers, addressing modes, and instruction encoding.
Common Language Grammar
Across all architectures, the assembly language grammar includes:
- Instruction formats and operand types
- Addressing modes and register usage
- Directives and symbolic conventions
Important Considerations
Special attention is given to privilege levels, memory access semantics, interrupt handling, and system call interfaces, ensuring clarity when working in protected or performance-critical contexts.
Common Syntax Rules
The following syntax rules apply across all architectures:
Token Types
Token types are fundamental building blocks used during lexical analysis—the first phase of the assembler pipeline. The lexer scans raw source code character by character and groups them into meaningful units called tokens. Each token is classified into a specific type that tells the parser what kind of element it represents.
These token types are used for syntax highlighting in IDEs, error detection, and building the Abstract Syntax Tree (AST) that represents your assembly program's structure. The following token types are recognized across all architectures:
TokenWhitespaceRepresents a sequence of whitespace characters (spaces, tabs, newlines).
TokenCommentRepresents a comment in the source code (e.g., lines starting with ';').
TokenIdentifierRepresents an identifier (e.g., variable names, labels).
TokenDirectiveRepresents an assembler directive (e.g., %define, %include).
TokenInstructionRepresents an assembly instruction mnemonic.
TokenRegisterRepresents a CPU register (architecture-specific).
TokenImmediateRepresents an immediate value (e.g., numeric literals).
TokenStringRepresents a string literal (e.g., "Hello, World!").
x86-64 Keurnel Assembly Syntax
Complete syntax reference for Keurnel Assembly targeting the x86-64 (AMD64) architecture.
x86-64 (AMD64)
The x86-64 architecture, also known as AMD64 or Intel 64, is a 64-bit extension of the x86 instruction set. It is the dominant architecture for desktop and server computing.
Features
- 64-bit addressing
- 16 general-purpose registers
- SSE/AVX extensions
- Red zone optimization
- RIP-relative addressing
x86-64 Registers
General Purpose (64-bit)
Extended Registers
Segment Registers
Addressing Modes
MOV RAX, 42Value encoded directly in instruction
MOV RAX, RBXValue stored in a register
MOV RAX, [0x1000]Value at a fixed memory address
MOV RAX, [RBX]Value at address in register
MOV RAX, [RBX + 8]Register plus offset
MOV RAX, [RBX + RCX*4]Scale-Index-Base addressing
x86-64 Token Types
The following token types are specific to x86-64 Keurnel assembly.
Example: x86-64 Keurnel Assembly
; x86-64 Hello World Example
%define SYS_WRITE 1
%define SYS_EXIT 60
%define STDOUT 1
section .data
msg: db "Hello, World!", 10
len: equ $ - msg
section .text
global _start
_start:
MOV RAX, SYS_WRITE ; syscall number
MOV RDI, STDOUT ; file descriptor
LEA RSI, [msg] ; message address
MOV RDX, len ; message length
SYSCALL
MOV RAX, SYS_EXIT ; exit syscall
XOR RDI, RDI ; exit code 0
SYSCALLMore Architectures Coming Soon
We're actively working on adding support for ARM64, RISC-V, and other architectures.