[PATCH] vm86: Honor TF bit when emulating an instruction
If the virtual 86 machine reaches an instruction which raises a General Protection Fault (such as CLI or STI), the instruction is emulated (in handle_vm86_fault). However, the emulation ignored the TF bit, so the hardware debug interrupt was not invoked after such an emulated instruction (and the DOS debugger missed it). This patch fixes the problem by emulating the hardware debug interrupt as the last action before control is returned to the VM86 program. Signed-off-by: Petr Tesarik <kernel@tesarici.cz> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
7ae65fd334
commit
5fd75ebb1a
|
@ -542,7 +542,7 @@ void handle_vm86_fault(struct kernel_vm86_regs * regs, long error_code)
|
||||||
unsigned char opcode;
|
unsigned char opcode;
|
||||||
unsigned char __user *csp;
|
unsigned char __user *csp;
|
||||||
unsigned char __user *ssp;
|
unsigned char __user *ssp;
|
||||||
unsigned short ip, sp;
|
unsigned short ip, sp, orig_flags;
|
||||||
int data32, pref_done;
|
int data32, pref_done;
|
||||||
|
|
||||||
#define CHECK_IF_IN_TRAP \
|
#define CHECK_IF_IN_TRAP \
|
||||||
|
@ -551,8 +551,12 @@ void handle_vm86_fault(struct kernel_vm86_regs * regs, long error_code)
|
||||||
#define VM86_FAULT_RETURN do { \
|
#define VM86_FAULT_RETURN do { \
|
||||||
if (VMPI.force_return_for_pic && (VEFLAGS & (IF_MASK | VIF_MASK))) \
|
if (VMPI.force_return_for_pic && (VEFLAGS & (IF_MASK | VIF_MASK))) \
|
||||||
return_to_32bit(regs, VM86_PICRETURN); \
|
return_to_32bit(regs, VM86_PICRETURN); \
|
||||||
|
if (orig_flags & TF_MASK) \
|
||||||
|
handle_vm86_trap(regs, 0, 1); \
|
||||||
return; } while (0)
|
return; } while (0)
|
||||||
|
|
||||||
|
orig_flags = *(unsigned short *)®s->eflags;
|
||||||
|
|
||||||
csp = (unsigned char __user *) (regs->cs << 4);
|
csp = (unsigned char __user *) (regs->cs << 4);
|
||||||
ssp = (unsigned char __user *) (regs->ss << 4);
|
ssp = (unsigned char __user *) (regs->ss << 4);
|
||||||
sp = SP(regs);
|
sp = SP(regs);
|
||||||
|
|
Loading…
Reference in New Issue