I continued to study code from other kernels (Linux, xv6, DragonFly) and tried to improve my code.
I am now able to process external interrupts from the keyboard on an application core (fixed addressing) without raising interrupt priority. The vector in the IOAPIC for the IOAPIC is set to 0x21. This works in qemu and an old dual core laptop (Thinkpad x60s).
However, another old laptop (also 2 cores) does not process the keyboard interrupts on the application core. An the 8 core machine (Intel i7-4770) also refuses to process external interrupts on any application core.
I played around with xv6 [1]. In qemu it works, like my code.
Today I installed xv6 on the 8 core machine and can boot it using grub2 (following the instructions here [2]) and xv6 has the same problem.
In ioapic.cc there is the function:
ioapiceanble(int irq, int cpunum)
Setting cpunum to 0 (bootstrap processor) works but setting cpunum to 1 (application processor) does not work.
[1]
https://github.com/mit-pdos/xv6-public[2]
https://hoblovski.github.io/2019/03/16/ ... -grub.html