Writing OS/2 SMP device drivers

Writing SMP safe OS/2 device drivers is actually very simple with Warp Server SMP. OS/2 guarantees that most (if not all) device drivers execute only on the first processor. There are a couple of gotchas, though. For one thing, do not rely on the following code:

This will NOT restore the interrupt enable flag at least on OS/2 2.11SMP. Instead, use the following code: Also, for OS/2 2.11 SMP it is much faster to use spinlock calls instead of CLI/STI. OS/2 2.11 SMP will trap all CLI/STI calls and block all processors. Warp Server SMP is just the opposite. Warp Server SMP does not trap CLI/STI calls and spinlock calls are much slower.

One thing not documented is that spinlocks can be nested on the same processor. This means that you can replace all of your pushf/cli/etc. code with spinlocks without having to worry about nesting.

[Back]