This patch series is an update to the patch I sent at: https://lists.gnu.org/archive/html/qemu-devel/2014-04/msg04028.html
The goal of the patch series is to fix the SMM handler so that it runs with the proper cpl. I've broken the series up based on the feedback from Paolo. As with the previous patch, this series moves cr0 and eflags changes above cpu_x86_load_seg_cache() calls as cpu_x86_load_seg_cache() inspects those flags. I didn't move the eflags setting in helper_ret_protected() because I don't think I can easily move the eflags logic (it's not clear to me that it is safe to change eflags prior to exception checks) and helper_ret_protected() doesn't change any eflags bits that cpu_x86_load_seg_cache() cares about. That said, continuing to have cpu_x86_load_seg_cache() depend on cr0 and eflags is painful. I do wonder if it would be better to calculate hflags lazily to eliminate these ordering issues. -Kevin Kevin O'Connor (4): Set eflags prior to calling svm_load_seg_cache() in svm_helper.c. Set eflags and cr0 prior to calling cpu_x86_load_seg_cache() in smm_helper.c. Set eflags prior to calling cpu_x86_load_seg_cache() in seg_helper.c. The x86 CPL is stored in CS.selector - auto update hflags accordingly. bsd-user/main.c | 2 -- linux-user/main.c | 2 -- target-i386/cpu.h | 25 +++++++++++------------ target-i386/seg_helper.c | 53 +++++++++++++++++------------------------------- target-i386/smm_helper.c | 34 +++++++++++++++---------------- target-i386/svm_helper.c | 11 ++-------- 6 files changed, 50 insertions(+), 77 deletions(-) -- 1.9.0