[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] Add optionrom compatible with fw_cfg DMA versio
From: |
Paolo Bonzini |
Subject: |
Re: [Qemu-devel] [PATCH] Add optionrom compatible with fw_cfg DMA version |
Date: |
Fri, 8 Jan 2016 16:54:07 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
On 08/01/2016 15:58, Marc Marí wrote:
>
> +static inline uint16_t readw_addr32(const void *addr) {
> + uint16_t val;
> + asm("addr32 movw %1, %0" : "=r"(val) : "g"(addr));
> + barrier();
> + return val;
> +}
> +
Does SeaBIOS ensure that DS base is zero here?
> +static void transition32(void)
> +{
> + extern void *gdt;
> + uint32_t data_segment;
> + struct length_addr rombios_gdt;
> +
> + data_segment = read_ds();
> + rombios_gdt.addr = (uint32_t)((data_segment << 4) + (uint32_t)(&gdt));
> + rombios_gdt.length = (3 * 8) - 1;
> +
> + /* Load GDT */
> + asm("data32 lgdt %0" : : "m"(rombios_gdt): "memory");
> +
> + /* Get us to protected mode and set ES to a 32 bit segment */
> + asm("mov $1, %%eax\n"
> + "mov %%eax, %%cr0\n"
> + "mov $0x10, %%eax\n"
> + "mov %%eax, %%es\n"
> + : : : "eax");
> +
> + /* We're now running in 16-bit CS, but 32-bit ES! */
> +}
Do you even need to go to 32-bit mode? The only reason to do so in the
original ROM was to do a "rep insb" above 1 GB, but here fw_cfg can do
DMA to high addresses for you.
Paolo