I finally got an AC'97 driver working in BoredOS!
After about 2.5 weeks of banging my head against this (alongside building out NTK), I've got a proper AC97 driver in a solid state and wanted to share. The driver is interrupt-driven with a kernel mixer thread that handles up to 8 concurrent clients. Each client gets its own ring buffer and linear-interpolated sample-rate conversion to 48 kHz. One thing that bit me early on: QEMU's AC97 emulation doesn't actually apply the NAM register gains to the DMA stream, so volume control has to live in the software mixer path instead. Userspace talks to it through /dev/dsp using the standard OSS ioctls (SNDCTL_DSP_SPEED, SNDCTL_DSP_SETFMT, etc.) and just writes PCM. There's also a /dev/mixer node for master/PCM gain. I also wrote a simple utility that handles WAV and MP3 files (via minimp3), feeding into a ring of 32 pre-allocated 16 KB DMA buffers.
shit, almost forgot: