Commit a5c15d41 authored by gorcunov@gmail.com's avatar gorcunov@gmail.com Committed by Ingo Molnar

x86: replace most VM86 flags with flags from processor-flags.h

Signed-off-by: default avatarCyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 6b6891f9
...@@ -489,7 +489,7 @@ static int __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs, ...@@ -489,7 +489,7 @@ static int __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
break; break;
case KPROBE_HIT_SS: case KPROBE_HIT_SS:
if (p == kprobe_running()) { if (p == kprobe_running()) {
regs->flags &= ~TF_MASK; regs->flags &= ~X86_EFLAGS_TF;
regs->flags |= kcb->kprobe_saved_flags; regs->flags |= kcb->kprobe_saved_flags;
return 0; return 0;
} else { } else {
......
...@@ -419,7 +419,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -419,7 +419,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
* The tracer may want to single-step inside the * The tracer may want to single-step inside the
* handler too. * handler too.
*/ */
regs->flags &= ~(TF_MASK | X86_EFLAGS_DF); regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
if (test_thread_flag(TIF_SINGLESTEP)) if (test_thread_flag(TIF_SINGLESTEP))
ptrace_notify(SIGTRAP); ptrace_notify(SIGTRAP);
...@@ -507,7 +507,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -507,7 +507,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
* The tracer may want to single-step inside the * The tracer may want to single-step inside the
* handler too. * handler too.
*/ */
regs->flags &= ~(TF_MASK | X86_EFLAGS_DF); regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
if (test_thread_flag(TIF_SINGLESTEP)) if (test_thread_flag(TIF_SINGLESTEP))
ptrace_notify(SIGTRAP); ptrace_notify(SIGTRAP);
......
...@@ -139,7 +139,7 @@ struct pt_regs *save_v86_state(struct kernel_vm86_regs *regs) ...@@ -139,7 +139,7 @@ struct pt_regs *save_v86_state(struct kernel_vm86_regs *regs)
printk("no vm86_info: BAD\n"); printk("no vm86_info: BAD\n");
do_exit(SIGSEGV); do_exit(SIGSEGV);
} }
set_flags(regs->pt.flags, VEFLAGS, VIF_MASK | current->thread.v86mask); set_flags(regs->pt.flags, VEFLAGS, X86_EFLAGS_VIF | current->thread.v86mask);
tmp = copy_vm86_regs_to_user(&current->thread.vm86_info->regs, regs); tmp = copy_vm86_regs_to_user(&current->thread.vm86_info->regs, regs);
tmp += put_user(current->thread.screen_bitmap, &current->thread.vm86_info->screen_bitmap); tmp += put_user(current->thread.screen_bitmap, &current->thread.vm86_info->screen_bitmap);
if (tmp) { if (tmp) {
...@@ -306,13 +306,13 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk ...@@ -306,13 +306,13 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
tsk->thread.v86mask = 0; tsk->thread.v86mask = 0;
break; break;
case CPU_386: case CPU_386:
tsk->thread.v86mask = NT_MASK | IOPL_MASK; tsk->thread.v86mask = X86_EFLAGS_NT | X86_EFLAGS_IOPL;
break; break;
case CPU_486: case CPU_486:
tsk->thread.v86mask = AC_MASK | NT_MASK | IOPL_MASK; tsk->thread.v86mask = X86_EFLAGS_AC | X86_EFLAGS_NT | X86_EFLAGS_IOPL;
break; break;
default: default:
tsk->thread.v86mask = ID_MASK | AC_MASK | NT_MASK | IOPL_MASK; tsk->thread.v86mask = X86_EFLAGS_ID | X86_EFLAGS_AC | X86_EFLAGS_NT | X86_EFLAGS_IOPL;
break; break;
} }
...@@ -363,24 +363,24 @@ static inline void return_to_32bit(struct kernel_vm86_regs *regs16, int retval) ...@@ -363,24 +363,24 @@ static inline void return_to_32bit(struct kernel_vm86_regs *regs16, int retval)
static inline void set_IF(struct kernel_vm86_regs *regs) static inline void set_IF(struct kernel_vm86_regs *regs)
{ {
VEFLAGS |= VIF_MASK; VEFLAGS |= X86_EFLAGS_VIF;
if (VEFLAGS & VIP_MASK) if (VEFLAGS & X86_EFLAGS_VIP)
return_to_32bit(regs, VM86_STI); return_to_32bit(regs, VM86_STI);
} }
static inline void clear_IF(struct kernel_vm86_regs *regs) static inline void clear_IF(struct kernel_vm86_regs *regs)
{ {
VEFLAGS &= ~VIF_MASK; VEFLAGS &= ~X86_EFLAGS_VIF;
} }
static inline void clear_TF(struct kernel_vm86_regs *regs) static inline void clear_TF(struct kernel_vm86_regs *regs)
{ {
regs->pt.flags &= ~TF_MASK; regs->pt.flags &= ~X86_EFLAGS_TF;
} }
static inline void clear_AC(struct kernel_vm86_regs *regs) static inline void clear_AC(struct kernel_vm86_regs *regs)
{ {
regs->pt.flags &= ~AC_MASK; regs->pt.flags &= ~X86_EFLAGS_AC;
} }
/* /*
...@@ -399,7 +399,7 @@ static inline void set_vflags_long(unsigned long flags, struct kernel_vm86_regs ...@@ -399,7 +399,7 @@ static inline void set_vflags_long(unsigned long flags, struct kernel_vm86_regs
{ {
set_flags(VEFLAGS, flags, current->thread.v86mask); set_flags(VEFLAGS, flags, current->thread.v86mask);
set_flags(regs->pt.flags, flags, SAFE_MASK); set_flags(regs->pt.flags, flags, SAFE_MASK);
if (flags & IF_MASK) if (flags & X86_EFLAGS_IF)
set_IF(regs); set_IF(regs);
else else
clear_IF(regs); clear_IF(regs);
...@@ -409,7 +409,7 @@ static inline void set_vflags_short(unsigned short flags, struct kernel_vm86_reg ...@@ -409,7 +409,7 @@ static inline void set_vflags_short(unsigned short flags, struct kernel_vm86_reg
{ {
set_flags(VFLAGS, flags, current->thread.v86mask); set_flags(VFLAGS, flags, current->thread.v86mask);
set_flags(regs->pt.flags, flags, SAFE_MASK); set_flags(regs->pt.flags, flags, SAFE_MASK);
if (flags & IF_MASK) if (flags & X86_EFLAGS_IF)
set_IF(regs); set_IF(regs);
else else
clear_IF(regs); clear_IF(regs);
...@@ -419,9 +419,9 @@ static inline unsigned long get_vflags(struct kernel_vm86_regs *regs) ...@@ -419,9 +419,9 @@ static inline unsigned long get_vflags(struct kernel_vm86_regs *regs)
{ {
unsigned long flags = regs->pt.flags & RETURN_MASK; unsigned long flags = regs->pt.flags & RETURN_MASK;
if (VEFLAGS & VIF_MASK) if (VEFLAGS & X86_EFLAGS_VIF)
flags |= IF_MASK; flags |= X86_EFLAGS_IF;
flags |= IOPL_MASK; flags |= X86_EFLAGS_IOPL;
return flags | (VEFLAGS & current->thread.v86mask); return flags | (VEFLAGS & current->thread.v86mask);
} }
...@@ -573,11 +573,11 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code) ...@@ -573,11 +573,11 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code)
#define CHECK_IF_IN_TRAP \ #define CHECK_IF_IN_TRAP \
if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \ if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \
newflags |= TF_MASK newflags |= X86_EFLAGS_TF
#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 & (X86_EFLAGS_IF | X86_EFLAGS_VIF))) \
return_to_32bit(regs, VM86_PICRETURN); \ return_to_32bit(regs, VM86_PICRETURN); \
if (orig_flags & TF_MASK) \ if (orig_flags & X86_EFLAGS_TF) \
handle_vm86_trap(regs, 0, 1); \ handle_vm86_trap(regs, 0, 1); \
return; } while (0) return; } while (0)
......
...@@ -12,19 +12,13 @@ ...@@ -12,19 +12,13 @@
* Linus * Linus
*/ */
#define TF_MASK 0x00000100 #include <asm/processor-flags.h>
#define IF_MASK 0x00000200
#define IOPL_MASK 0x00003000
#define NT_MASK 0x00004000
#ifdef CONFIG_VM86 #ifdef CONFIG_VM86
#define X86_VM_MASK X86_EFLAGS_VM #define X86_VM_MASK X86_EFLAGS_VM
#else #else
#define X86_VM_MASK 0 /* No VM86 support */ #define X86_VM_MASK 0 /* No VM86 support */
#endif #endif
#define AC_MASK 0x00040000
#define VIF_MASK 0x00080000 /* virtual interrupt flag */
#define VIP_MASK 0x00100000 /* virtual interrupt pending */
#define ID_MASK 0x00200000
#define BIOSSEG 0x0f000 #define BIOSSEG 0x0f000
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment