UC_OPT_WINDOWS_TIB: Windows 64 uses GS segment rather than FS segment for TIB

This commit is contained in:
Nguyen Anh Quynh 2016-03-22 15:17:56 +08:00
parent 1b16b5e8fe
commit 03aed19145

View file

@ -1128,8 +1128,18 @@ static uc_err x86_option(struct uc_struct *uc, uc_opt_type type, size_t value)
if (type != UC_OPT_WINDOWS_TIB) if (type != UC_OPT_WINDOWS_TIB)
return UC_ERR_OPT_INVALID; return UC_ERR_OPT_INVALID;
switch(uc->mode) {
default:
break;
case UC_MODE_32:
// TODO: setup limit? // TODO: setup limit?
X86_CPU(uc, mycpu)->env.segs[R_FS].base = value; X86_CPU(uc, mycpu)->env.segs[R_FS].base = value;
break;
case UC_MODE_64:
// TODO: setup limit?
X86_CPU(uc, mycpu)->env.segs[R_GS].base = value;
break;
}
return UC_ERR_OK; return UC_ERR_OK;
} }