Commit dd6ee15c37c9cbb387db17f26f4daaf4798556fd
1 parent
0db63474
fixed idt/gdt relocation bug - added support for Redhat kernels
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@413 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
5 additions
and
2 deletions
vl.c
... | ... | @@ -3737,10 +3737,13 @@ int main(int argc, char **argv) |
3737 | 3737 | |
3738 | 3738 | params->gdt_table[2] = 0x00cf9a000000ffffLL; /* KERNEL_CS */ |
3739 | 3739 | params->gdt_table[3] = 0x00cf92000000ffffLL; /* KERNEL_DS */ |
3740 | + /* for newer kernels (2.6.0) CS/DS are at different addresses */ | |
3741 | + params->gdt_table[12] = 0x00cf9a000000ffffLL; /* KERNEL_CS */ | |
3742 | + params->gdt_table[13] = 0x00cf92000000ffffLL; /* KERNEL_DS */ | |
3740 | 3743 | |
3741 | - env->idt.base = (void *)params->idt_table; | |
3744 | + env->idt.base = (void *)((uint8_t *)params->idt_table - phys_ram_base); | |
3742 | 3745 | env->idt.limit = sizeof(params->idt_table) - 1; |
3743 | - env->gdt.base = (void *)params->gdt_table; | |
3746 | + env->gdt.base = (void *)((uint8_t *)params->gdt_table - phys_ram_base); | |
3744 | 3747 | env->gdt.limit = sizeof(params->gdt_table) - 1; |
3745 | 3748 | |
3746 | 3749 | cpu_x86_load_seg_cache(env, R_CS, KERNEL_CS, NULL, 0xffffffff, 0x00cf9a00); | ... | ... |