[SeaBIOS] Help with 16bit and 32bitFlat

Kevin O'Connor kevin at koconnor.net
Thu Oct 20 14:57:18 CEST 2011


On Thu, Oct 20, 2011 at 11:44:50AM +0200, Gerd Hoffmann wrote:
> >> The disk access code is called from 16bit mode, and thus it needs to
> >> be compiled in 16bit mode.  The link errors you are seeing are there
> >> to force a build error (instead of failing mysterously at run time).
> >>
> >> What does your driver do that requires 32bit mode?
> 
> Access special pages for communication with the hypervisor (grant
> tables, request ring).

If Xen just wants to run its handler in 32bit mode (and doesn't care
about vm86 mode), it should be possible to do something like:

int process_xen_op(struct disk_op_s *op) {
    extern void _cfunc32flat_process_xen32_op(struct disk_op_s *);
    return call32(_cfunc32flat_process_xen32_op, op, DISK_RET_EPARAM);
}

int VISIBLE32FLAT
process_xen32_op(struct disk_op_s *op) {
    if (! CONFIG_XEN_DISK_HANDLER)
        return 0;
    ...
}

Be aware that stack space is still limited here though (~512 bytes).

-Kevin



More information about the SeaBIOS mailing list