See Implement all x86 vendor intrinsics for more information about implementing intrinsics.
Also see rust-embedded/wg#63 for more discussion.
There are two groups of intrinsics that need to be implemented for thumbv6 / thumbv7.
Core Register Access functions
Documentation of the core register functions:
https://www.keil.com/pack/doc/CMSIS/Core/html/group__Core__Register__gr.html
ARM CMSIS header file:
https://github.com/ARM-software/CMSIS/blob/master/CMSIS/Include/cmsis_armcc.h
CPSID
MRS
MSR
ARM ACLE Intrinsics
The ARM ACLE specification is here:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053d/IHI0053D_acle_2_1.pdf
The Clang ARM ACLE header file is here:
https://github.com/llvm-mirror/clang/blob/master/lib/Headers/arm_acle.h
The compiler intrinsics available through LLVM can be found here:
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/IntrinsicsARM.td
8.3 Memory Barriers
8.4 Hints
8.5 Swap
8.7 NOP
9.2 Miscellaneous data-processing intrinsics
Note: These may have equivalents in core.
10.1 Special register intrinsics
See Implement all x86 vendor intrinsics for more information about implementing intrinsics.
Also see rust-embedded/wg#63 for more discussion.
There are two groups of intrinsics that need to be implemented for thumbv6 / thumbv7.
Core Register Access functions
Documentation of the core register functions:
https://www.keil.com/pack/doc/CMSIS/Core/html/group__Core__Register__gr.html
ARM CMSIS header file:
https://github.com/ARM-software/CMSIS/blob/master/CMSIS/Include/cmsis_armcc.h
CPSID
fn disable_fault_irq() // CPSID ffn disable_irq() // CPSID ifn enable_fault_irq() // CPSIE ffn enable_irq() // CPSIE eMRS
fn get_ASPR() -> u32fn get_BASEPRI -> u32fn get_CONTROL() -> u32fn get_FAULTMASK() -> u32fn get_FPSCR() -> u32 // - M4, M7fn get_IPSR() -> u32fn get_MSP() -> u32fn get_PRIMASK() -> u32fn get_PSP() -> u32fn get_xPSR() -> u32MSR
fn set_ASPR(u32)fn set_BASEPRI(u32)fn set_CONTROL(u32)fn set_FAULTMASK(u32)fn set_FPSCR(u32) // - M4, M7fn set_IPSR(u32)fn set_MSP(u32)fn set_PRIMASK(u32)fn set_PSP(u32)fn set_xPSR(u32)ARM ACLE Intrinsics
The ARM ACLE specification is here:
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0053d/IHI0053D_acle_2_1.pdf
The Clang ARM ACLE header file is here:
https://github.com/llvm-mirror/clang/blob/master/lib/Headers/arm_acle.h
The compiler intrinsics available through LLVM can be found here:
https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/IntrinsicsARM.td
8.3 Memory Barriers
fn dmb(u32) // Data Memory Barrierfn dsb(u32) // Data Synchronization Barrierfn isb(u32) // Instruction Synchronziation Barrier8.4 Hints
fn wfi() // Wait For Interruptfn wfe() // Wait for Eventfn sev() // Send Global Eventfn sevl() // Send Local Eventfn yield() // Yieldfn dbg(u32) // Debug8.5 Swap
fn swp(u32, *mut u32) // Swap8.7 NOP
fn nop() // No-op9.2 Miscellaneous data-processing intrinsics
Note: These may have equivalents in
core.fn ror(u32, u32) -> u32 // Rotate Rightfn clz(u32) -> u32 // Count Leading Zerosfn cls(u32) -> u32 // Count Leading Sign Bitsfn rev(u32) -> u32 // Reverse Byte Orderfn rev16(u32) -> u32 // Reverse Byte Order (16 bit)fn revsh(u32) -> u32 // Reverse Byte Order Signed (16 bit)fn rbit(u32) -> u32 / Reverse Bits10.1 Special register intrinsics
fn arm_rsr(special_register) -> u32 // Read System Registerfn arm_rsrp(special_register) -> *const () // Read System Register Containing Addressfn arm_wsr(special_register, u32) // Write System Registerfn arm_wsrp(special_register, *const ()) // Write System Register