x86_pcbios_shadow_rom()

int x86_pcbios_shadow_rom(paddr_t rom, 
                          size_t size);

Given the physical address of a ROM BIOS extension, this function makes a copy of the ROM in a RAM location and sets the x86 page tables in the _syspage_ptr->un.x86.real_addr range to refer to the RAM copy rather than the ROM version. When something runs in V86 mode, it'll use the RAM locations when accessing the memory.

The amount of ROM shadowed is the maximum of the size parameter and the size indicated by the third byte of the BIOS extension.

The function returns:

0
if there's no ROM BIOS extension signature at the address given
1
if you're starting the system in physical mode and there's no MMU to make a RAM copy be referenced
2
if everything works.