For some reason HN ate my previous comment Doing OS things is hard. In x86 it's extra hard x86 is one kludge on top of another. Like interrupt chaining These issues remind me of making a Sound Blaster card work on DOS (I was making a program to play a simple file in Pascal/C) It's very complicated, and several trials to make it work (and no Stackoverflow, Wikis, etc)
From OS perspective, it's also overcomplicated: switching from real to protected mode is an exercise in doing every action in a long chain properly and in the right order or the whole undertaking fails. Remapping IRQs into interrupts that do not mess with the CPU internal exceptions, weird legacy memory layout with BIOS, a slew of CPU modes (real/protected/PAE/long/etc), crazy format of entries in Interrupt Descriptor Table (where four bits of a pointer may be stored separately from the main part), where bits are often used differently for different contexts; redundant built-in features like poor multitasking support (Linux and other sane kernels try to avoid it as much as possible, but it's still is not possible to go into kernel mode from userspace without filling kernel stack pointer into a TSS entry), memory segments (in protected mode, where a pointer can address the whole virtual memory unlike real mode), four privilege rings (whereas all modern OSes use two: 0 for kernel space and 3 for userspace).
All that does not feel like it should be and often it only gets worse.