浏览代码

x86: Add symbolic constant for exceptions with error code

Add a symbolic constant for the bitmask which states which exceptions
carry an error code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Link: http://lkml.kernel.org/r/1334794610-5546-3-git-send-email-hpa@zytor.com
H. Peter Anvin 13 年之前
父节点
当前提交
84f4fc524e
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 2 0
      arch/x86/include/asm/segment.h
  2. 1 1
      arch/x86/kernel/head_64.S

+ 2 - 0
arch/x86/include/asm/segment.h

@@ -205,6 +205,8 @@
 
 
 #define IDT_ENTRIES 256
 #define IDT_ENTRIES 256
 #define NUM_EXCEPTION_VECTORS 32
 #define NUM_EXCEPTION_VECTORS 32
+/* Bitmask of exception vectors which push an error code on the stack */
+#define EXCEPTION_ERRCODE_MASK  0x00027d00
 #define GDT_SIZE (GDT_ENTRIES * 8)
 #define GDT_SIZE (GDT_ENTRIES * 8)
 #define GDT_ENTRY_TLS_ENTRIES 3
 #define GDT_ENTRY_TLS_ENTRIES 3
 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)
 #define TLS_SIZE (GDT_ENTRY_TLS_ENTRIES * 8)

+ 1 - 1
arch/x86/kernel/head_64.S

@@ -295,7 +295,7 @@ ENTRY(early_idt_handler)
 	ja 0f
 	ja 0f
 	movl $1,%eax
 	movl $1,%eax
 	salq %cl,%rax
 	salq %cl,%rax
-	testl $0x27d00,%eax
+	testl $EXCEPTION_ERRCODE_MASK,%eax
 	je 0f
 	je 0f
 	popq %r8		# get error code
 	popq %r8		# get error code
 0:	movq 0(%rsp),%rcx	# get ip
 0:	movq 0(%rsp),%rcx	# get ip