aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgorcunov@gmail.com <gorcunov@gmail.com>2008-03-28 10:56:56 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:33 -0400
commita5c15d419d4b68535222b51f9054dd08d5e67470 (patch)
treeab6bebec8b83ec7c688a6f2c23979d10a4da3aa1
parent6b6891f9c545ccd45d6d8ddfd33ce27c22c271a7 (diff)
x86: replace most VM86 flags with flags from processor-flags.h
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/kprobes.c2
-rw-r--r--arch/x86/kernel/signal_32.c4
-rw-r--r--arch/x86/kernel/vm86_32.c34
-rw-r--r--include/asm-x86/vm86.h10
4 files changed, 22 insertions, 28 deletions
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index cc8ae90103ff..b8c6743a13da 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -489,7 +489,7 @@ static int __kprobes reenter_kprobe(struct kprobe *p, struct pt_regs *regs,
489 break; 489 break;
490 case KPROBE_HIT_SS: 490 case KPROBE_HIT_SS:
491 if (p == kprobe_running()) { 491 if (p == kprobe_running()) {
492 regs->flags &= ~TF_MASK; 492 regs->flags &= ~X86_EFLAGS_TF;
493 regs->flags |= kcb->kprobe_saved_flags; 493 regs->flags |= kcb->kprobe_saved_flags;
494 return 0; 494 return 0;
495 } else { 495 } else {
diff --git a/arch/x86/kernel/signal_32.c b/arch/x86/kernel/signal_32.c
index aa1b6a0a22e4..f1b117930837 100644
--- a/arch/x86/kernel/signal_32.c
+++ b/arch/x86/kernel/signal_32.c
@@ -419,7 +419,7 @@ setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
419 * The tracer may want to single-step inside the 419 * The tracer may want to single-step inside the
420 * handler too. 420 * handler too.
421 */ 421 */
422 regs->flags &= ~(TF_MASK | X86_EFLAGS_DF); 422 regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
423 if (test_thread_flag(TIF_SINGLESTEP)) 423 if (test_thread_flag(TIF_SINGLESTEP))
424 ptrace_notify(SIGTRAP); 424 ptrace_notify(SIGTRAP);
425 425
@@ -507,7 +507,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
507 * The tracer may want to single-step inside the 507 * The tracer may want to single-step inside the
508 * handler too. 508 * handler too.
509 */ 509 */
510 regs->flags &= ~(TF_MASK | X86_EFLAGS_DF); 510 regs->flags &= ~(X86_EFLAGS_TF | X86_EFLAGS_DF);
511 if (test_thread_flag(TIF_SINGLESTEP)) 511 if (test_thread_flag(TIF_SINGLESTEP))
512 ptrace_notify(SIGTRAP); 512 ptrace_notify(SIGTRAP);
513 513
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index c866c00f4a85..38f566fa27d2 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -139,7 +139,7 @@ struct pt_regs *save_v86_state(struct kernel_vm86_regs *regs)
139 printk("no vm86_info: BAD\n"); 139 printk("no vm86_info: BAD\n");
140 do_exit(SIGSEGV); 140 do_exit(SIGSEGV);
141 } 141 }
142 set_flags(regs->pt.flags, VEFLAGS, VIF_MASK | current->thread.v86mask); 142 set_flags(regs->pt.flags, VEFLAGS, X86_EFLAGS_VIF | current->thread.v86mask);
143 tmp = copy_vm86_regs_to_user(&current->thread.vm86_info->regs, regs); 143 tmp = copy_vm86_regs_to_user(&current->thread.vm86_info->regs, regs);
144 tmp += put_user(current->thread.screen_bitmap, &current->thread.vm86_info->screen_bitmap); 144 tmp += put_user(current->thread.screen_bitmap, &current->thread.vm86_info->screen_bitmap);
145 if (tmp) { 145 if (tmp) {
@@ -306,13 +306,13 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
306 tsk->thread.v86mask = 0; 306 tsk->thread.v86mask = 0;
307 break; 307 break;
308 case CPU_386: 308 case CPU_386:
309 tsk->thread.v86mask = NT_MASK | IOPL_MASK; 309 tsk->thread.v86mask = X86_EFLAGS_NT | X86_EFLAGS_IOPL;
310 break; 310 break;
311 case CPU_486: 311 case CPU_486:
312 tsk->thread.v86mask = AC_MASK | NT_MASK | IOPL_MASK; 312 tsk->thread.v86mask = X86_EFLAGS_AC | X86_EFLAGS_NT | X86_EFLAGS_IOPL;
313 break; 313 break;
314 default: 314 default:
315 tsk->thread.v86mask = ID_MASK | AC_MASK | NT_MASK | IOPL_MASK; 315 tsk->thread.v86mask = X86_EFLAGS_ID | X86_EFLAGS_AC | X86_EFLAGS_NT | X86_EFLAGS_IOPL;
316 break; 316 break;
317 } 317 }
318 318
@@ -363,24 +363,24 @@ static inline void return_to_32bit(struct kernel_vm86_regs *regs16, int retval)
363 363
364static inline void set_IF(struct kernel_vm86_regs *regs) 364static inline void set_IF(struct kernel_vm86_regs *regs)
365{ 365{
366 VEFLAGS |= VIF_MASK; 366 VEFLAGS |= X86_EFLAGS_VIF;
367 if (VEFLAGS & VIP_MASK) 367 if (VEFLAGS & X86_EFLAGS_VIP)
368 return_to_32bit(regs, VM86_STI); 368 return_to_32bit(regs, VM86_STI);
369} 369}
370 370
371static inline void clear_IF(struct kernel_vm86_regs *regs) 371static inline void clear_IF(struct kernel_vm86_regs *regs)
372{ 372{
373 VEFLAGS &= ~VIF_MASK; 373 VEFLAGS &= ~X86_EFLAGS_VIF;
374} 374}
375 375
376static inline void clear_TF(struct kernel_vm86_regs *regs) 376static inline void clear_TF(struct kernel_vm86_regs *regs)
377{ 377{
378 regs->pt.flags &= ~TF_MASK; 378 regs->pt.flags &= ~X86_EFLAGS_TF;
379} 379}
380 380
381static inline void clear_AC(struct kernel_vm86_regs *regs) 381static inline void clear_AC(struct kernel_vm86_regs *regs)
382{ 382{
383 regs->pt.flags &= ~AC_MASK; 383 regs->pt.flags &= ~X86_EFLAGS_AC;
384} 384}
385 385
386/* 386/*
@@ -399,7 +399,7 @@ static inline void set_vflags_long(unsigned long flags, struct kernel_vm86_regs
399{ 399{
400 set_flags(VEFLAGS, flags, current->thread.v86mask); 400 set_flags(VEFLAGS, flags, current->thread.v86mask);
401 set_flags(regs->pt.flags, flags, SAFE_MASK); 401 set_flags(regs->pt.flags, flags, SAFE_MASK);
402 if (flags & IF_MASK) 402 if (flags & X86_EFLAGS_IF)
403 set_IF(regs); 403 set_IF(regs);
404 else 404 else
405 clear_IF(regs); 405 clear_IF(regs);
@@ -409,7 +409,7 @@ static inline void set_vflags_short(unsigned short flags, struct kernel_vm86_reg
409{ 409{
410 set_flags(VFLAGS, flags, current->thread.v86mask); 410 set_flags(VFLAGS, flags, current->thread.v86mask);
411 set_flags(regs->pt.flags, flags, SAFE_MASK); 411 set_flags(regs->pt.flags, flags, SAFE_MASK);
412 if (flags & IF_MASK) 412 if (flags & X86_EFLAGS_IF)
413 set_IF(regs); 413 set_IF(regs);
414 else 414 else
415 clear_IF(regs); 415 clear_IF(regs);
@@ -419,9 +419,9 @@ static inline unsigned long get_vflags(struct kernel_vm86_regs *regs)
419{ 419{
420 unsigned long flags = regs->pt.flags & RETURN_MASK; 420 unsigned long flags = regs->pt.flags & RETURN_MASK;
421 421
422 if (VEFLAGS & VIF_MASK) 422 if (VEFLAGS & X86_EFLAGS_VIF)
423 flags |= IF_MASK; 423 flags |= X86_EFLAGS_IF;
424 flags |= IOPL_MASK; 424 flags |= X86_EFLAGS_IOPL;
425 return flags | (VEFLAGS & current->thread.v86mask); 425 return flags | (VEFLAGS & current->thread.v86mask);
426} 426}
427 427
@@ -573,11 +573,11 @@ void handle_vm86_fault(struct kernel_vm86_regs *regs, long error_code)
573 573
574#define CHECK_IF_IN_TRAP \ 574#define CHECK_IF_IN_TRAP \
575 if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \ 575 if (VMPI.vm86dbg_active && VMPI.vm86dbg_TFpendig) \
576 newflags |= TF_MASK 576 newflags |= X86_EFLAGS_TF
577#define VM86_FAULT_RETURN do { \ 577#define VM86_FAULT_RETURN do { \
578 if (VMPI.force_return_for_pic && (VEFLAGS & (IF_MASK | VIF_MASK))) \ 578 if (VMPI.force_return_for_pic && (VEFLAGS & (X86_EFLAGS_IF | X86_EFLAGS_VIF))) \
579 return_to_32bit(regs, VM86_PICRETURN); \ 579 return_to_32bit(regs, VM86_PICRETURN); \
580 if (orig_flags & TF_MASK) \ 580 if (orig_flags & X86_EFLAGS_TF) \
581 handle_vm86_trap(regs, 0, 1); \ 581 handle_vm86_trap(regs, 0, 1); \
582 return; } while (0) 582 return; } while (0)
583 583
diff --git a/include/asm-x86/vm86.h b/include/asm-x86/vm86.h
index f5f3dc479c34..074b357146df 100644
--- a/include/asm-x86/vm86.h
+++ b/include/asm-x86/vm86.h
@@ -12,19 +12,13 @@
12 * Linus 12 * Linus
13 */ 13 */
14 14
15#define TF_MASK 0x00000100 15#include <asm/processor-flags.h>
16#define IF_MASK 0x00000200 16
17#define IOPL_MASK 0x00003000
18#define NT_MASK 0x00004000
19#ifdef CONFIG_VM86 17#ifdef CONFIG_VM86
20#define X86_VM_MASK X86_EFLAGS_VM 18#define X86_VM_MASK X86_EFLAGS_VM
21#else 19#else
22#define X86_VM_MASK 0 /* No VM86 support */ 20#define X86_VM_MASK 0 /* No VM86 support */
23#endif 21#endif
24#define AC_MASK 0x00040000
25#define VIF_MASK 0x00080000 /* virtual interrupt flag */
26#define VIP_MASK 0x00100000 /* virtual interrupt pending */
27#define ID_MASK 0x00200000
28 22
29#define BIOSSEG 0x0f000 23#define BIOSSEG 0x0f000
30 24