1. 9

  2. 2

    The x86, despite all its foibles (of which it had more than a few) had some really nice stuff for OS support, like hardware task switching, that most modern operating systems abandoned due to portability concerns. x86_64 went so far as to neuter hardware task switching entirely in long mode.

    Other features useful to operating system support on the x86 that were more-or-less ignored were multiple protection rings (generally only one or two are used), selective mapping of the IO address space depending per process (used occasionally, but not nearly as often as it should given how neat the feature is…), and segmentation in protected mode (everyone always just sets the segment registers to all of memory).

    One neat use of the last point there (segmentation in protected mode) is vx32, which allowed SFI-based embedded x86 execution environments in user space.

    1. 1

      para 1

      I think that stuff in 286 seemed to be a relic of when it was trying to be a “baby” iAPX 432 of sorts. Intel seems to de-emphasized that stuff pretty early on.

      para 2

      OS/2 used all four rings, AFAIK.

    2. 1

      The do { ... } while (0) syntax is so that the macro can be invoked like switch_to(...);. Relevant kernel style. Funnily enough, the author comments on this on their coreutils page (in the section “C idioms”).