Merge tag 'sched-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / powerpc / sysdev / dcr-low.S
blobefeeb1b885a17e4ac6c5f8e7c2394c59460179aa
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * "Indirect" DCR access
4  *
5  * Copyright (c) 2004 Eugene Surovegin <ebs@ebshome.net>
6  */
8 #include <asm/ppc_asm.h>
9 #include <asm/processor.h>
10 #include <asm/bug.h>
11 #include <asm/export.h>
13 #define DCR_ACCESS_PROLOG(table) \
14         cmpli   cr0,r3,1024;     \
15         rlwinm  r3,r3,4,18,27;   \
16         lis     r5,table@h;      \
17         ori     r5,r5,table@l;   \
18         add     r3,r3,r5;        \
19         bge-    1f;              \
20         mtctr   r3;              \
21         bctr;                    \
22 1:      trap;                    \
23         EMIT_BUG_ENTRY 1b,__FILE__,__LINE__,0;  \
24         blr
26 _GLOBAL(__mfdcr)
27         DCR_ACCESS_PROLOG(__mfdcr_table)
28 EXPORT_SYMBOL(__mfdcr)
30 _GLOBAL(__mtdcr)
31         DCR_ACCESS_PROLOG(__mtdcr_table)
32 EXPORT_SYMBOL(__mtdcr)
34 __mfdcr_table:
35         mfdcr  r3,0; blr
36 __mtdcr_table:
37         mtdcr  0,r4; blr
39 dcr     = 1
40         .rept   1023
41         mfdcr   r3,dcr; blr
42         mtdcr   dcr,r4; blr
43         dcr     = dcr + 1
44         .endr