While investigating the video modes on my laptop to do some sanity checking I thought I'd have a go at using libx86 to allow me to call into the BIOS directly from userspace. After short consultation with the trusty Ralph Brown Interrupt List, I hacked up some code to get the list of all the video modes and interrogate each one to get the resolution.
I was getting random crashes before I realised that clearing the LRMI_regs struct before populating it with the desired x86 register settings fixed the problem.
Anyhow, the code is available in my git repository here - and it requires one to install libx86-dev and run with root privileges. I'm still amazed that the code can jump from userspace into the BIOS, gather data and return without totally messing up the system.
Interestingly, a lot of UEFI systems still provide a legacy mode BIOS, so this code still works on these newer systems.