entry_64.S (aea983801c6b5e4e9af333a32220d580a77f6783) | entry_64.S (946c191161cef10c667b5ee3179db1714fa5b7c0) |
---|---|
1/* 2 * linux/arch/x86_64/entry.S 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs 6 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> 7 * 8 * entry.S contains the system-call and fault low-level handling routines. --- 455 unchanged lines hidden (view full) --- 464 */ 465 466/* 0(%rsp): ~(interrupt number) */ 467 .macro interrupt func 468 cld 469 ALLOC_PT_GPREGS_ON_STACK 470 SAVE_C_REGS 471 SAVE_EXTRA_REGS | 1/* 2 * linux/arch/x86_64/entry.S 3 * 4 * Copyright (C) 1991, 1992 Linus Torvalds 5 * Copyright (C) 2000, 2001, 2002 Andi Kleen SuSE Labs 6 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> 7 * 8 * entry.S contains the system-call and fault low-level handling routines. --- 455 unchanged lines hidden (view full) --- 464 */ 465 466/* 0(%rsp): ~(interrupt number) */ 467 .macro interrupt func 468 cld 469 ALLOC_PT_GPREGS_ON_STACK 470 SAVE_C_REGS 471 SAVE_EXTRA_REGS |
472 ENCODE_FRAME_POINTER |
|
472 473 testb $3, CS(%rsp) 474 jz 1f 475 476 /* 477 * IRQ from user mode. Switch to kernel gsbase and inform context 478 * tracking that we're in kernel mode. 479 */ --- 500 unchanged lines hidden (view full) --- 9801: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */ 981 movq (%rsp), %rcx 982 movq 8(%rsp), %r11 983 addq $0x30, %rsp 984 pushq $-1 /* orig_ax = -1 => not a system call */ 985 ALLOC_PT_GPREGS_ON_STACK 986 SAVE_C_REGS 987 SAVE_EXTRA_REGS | 473 474 testb $3, CS(%rsp) 475 jz 1f 476 477 /* 478 * IRQ from user mode. Switch to kernel gsbase and inform context 479 * tracking that we're in kernel mode. 480 */ --- 500 unchanged lines hidden (view full) --- 9811: /* Segment mismatch => Category 1 (Bad segment). Retry the IRET. */ 982 movq (%rsp), %rcx 983 movq 8(%rsp), %r11 984 addq $0x30, %rsp 985 pushq $-1 /* orig_ax = -1 => not a system call */ 986 ALLOC_PT_GPREGS_ON_STACK 987 SAVE_C_REGS 988 SAVE_EXTRA_REGS |
989 ENCODE_FRAME_POINTER |
|
988 jmp error_exit 989END(xen_failsafe_callback) 990 991apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ 992 xen_hvm_callback_vector xen_evtchn_do_upcall 993 994#endif /* CONFIG_XEN */ 995 --- 27 unchanged lines hidden (view full) --- 1023 * Save all registers in pt_regs, and switch gs if needed. 1024 * Use slow, but surefire "are we in kernel?" check. 1025 * Return: ebx=0: need swapgs on exit, ebx=1: otherwise 1026 */ 1027ENTRY(paranoid_entry) 1028 cld 1029 SAVE_C_REGS 8 1030 SAVE_EXTRA_REGS 8 | 990 jmp error_exit 991END(xen_failsafe_callback) 992 993apicinterrupt3 HYPERVISOR_CALLBACK_VECTOR \ 994 xen_hvm_callback_vector xen_evtchn_do_upcall 995 996#endif /* CONFIG_XEN */ 997 --- 27 unchanged lines hidden (view full) --- 1025 * Save all registers in pt_regs, and switch gs if needed. 1026 * Use slow, but surefire "are we in kernel?" check. 1027 * Return: ebx=0: need swapgs on exit, ebx=1: otherwise 1028 */ 1029ENTRY(paranoid_entry) 1030 cld 1031 SAVE_C_REGS 8 1032 SAVE_EXTRA_REGS 8 |
1033 ENCODE_FRAME_POINTER 8 |
|
1031 movl $1, %ebx 1032 movl $MSR_GS_BASE, %ecx 1033 rdmsr 1034 testl %edx, %edx 1035 js 1f /* negative -> in kernel */ 1036 SWAPGS 1037 xorl %ebx, %ebx 10381: ret --- 31 unchanged lines hidden (view full) --- 1070/* 1071 * Save all registers in pt_regs, and switch gs if needed. 1072 * Return: EBX=0: came from user mode; EBX=1: otherwise 1073 */ 1074ENTRY(error_entry) 1075 cld 1076 SAVE_C_REGS 8 1077 SAVE_EXTRA_REGS 8 | 1034 movl $1, %ebx 1035 movl $MSR_GS_BASE, %ecx 1036 rdmsr 1037 testl %edx, %edx 1038 js 1f /* negative -> in kernel */ 1039 SWAPGS 1040 xorl %ebx, %ebx 10411: ret --- 31 unchanged lines hidden (view full) --- 1073/* 1074 * Save all registers in pt_regs, and switch gs if needed. 1075 * Return: EBX=0: came from user mode; EBX=1: otherwise 1076 */ 1077ENTRY(error_entry) 1078 cld 1079 SAVE_C_REGS 8 1080 SAVE_EXTRA_REGS 8 |
1081 ENCODE_FRAME_POINTER 8 |
|
1078 xorl %ebx, %ebx 1079 testb $3, CS+8(%rsp) 1080 jz .Lerror_kernelspace 1081 1082 /* 1083 * We entered from user mode or we're pretending to have entered 1084 * from user mode due to an IRET fault. 1085 */ --- 166 unchanged lines hidden (view full) --- 1252 pushq %r10 /* pt_regs->r10 */ 1253 pushq %r11 /* pt_regs->r11 */ 1254 pushq %rbx /* pt_regs->rbx */ 1255 pushq %rbp /* pt_regs->rbp */ 1256 pushq %r12 /* pt_regs->r12 */ 1257 pushq %r13 /* pt_regs->r13 */ 1258 pushq %r14 /* pt_regs->r14 */ 1259 pushq %r15 /* pt_regs->r15 */ | 1082 xorl %ebx, %ebx 1083 testb $3, CS+8(%rsp) 1084 jz .Lerror_kernelspace 1085 1086 /* 1087 * We entered from user mode or we're pretending to have entered 1088 * from user mode due to an IRET fault. 1089 */ --- 166 unchanged lines hidden (view full) --- 1256 pushq %r10 /* pt_regs->r10 */ 1257 pushq %r11 /* pt_regs->r11 */ 1258 pushq %rbx /* pt_regs->rbx */ 1259 pushq %rbp /* pt_regs->rbp */ 1260 pushq %r12 /* pt_regs->r12 */ 1261 pushq %r13 /* pt_regs->r13 */ 1262 pushq %r14 /* pt_regs->r14 */ 1263 pushq %r15 /* pt_regs->r15 */ |
1264 ENCODE_FRAME_POINTER |
|
1260 1261 /* 1262 * At this point we no longer need to worry about stack damage 1263 * due to nesting -- we're on the normal thread stack and we're 1264 * done with the NMI stack. 1265 */ 1266 1267 movq %rsp, %rdi 1268 movq $-1, %rsi 1269 call do_nmi 1270 1271 /* 1272 * Return back to user mode. We must *not* do the normal exit | 1265 1266 /* 1267 * At this point we no longer need to worry about stack damage 1268 * due to nesting -- we're on the normal thread stack and we're 1269 * done with the NMI stack. 1270 */ 1271 1272 movq %rsp, %rdi 1273 movq $-1, %rsi 1274 call do_nmi 1275 1276 /* 1277 * Return back to user mode. We must *not* do the normal exit |
1273 * work, because we don't want to enable interrupts. Fortunately, 1274 * do_nmi doesn't modify pt_regs. | 1278 * work, because we don't want to enable interrupts. |
1275 */ 1276 SWAPGS | 1279 */ 1280 SWAPGS |
1277 jmp restore_c_regs_and_iret | 1281 jmp restore_regs_and_iret |
1278 1279.Lnmi_from_kernel: 1280 /* 1281 * Here's what our stack frame will look like: 1282 * +---------------------------------------------------------+ 1283 * | original SS | 1284 * | original Return RSP | 1285 * | original RFLAGS | --- 243 unchanged lines hidden --- | 1282 1283.Lnmi_from_kernel: 1284 /* 1285 * Here's what our stack frame will look like: 1286 * +---------------------------------------------------------+ 1287 * | original SS | 1288 * | original Return RSP | 1289 * | original RFLAGS | --- 243 unchanged lines hidden --- |