SchOS/include
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Nexoniarz 0e39e711f1 fpu: save each process's x87/SSE registers; keep the kernel off them
Nothing ever saved the FPU and SSE registers on a context switch.
musl's memcpy, the compiler's struct copies and any arithmetic on
doubles keep live values in %xmm, so two processes sharing a CPU wrote
over each other's: two shells counting in a loop on one processor took
a NULL+8 page fault within seconds, at a different rip every time. It
reproduces on kernels from before this week too -- it had always been
there, and every crash nobody could explain was a candidate.

sched() now fxsaves the process leaving the CPU and scheduler()
fxrstors the one arriving. A new process starts from the ABI's state
(FCW 0x37F, MXCSR 0x1F80), fork copies the parent's live registers,
exec resets them, and a signal handler's are put back by rt_sigreturn
so the interrupted code finds what it had.

The kernel was free to use %xmm too -- GCC vectorised struct copies
and memset into 153 instructions of it -- so an interrupt could
clobber the registers of the program it interrupted with no switch at
all. Kernel, lwIP and uACPI objects are built -mgeneral-regs-only now
and the image has none; cmd/ keeps SSE.

Checked under QEMU: three concurrent loops three times over, on 1 CPU
and on 4, no faults; before, every run faulted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S1giNvrHTrPMPw7V6x1kQ4
2026-10-23 15:02:01 +02:00
..
acpi.h acpi: uACPI, for interrupt routing, the power button and power-off 2026-10-22 16:12:28 +02:00
asm.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
audio.h audio: /dev/dsp, AudioEngine, and an AC'97 under it 2026-09-24 14:23:13 +02:00
blkdev.h vfs: room for 32 disks and partitions, 32 mounts, 16 SchFS volumes 2026-10-23 12:19:50 +02:00
buf.h bio: a buffer cache that grows to 1/32 of RAM, looked up by hash 2026-10-23 13:28:12 +02:00
config_sinit.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
date.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
dbg.h debugger: D5, the network transport -- and the plan closes 2026-09-14 15:33:53 +02:00
defs.h sched: fair share by virtual runtime, with nice 2026-10-23 15:01:27 +02:00
device.h limits: 256 PCI functions, 128 sockets and devices, 64 USB interfaces 2026-10-23 13:54:37 +02:00
display.h gfx: the second head shows the boot, not just what comes after it 2026-09-22 21:47:35 +02:00
dma.h dma: the 4 MB cap was the refusal, not the arena 2026-09-14 22:52:20 +02:00
elf.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
errno.h schfs: a format version policy, and refusing is not falling back 2026-09-12 17:13:59 +02:00
fat.h vfs: room for 32 disks and partitions, 32 mounts, 16 SchFS volumes 2026-10-23 12:19:50 +02:00
fb.h Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
fcntl.h Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
file.h smp: 64 processors, and say how many there are 2026-10-23 13:50:08 +02:00
font.h Rename Schunix to SchOS; the kernel becomes SchIFT 2026-08-09 14:09:59 +02:00
fs.h init survives stray signals; commands are 4-34x faster 2026-08-09 15:54:05 +02:00
fsstat.h licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
gfx.h gfx: draw the console in RAM, and write it to the card write-combined 2026-10-22 23:46:58 +02:00
hwinfo.h hwreport: describe a machine onto a USB stick, from a Linux-style /sys 2026-10-23 12:54:11 +02:00
input.h usb-hid: bind an absolute pointer, and plumb EV_ABS through 2026-08-10 18:27:01 +02:00
ioperm.h ldls: a second driver, and everything it found 2026-09-14 15:20:07 +02:00
irq.h acpi: uACPI, for interrupt routing, the power button and power-off 2026-10-22 16:12:28 +02:00
kbd.h kbd: three layouts, and the arrow keys were sitting on top of UTF-8 2026-09-20 01:09:32 +02:00
keymap.h kbd: three layouts, and the arrow keys were sitting on top of UTF-8 2026-09-20 01:09:32 +02:00
klog.h debugger: D5, the network transport -- and the plan closes 2026-09-14 15:33:53 +02:00
kmem.h kmem: a slab allocator, and what the fixed tables actually cost 2026-09-22 09:32:06 +02:00
logo.h docs: a branding folder, and the three marks are not interchangeable 2026-09-12 18:19:09 +02:00
memlayout.h kalloc: never-used memory stays a range; 256 GB; free is a counter 2026-10-23 14:05:40 +02:00
mmu.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
mp.h boot: stop assuming the machine is an emulator 2026-10-22 10:29:12 +02:00
netdev.h net: a frame wakes the stack, instead of waiting for the clock 2026-09-12 17:23:46 +02:00
netuser.h ldls: L4 was free after all, and the plan closes 2026-09-14 13:37:04 +02:00
param.h limits: 256 PCI functions, 128 sockets and devices, 64 USB interfaces 2026-10-23 13:54:37 +02:00
pci.h limits: 256 PCI functions, 128 sockets and devices, 64 USB interfaces 2026-10-23 13:54:37 +02:00
pciuser.h licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
posix.h licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
proc.h fpu: save each process's x87/SSE registers; keep the kernel off them 2026-10-23 15:02:01 +02:00
qr.h docs: four directories, and a rule for when a thing leaves the roadmap 2026-09-12 17:13:35 +02:00
sbuf.h debugger: D5, the network transport -- and the plan closes 2026-09-14 15:33:53 +02:00
schboot.h hwreport: describe a machine onto a USB stick, from a Linux-style /sys 2026-10-23 12:54:11 +02:00
schfs.h unix: a bound socket is a file 2026-09-22 10:06:10 +02:00
schinit.h licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
sleeplock.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
socket.h limits: 256 PCI functions, 128 sockets and devices, 64 USB interfaces 2026-10-23 13:54:37 +02:00
spinlock.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
stat.h unix: a bound socket is a file 2026-09-22 10:06:10 +02:00
syscall.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
text.h gfx: one glyph blitter, and a terminal cell is a surface 2026-09-23 17:57:16 +02:00
theme.h gfx: the console and the crash screen stop drawing on a driver by name 2026-08-15 17:04:10 +02:00
traps.h irq: MSI first, and poll the INTx lines that never arrive 2026-10-22 10:29:24 +02:00
ttf.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
types.h Initial commit: Schunix as it stands before the SchOS rename 2026-08-09 13:47:01 +02:00
uaccess.h exec: Linux's 2 MB of arguments; mmap: merge neighbouring mappings 2026-10-23 13:20:29 +02:00
usb.h usb: plug and play -- hot-plug, unplug, every interface, real mice 2026-10-22 11:38:13 +02:00
user.h hwreport: describe a machine onto a USB stick, from a Linux-style /sys 2026-10-23 12:54:11 +02:00
virtio.h hybrid: a modeset, from a process 2026-09-14 01:36:05 +02:00
vmap.h gfx: draw the console in RAM, and write it to the card write-combined 2026-10-22 23:46:58 +02:00
vt.h licence: SchOS is GPL-2.0-or-later, no longer Apache-2.0 2026-10-22 08:48:45 +02:00
x86.h fpu: save each process's x87/SSE registers; keep the kernel off them 2026-10-23 15:02:01 +02:00