How to distribute interrupts between multiple cores in low level x86 assembly?

I've been screwing around with x86 assembly recently and the so called Unreal-mode, and I just got multiple CPUs running code simultaneous in DOS. Currently when it comes to old fashion interrupts like keyboard and timer, it seems that only the first CPU reacts to them. I'm guessing one should somehow configure the APIC with which core responds to which interrupt, but I don't know how to do this yet. I suppose I would eventually dig this info from somewhere, but I would appreciate it if someone familiar with the subject has simple examples of how to do this.

In case anyone is interested, I posted my code here: https://pastebin.com/4YJULxin. The first core responds to timer interrupt by incrementing the first character on the screen and the second core is simultaneously incrementing the second at much higher rate. That's all the code does for the time being. It runs only without EMM386 because of obvious reasons. Tested in FreeDOS.

I was thinking of running an adlib emulator to generate PCM on the other core so that PCI sound card that is not normally compatible could be made to work with DOS games. Then I just trap port writes to 388h and 389h when the game is trying to write, and update registers for the second core so it can keep generating the waveforms and respond to the sound card interrupts. I already dug adlib emulation code from dosbox and it seems fairly easy to get it to run standalone.

This is a hobby project so I'm not interested in doing it the easy way. Rather, I specifically want to see everything as low level as possible, minimize all latency, make everything as synchronous as possible, understand stuff on port and memory address level, and so forth.

Posted Mar 17, 2021, 6:23 PM UTC

291
Ikkepop•

I kind of feel that r/osdev would be able to answer this easier :o

7