[haiku-development] vm86 Question

I'm working on an enhancement to the S3 video driver to use the vm86 functions to obtain the EDID info from the video BIOS when the current S3 EDID code is unable to get the EDID info. I've tried it with the Trio64 chips and it works fine; however I have a question about how an address is selected for the buffer to receive the data from the BIOS. I used the following function from file src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp as an example for how to set up my code:

static status_t
vbe_get_mode_info(struct vm86_state *vmState, uint16 mode,
   struct vbe_mode_info *modeInfo)
{
   struct vbe_mode_info *vbeModeInfo = (struct vbe_mode_info *)0x1000;

   memset(vbeModeInfo, 0, sizeof(vbe_mode_info));
   vmState->regs.eax = 0x4f01;
   vmState->regs.ecx = mode;
   vmState->regs.es  = 0x1000 >> 4;
   vmState->regs.edi = 0x0000;

   status_t status = vm86_do_int(vmState, 0x10);

   ...
}

My question: Is there any particular reason that 0x1000 is used as the address for vbeModeInfo which is then set in the es & edi regs.? From trial & error with the EDID code in the S3 driver, it appears that any address can be used as long as the address and the data are completely within the ram area set up by a previous call to vm86_prepare(). Is this correct? The ram area has a starting address of 0.

Best regards,
Gerald



Other related posts: