Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Early IDT handler entry points
0004  *
0005  * Copyright (C) 2019 SUSE
0006  *
0007  * Author: Joerg Roedel <jroedel@suse.de>
0008  */
0009 
0010 #include <asm/segment.h>
0011 
0012 /* For ORIG_RAX */
0013 #include "../../entry/calling.h"
0014 
0015 .macro EXCEPTION_HANDLER name function error_code=0
0016 SYM_FUNC_START(\name)
0017 
0018     /* Build pt_regs */
0019     .if \error_code == 0
0020     pushq   $0
0021     .endif
0022 
0023     pushq   %rdi
0024     pushq   %rsi
0025     pushq   %rdx
0026     pushq   %rcx
0027     pushq   %rax
0028     pushq   %r8
0029     pushq   %r9
0030     pushq   %r10
0031     pushq   %r11
0032     pushq   %rbx
0033     pushq   %rbp
0034     pushq   %r12
0035     pushq   %r13
0036     pushq   %r14
0037     pushq   %r15
0038 
0039     /* Call handler with pt_regs */
0040     movq    %rsp, %rdi
0041     /* Error code is second parameter */
0042     movq    ORIG_RAX(%rsp), %rsi
0043     call    \function
0044 
0045     /* Restore regs */
0046     popq    %r15
0047     popq    %r14
0048     popq    %r13
0049     popq    %r12
0050     popq    %rbp
0051     popq    %rbx
0052     popq    %r11
0053     popq    %r10
0054     popq    %r9
0055     popq    %r8
0056     popq    %rax
0057     popq    %rcx
0058     popq    %rdx
0059     popq    %rsi
0060     popq    %rdi
0061 
0062     /* Remove error code and return */
0063     addq    $8, %rsp
0064 
0065     iretq
0066 SYM_FUNC_END(\name)
0067     .endm
0068 
0069     .text
0070     .code64
0071 
0072 EXCEPTION_HANDLER   boot_page_fault do_boot_page_fault error_code=1
0073 
0074 #ifdef CONFIG_AMD_MEM_ENCRYPT
0075 EXCEPTION_HANDLER   boot_stage1_vc do_vc_no_ghcb        error_code=1
0076 EXCEPTION_HANDLER   boot_stage2_vc do_boot_stage2_vc    error_code=1
0077 #endif