cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

idt_handlers_64.S (1291B)


      1/* SPDX-License-Identifier: GPL-2.0-only */
      2/*
      3 * Early IDT handler entry points
      4 *
      5 * Copyright (C) 2019 SUSE
      6 *
      7 * Author: Joerg Roedel <jroedel@suse.de>
      8 */
      9
     10#include <asm/segment.h>
     11
     12/* For ORIG_RAX */
     13#include "../../entry/calling.h"
     14
     15.macro EXCEPTION_HANDLER name function error_code=0
     16SYM_FUNC_START(\name)
     17
     18	/* Build pt_regs */
     19	.if \error_code == 0
     20	pushq   $0
     21	.endif
     22
     23	pushq   %rdi
     24	pushq   %rsi
     25	pushq   %rdx
     26	pushq   %rcx
     27	pushq   %rax
     28	pushq   %r8
     29	pushq   %r9
     30	pushq   %r10
     31	pushq   %r11
     32	pushq   %rbx
     33	pushq   %rbp
     34	pushq   %r12
     35	pushq   %r13
     36	pushq   %r14
     37	pushq   %r15
     38
     39	/* Call handler with pt_regs */
     40	movq    %rsp, %rdi
     41	/* Error code is second parameter */
     42	movq	ORIG_RAX(%rsp), %rsi
     43	call    \function
     44
     45	/* Restore regs */
     46	popq    %r15
     47	popq    %r14
     48	popq    %r13
     49	popq    %r12
     50	popq    %rbp
     51	popq    %rbx
     52	popq    %r11
     53	popq    %r10
     54	popq    %r9
     55	popq    %r8
     56	popq    %rax
     57	popq    %rcx
     58	popq    %rdx
     59	popq    %rsi
     60	popq    %rdi
     61
     62	/* Remove error code and return */
     63	addq    $8, %rsp
     64
     65	iretq
     66SYM_FUNC_END(\name)
     67	.endm
     68
     69	.text
     70	.code64
     71
     72EXCEPTION_HANDLER	boot_page_fault do_boot_page_fault error_code=1
     73
     74#ifdef CONFIG_AMD_MEM_ENCRYPT
     75EXCEPTION_HANDLER	boot_stage1_vc do_vc_no_ghcb		error_code=1
     76EXCEPTION_HANDLER	boot_stage2_vc do_boot_stage2_vc	error_code=1
     77#endif