]> 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)
commit8a96857c2df6977a276537b43e89101bc6186654
tree3ab125156047996b8345c88db5ba19ba1caaac49
parent2613f85cb0e26937626bf5b7e2b1702aaceec344
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