mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 07:13:54 -06:00
use target_mmap() to allocate idt, gdt and ldt (Kirill A. Shutemov).
env->*dt.base should fit target address space, so we should use target_mmap to allocate them. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5666 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
8ce0f86993
commit
e441570f8a
2 changed files with 23 additions and 12 deletions
|
@ -2565,12 +2565,16 @@ static abi_long write_ldt(CPUX86State *env,
|
|||
}
|
||||
/* allocate the LDT */
|
||||
if (!ldt_table) {
|
||||
ldt_table = malloc(TARGET_LDT_ENTRIES * TARGET_LDT_ENTRY_SIZE);
|
||||
if (!ldt_table)
|
||||
env->ldt.base = target_mmap(0,
|
||||
TARGET_LDT_ENTRIES * TARGET_LDT_ENTRY_SIZE,
|
||||
PROT_READ|PROT_WRITE,
|
||||
MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
|
||||
if (env->ldt.base == -1)
|
||||
return -TARGET_ENOMEM;
|
||||
memset(ldt_table, 0, TARGET_LDT_ENTRIES * TARGET_LDT_ENTRY_SIZE);
|
||||
env->ldt.base = h2g((unsigned long)ldt_table);
|
||||
memset(g2h(env->ldt.base), 0,
|
||||
TARGET_LDT_ENTRIES * TARGET_LDT_ENTRY_SIZE);
|
||||
env->ldt.limit = 0xffff;
|
||||
ldt_table = g2h(env->ldt.base);
|
||||
}
|
||||
|
||||
/* NOTE: same code as Linux kernel */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue