[SeaBIOS] 64bit support in SeaBIOS

Stefan Hajnoczi stefanha at gmail.com
Tue Aug 25 08:19:46 CET 2015

On Sat, Aug 22, 2015 at 5:02 PM, Marc Marí <markmb at redhat.com> wrote:
> I'm working on basic 64 bit support for SeaBIOS. The reason now is
> because I want to test booting from an NVDIMM, which is mapped on the
> region above 4G:
> http://lists.gnu.org/archive/html/qemu-devel/2015-08/msg01774.html
> But this feature will also add support for future memory devices that
> may be added. Below 4G region is getting too crowded. Another
> possibility is to load Linux directly from 64 bits, instead of 16.
> I'm now a bit lost on how to continue on this task. I'm not sure if I'm
> in the right way, and I'm not sure if I'm overworking things.
> You can see my little progress here:
> https://github.com/mark-mb/seabios_64/
> Does anyone else want to engage in this project?

Regarding transition64, I suggest reading the Intel manuals for each
step in that function.  Your comments suggest it is incomplete/not

A good way to get this working is to start with an infinite loop:
    jmp entry64

See if you can get the guest to spin in the loop (in long mode).  The
QEMU gdbstub can be useful for debugging/verifying this (see the qemu
-s option).

The next step is to implement the 64-bit to 16-bit mode transition.
Change the code to:
    mov $1, %rax

transition64 should switch back to 16-bit mode after the 64-bit
function (entry64) returns.  Again, use QEMU's gdbstub to debug this
(you may need to tell GDB which "target" you want so 16-bit/64-bit CPU
state is displayed correctly).

Once the transitions work you can simply use it for a 64-bit memcpy.
This means the only 64-bit code will copy data from NVDIMM down into
the lower 4 GB.


More information about the SeaBIOS mailing list