brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · 80f14f5 Raw
100 lines · plain
1/* SPDX-License-Identifier: GPL-2.0 */2#include <linux/linkage.h>3 4#define AX	 05#define BX	 1 * 86#define CX	 2 * 87#define DX	 3 * 88#define SI	 4 * 89#define DI	 5 * 810#define BP	 6 * 811#define SP	 7 * 812#define IP	 8 * 813#define FLAGS	 9 * 814#define CS	10 * 815#define SS	11 * 816#define DS	12 * 817#define ES	13 * 818#define FS	14 * 819#define GS	15 * 820#define R8	16 * 821#define R9	17 * 822#define R10	18 * 823#define R11	19 * 824#define R12	20 * 825#define R13	21 * 826#define R14	22 * 827#define R15	23 * 828 29.text30#ifdef HAVE_ARCH_X86_64_SUPPORT31SYM_FUNC_START(perf_regs_load)32	movq %rax, AX(%rdi)33	movq %rbx, BX(%rdi)34	movq %rcx, CX(%rdi)35	movq %rdx, DX(%rdi)36	movq %rsi, SI(%rdi)37	movq %rdi, DI(%rdi)38	movq %rbp, BP(%rdi)39 40	leaq 8(%rsp), %rax /* exclude this call.  */41	movq %rax, SP(%rdi)42 43	movq 0(%rsp), %rax44	movq %rax, IP(%rdi)45 46	movq $0, FLAGS(%rdi)47	movq $0, CS(%rdi)48	movq $0, SS(%rdi)49	movq $0, DS(%rdi)50	movq $0, ES(%rdi)51	movq $0, FS(%rdi)52	movq $0, GS(%rdi)53 54	movq %r8,  R8(%rdi)55	movq %r9,  R9(%rdi)56	movq %r10, R10(%rdi)57	movq %r11, R11(%rdi)58	movq %r12, R12(%rdi)59	movq %r13, R13(%rdi)60	movq %r14, R14(%rdi)61	movq %r15, R15(%rdi)62	ret63SYM_FUNC_END(perf_regs_load)64#else65SYM_FUNC_START(perf_regs_load)66	push %edi67	movl 8(%esp), %edi68	movl %eax, AX(%edi)69	movl %ebx, BX(%edi)70	movl %ecx, CX(%edi)71	movl %edx, DX(%edi)72	movl %esi, SI(%edi)73	pop %eax74	movl %eax, DI(%edi)75	movl %ebp, BP(%edi)76 77	leal 4(%esp), %eax /* exclude this call.  */78	movl %eax, SP(%edi)79 80	movl 0(%esp), %eax81	movl %eax, IP(%edi)82 83	movl $0, FLAGS(%edi)84	movl $0, CS(%edi)85	movl $0, SS(%edi)86	movl $0, DS(%edi)87	movl $0, ES(%edi)88	movl $0, FS(%edi)89	movl $0, GS(%edi)90	ret91SYM_FUNC_END(perf_regs_load)92#endif93 94/*95 * We need to provide note.GNU-stack section, saying that we want96 * NOT executable stack. Otherwise the final linking will assume that97 * the ELF stack should not be restricted at all and set it RWX.98 */99.section .note.GNU-stack,"",@progbits100