Skip to content

sheharyaar/systems-kernel-asm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The notes on assembly is available on my website: sheharyaar.in/notes/assembly/. The notes on system-v-abi and system programming is still a work in progress.

Reference Book

Learn to Program with Assembly: Foundational Learning for New Programmers by Jonathan Bartlett

  • It has AT&T Syntax (used by Linux Kernel) and introduces AMD64 (64-Bit Assembly).
  • Book with cropped margins and highlights in some chapters is available here for personal use only.

I have created this repository to learn assembly quickly in context of systems programming to get the foundational skills to build a toy hypervisor and for other low level projects in near future. None of the code is generated by LLMs. Only the Makefiles and few sections of the README could be generated by LLMs.

Folder Structure

  • asm-basics/ contains basic byte-sized programs to learn 64-bit assembly.
  • systems-programming/ contains byte-sized programs to learn systems programming using AMD manual.
  • system-v-abi contains topics related to System V AMD64 ABI such as code-models, ELF, Dynamic Linking, etc.

Each folder has its own README.md file which contains the description of the programs in them and the steps to build and run them.

TODOs

  • Practice context saving and restoration -- saving all general-purpose registers on the stack, modifying their contents and restoring their values
  • Create a scheduler in assembly that saves the context (registers, stack pointer, etc.) of the currently running routine and switches to the other.
  • Create a simple page table load the address into the page table base register
  • Implement a basic interrupt handler in assembly
  • Build a minimal kernel service: write an assembly routine that acts as a system call handler (using a software interrupt or exception) to, say, print a string. Then, from user mode (or simulated user code), invoke this system call to verify the interface works.
  • Play with control registers

Source Code Study (Linux Kernel)

  • Interrupt, Exceptions and System calls
  • Switching tasks
  • Early boot and initialisations
  • Atomics and Locks
  • CPU initialisation and feature detection
  • Memory paging and MMU
  • Trampoline
  • VDSO ??

About

Assembly playground to learn assembly and use of asm in systems programming.

Resources

Stars

Watchers

Forks