Path: blob/master/arch/unicore32/include/asm/assembler.h
10818 views
/*1* linux/arch/unicore32/include/asm/assembler.h2*3* Code specific to PKUnity SoC and UniCore ISA4*5* Copyright (C) 2001-2010 GUAN Xue-tao6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*11* Do not include any C declarations in this file - it is included by12* assembler source.13*/14#ifndef __ASSEMBLY__15#error "Only include this from assembly code"16#endif1718#include <asm/ptrace.h>1920/*21* Little Endian independent macros for shifting bytes within registers.22*/23#define pull >>24#define push <<25#define get_byte_0 << #026#define get_byte_1 >> #827#define get_byte_2 >> #1628#define get_byte_3 >> #2429#define put_byte_0 << #030#define put_byte_1 << #831#define put_byte_2 << #1632#define put_byte_3 << #243334#define cadd cmpadd35#define cand cmpand36#define csub cmpsub37#define cxor cmpxor3839/*40* Enable and disable interrupts41*/42.macro disable_irq, temp43mov \temp, asr44andn \temp, \temp, #0xFF45or \temp, \temp, #PSR_I_BIT | PRIV_MODE46mov.a asr, \temp47.endm4849.macro enable_irq, temp50mov \temp, asr51andn \temp, \temp, #0xFF52or \temp, \temp, #PRIV_MODE53mov.a asr, \temp54.endm5556#define USER(x...) \579999: x; \58.pushsection __ex_table, "a"; \59.align 3; \60.long 9999b, 9001f; \61.popsection6263.macro notcond, cond, nexti = .+864.ifc \cond, eq65bne \nexti66.else; .ifc \cond, ne67beq \nexti68.else; .ifc \cond, ea69bub \nexti70.else; .ifc \cond, ub71bea \nexti72.else; .ifc \cond, fs73bns \nexti74.else; .ifc \cond, ns75bfs \nexti76.else; .ifc \cond, fv77bnv \nexti78.else; .ifc \cond, nv79bfv \nexti80.else; .ifc \cond, ua81beb \nexti82.else; .ifc \cond, eb83bua \nexti84.else; .ifc \cond, eg85bsl \nexti86.else; .ifc \cond, sl87beg \nexti88.else; .ifc \cond, sg89bel \nexti90.else; .ifc \cond, el91bsg \nexti92.else; .ifnc \cond, al93.error "Unknown cond in notcond macro argument"94.endif; .endif; .endif; .endif; .endif; .endif; .endif95.endif; .endif; .endif; .endif; .endif; .endif; .endif96.endif97.endm9899.macro usracc, instr, reg, ptr, inc, cond, rept, abort100.rept \rept101notcond \cond, .+81029999 :103.if \inc == 1104\instr\()b.u \reg, [\ptr], #\inc105.elseif \inc == 4106\instr\()w.u \reg, [\ptr], #\inc107.else108.error "Unsupported inc macro argument"109.endif110111.pushsection __ex_table, "a"112.align 3113.long 9999b, \abort114.popsection115.endr116.endm117118.macro strusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f119usracc st, \reg, \ptr, \inc, \cond, \rept, \abort120.endm121122.macro ldrusr, reg, ptr, inc, cond = al, rept = 1, abort = 9001f123usracc ld, \reg, \ptr, \inc, \cond, \rept, \abort124.endm125126.macro nop8127.rept 8128nop129.endr130.endm131132133