xref: /openbmc/linux/arch/powerpc/lib/quad.S (revision 6d99a79c)
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)
221:	lq	r6, 0(r3)
23	std	r6, 0(r4)
24	std	r7, 8(r4)
25	li	r3, 0
26	blr
272:	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)
331:	stq	r4, 0(r3)
34	li	r3, 0
35	blr
362:	li	r3, -EFAULT
37	blr
38	EX_TABLE(1b, 2b)
39
40/* do_lqarx(unsigned long ea, unsigned long *regs) */
41_GLOBAL(do_lqarx)
421:	PPC_LQARX(6, 0, 3, 0)
43	std	r6, 0(r4)
44	std	r7, 8(r4)
45	li	r3, 0
46	blr
472:	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)
551:	PPC_STQCX(4, 0, 3)
56	mfcr	r5
57	stw	r5, 0(r6)
58	li	r3, 0
59	blr
602:	li	r3, -EFAULT
61	blr
62	EX_TABLE(1b, 2b)
63