Possible problem with the DF flag during the SYSCALL instruction
Hi,
yesterday I tried to mask off the DF flag from the RFLAGS register during the SYSCALL instruction by specifying this bit in the SFMASK MSR register while running HelenOS.
With QEMU, this didn't work (but it worked in Simics, for instance), so I suspect that there is something wrong with handling RFLAGS.DF during SYSCALL. Anyone wants to have a look?
Regards,
Jakub
Quoted 3 lines · Jakub Jermar
yesterday I tried to mask off the DF flag from the RFLAGS register during the SYSCALL instruction by specifying this bit in the SFMASK MSR register while running HelenOS.
With QEMU, this didn't work (but it worked in Simics, for instance), so I suspect that there is something wrong with handling RFLAGS.DF during SYSCALL. Anyone wants to have a look?
I have looked into the problem a little more and found out that the culprit here is probably a missing update of the DF variable in the helper_syscall() function, in target-i386/helper.c. See the attached patch.
The patch fixes the problem for me, but is probably not complete (i.e. there might be other places that need a similar treatment), but I can't really tell since I am not a qemu expert.
Jakub
helper.c.new renamed from helper.c +1 -0
@@ -1008,6 +1008,7 @@ DESC_S_MASK | DESC_W_MASK | DESC_A_MASK); env->eflags &= ~env->fmask; + DF = 1 - (2 * ((env->eflags >> 10) & 1)); if (code64) env->eip = env->lstar; else