~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/include/asm/assembler.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2023 StarFive Technology Co., Ltd.
  4  *
  5  * Author: Jee Heng Sia <jeeheng.sia@starfivetech.com>
  6  */
  7 
  8 #ifndef __ASSEMBLY__
  9 #error "Only include this from assembly code"
 10 #endif
 11 
 12 #ifndef __ASM_ASSEMBLER_H
 13 #define __ASM_ASSEMBLER_H
 14 
 15 #include <asm/asm.h>
 16 #include <asm/asm-offsets.h>
 17 #include <asm/csr.h>
 18 
 19 /*
 20  * suspend_restore_csrs - restore CSRs
 21  */
 22         .macro suspend_restore_csrs
 23                 REG_L   t0, (SUSPEND_CONTEXT_REGS + PT_EPC)(a0)
 24                 csrw    CSR_EPC, t0
 25                 REG_L   t0, (SUSPEND_CONTEXT_REGS + PT_STATUS)(a0)
 26                 csrw    CSR_STATUS, t0
 27                 REG_L   t0, (SUSPEND_CONTEXT_REGS + PT_BADADDR)(a0)
 28                 csrw    CSR_TVAL, t0
 29                 REG_L   t0, (SUSPEND_CONTEXT_REGS + PT_CAUSE)(a0)
 30                 csrw    CSR_CAUSE, t0
 31         .endm
 32 
 33 /*
 34  * suspend_restore_regs - Restore registers (except A0 and T0-T6)
 35  */
 36         .macro suspend_restore_regs
 37                 REG_L   ra, (SUSPEND_CONTEXT_REGS + PT_RA)(a0)
 38                 REG_L   sp, (SUSPEND_CONTEXT_REGS + PT_SP)(a0)
 39                 REG_L   gp, (SUSPEND_CONTEXT_REGS + PT_GP)(a0)
 40                 REG_L   tp, (SUSPEND_CONTEXT_REGS + PT_TP)(a0)
 41                 REG_L   s0, (SUSPEND_CONTEXT_REGS + PT_S0)(a0)
 42                 REG_L   s1, (SUSPEND_CONTEXT_REGS + PT_S1)(a0)
 43                 REG_L   a1, (SUSPEND_CONTEXT_REGS + PT_A1)(a0)
 44                 REG_L   a2, (SUSPEND_CONTEXT_REGS + PT_A2)(a0)
 45                 REG_L   a3, (SUSPEND_CONTEXT_REGS + PT_A3)(a0)
 46                 REG_L   a4, (SUSPEND_CONTEXT_REGS + PT_A4)(a0)
 47                 REG_L   a5, (SUSPEND_CONTEXT_REGS + PT_A5)(a0)
 48                 REG_L   a6, (SUSPEND_CONTEXT_REGS + PT_A6)(a0)
 49                 REG_L   a7, (SUSPEND_CONTEXT_REGS + PT_A7)(a0)
 50                 REG_L   s2, (SUSPEND_CONTEXT_REGS + PT_S2)(a0)
 51                 REG_L   s3, (SUSPEND_CONTEXT_REGS + PT_S3)(a0)
 52                 REG_L   s4, (SUSPEND_CONTEXT_REGS + PT_S4)(a0)
 53                 REG_L   s5, (SUSPEND_CONTEXT_REGS + PT_S5)(a0)
 54                 REG_L   s6, (SUSPEND_CONTEXT_REGS + PT_S6)(a0)
 55                 REG_L   s7, (SUSPEND_CONTEXT_REGS + PT_S7)(a0)
 56                 REG_L   s8, (SUSPEND_CONTEXT_REGS + PT_S8)(a0)
 57                 REG_L   s9, (SUSPEND_CONTEXT_REGS + PT_S9)(a0)
 58                 REG_L   s10, (SUSPEND_CONTEXT_REGS + PT_S10)(a0)
 59                 REG_L   s11, (SUSPEND_CONTEXT_REGS + PT_S11)(a0)
 60         .endm
 61 
 62 /*
 63  * copy_page - copy 1 page (4KB) of data from source to destination
 64  * @a0 - destination
 65  * @a1 - source
 66  */
 67         .macro  copy_page a0, a1
 68                 lui     a2, 0x1
 69                 add     a2, a2, a0
 70 1 :
 71                 REG_L   t0, 0(a1)
 72                 REG_L   t1, SZREG(a1)
 73 
 74                 REG_S   t0, 0(a0)
 75                 REG_S   t1, SZREG(a0)
 76 
 77                 addi    a0, a0, 2 * SZREG
 78                 addi    a1, a1, 2 * SZREG
 79                 bne     a2, a0, 1b
 80         .endm
 81 
 82 #endif  /* __ASM_ASSEMBLER_H */
 83 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php