]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
feat: implement shared memory IPC (shmget/shmat/shmdt/shmctl)
authorTulio A M Mendes <[email protected]>
Tue, 10 Feb 2026 07:39:00 +0000 (04:39 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 02:20:20 +0000 (23:20 -0300)
commit9405dba83d3873c6bc700d3c03db7a8b06a40e1d
treeb5800acd08d00b87fa8ae757ce6f56f12725314a
parent925909c43a145077a441b87403c0b2a077d0c99d
feat: implement shared memory IPC (shmget/shmat/shmdt/shmctl)

Add System V-style shared memory IPC subsystem:
- src/kernel/shm.c: kernel-side segment manager with up to 32
  segments, each up to 16 pages (64KB). Physical pages allocated
  via PMM, mapped into user address space via VMM.
- include/shm.h: API + constants (IPC_CREAT, IPC_EXCL, IPC_RMID,
  IPC_PRIVATE)
- Syscalls 46-49: SHMGET, SHMAT, SHMDT, SHMCTL wired in syscall.c
- shm_init() called from kernel_main after kheap_init
- Deferred destruction: IPC_RMID with nattch>0 defers free until
  last detach

Also fixes:
- tty.c: add utils.h include for memset (cross-compiler strictness)
- usermode.c: fix ebp clobber error with cross-compiler by using
  ESI as scratch register instead

Passes: make, cppcheck, QEMU smoke test.
include/shm.h [new file with mode: 0644]
include/syscall.h
src/arch/x86/usermode.c
src/kernel/main.c
src/kernel/shm.c [new file with mode: 0644]
src/kernel/syscall.c
src/kernel/tty.c