GNU Linux-libre 4.19.245-gnu1
[releases.git] / arch / powerpc / lib / quad.S
1 /*
2  * Quadword loads and stores
3  * for use in instruction emulation.
4  *
5  * Copyright 2017 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
6  *
7  *  This program is free software; you can redistribute it and/or
8  *  modify it under the terms of the GNU General Public License
9  *  as published by the Free Software Foundation; either version
10  *  2 of the License, or (at your option) any later version.
11  */
12
13 #include <asm/processor.h>
14 #include <asm/ppc_asm.h>
15 #include <asm/ppc-opcode.h>
16 #include <asm/reg.h>
17 #include <asm/asm-offsets.h>
18 #include <linux/errno.h>
19
20 /* do_lq(unsigned long ea, unsigned long *regs) */
21 _GLOBAL(do_lq)
22 1:      lq      r6, 0(r3)
23         std     r6, 0(r4)
24         std     r7, 8(r4)
25         li      r3, 0
26         blr
27 2:      li      r3, -EFAULT
28         blr
29         EX_TABLE(1b, 2b)
30
31 /* do_stq(unsigned long ea, unsigned long val0, unsigned long val1) */
32 _GLOBAL(do_stq)
33 1:      stq     r4, 0(r3)
34         li      r3, 0
35         blr
36 2:      li      r3, -EFAULT
37         blr
38         EX_TABLE(1b, 2b)
39
40 /* do_lqarx(unsigned long ea, unsigned long *regs) */
41 _GLOBAL(do_lqarx)
42 1:      PPC_LQARX(6, 0, 3, 0)
43         std     r6, 0(r4)
44         std     r7, 8(r4)
45         li      r3, 0
46         blr
47 2:      li      r3, -EFAULT
48         blr
49         EX_TABLE(1b, 2b)
50
51 /* do_stqcx(unsigned long ea, unsigned long val0, unsigned long val1,
52             unsigned int *crp) */
53
54 _GLOBAL(do_stqcx)
55 1:      PPC_STQCX(4, 0, 3)
56         mfcr    r5
57         stw     r5, 0(r6)
58         li      r3, 0
59         blr
60 2:      li      r3, -EFAULT
61         blr
62         EX_TABLE(1b, 2b)