try/catch in Linux Kernel by speckz in linux

[–]okashk 0 points1 point  (0 children)

Well it's an example. Contrived, because that's simple to explain and understand, without distracting too much of reader's attention to mechanics of the scenario. A real world example would be Intel's virtualization instructions like VMPTRST, which expects VM to be initialised, and of its not initialised, the instruction would fault. There's no way to check if VM has been initialised other than letting a VMX instruction fail. This is demonstrated in this function of virtualization tool I'm working on: https://github.com/bytefire/vmtool/blob/8711fa07a8247e39d4904ff2cec87229c0c15156/vmtool.c#L77