Are ARM instructuons SWI and SVC exactly same thing?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 11:57:41

Yes, SWI and SVC are same thing, it is just a name change. Previously, the SVC instruction was called SWI, Software Interrupt.

The opcode for SVC (and SWI) is partially user defined (bit 0-23 is user defined and is like a parameter to SVC handler). Bits 24-27 are b1111 and these 4 bits makes CPU to realize that the opcode is SVC (or SWI). see ARM Information Center for more details.

There is a good UAL vs pre-UAL mnemonic table on ARMv8 Appendix K6 "Legacy Instruction Syntax for AArch32 Instruction Sets"

One of the entries of that table is:

Pre-UAL syntax    UAL equivalent
SWI               SVC

which explicitly states that they are equivalent.

On GNU GAS, you can select the UAL syntax with .syntax unified.

From GCC, you can use the option -masm-syntax-unified for inline assembly, although it wasn't working in 8.2.0 due to a then fixed bug: How to write .syntax unified UAL ARMv7 inline assembly in GCC?

UAL vs pre-UAL also has further implications besides the names of certain instructions, e.g. the requirement for # or not in certain integer literals: Is the hash required for immediate values in ARM assembly?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!