Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences Between ARM Assembly and x86 Assembly [closed]

I'm now going to learn ARM Assembly, to develop for my Windows Mobile 5 iPAQ, but I have some questions:

  • What Are The Main Differences Between ARM Assembly and x86 Assembly?
    • Is Any Differences In The Interrupts(New Types)?
      • Which Are They And What Is The Meaning Of They?
    • Best Assembler To Compile And Where To Get It?
  • Where I Can Find Some Good Resources?
like image 797
Nathan Campos Avatar asked Nov 13 '09 22:11

Nathan Campos


People also ask

What is ARM and x86?

Arm is RISC (Reduced Instruction Set Computing) based, while Intel (x86) is CISC (Complex Instruction Set Computing). Arm's CPU instructions are reasonably atomic, with a very close correlation between the number of instructions and micro-ops.

Which is better ARM or x86?

ARM processors are generally more efficient than x86 due to a number of factors, in particular because of the fact its ISA is designed around actual RISC implementation. On top of that, ARM is not like x86 where it's being designed to maintain backward compatibility back to the time of the dinosaurs the way x86 is.

Is Intel ARM or x86?

Intel processors (sometimes known as X86 for Windows 32-bit programs) use Complex Instruction Set Computer (CISC), whereas ARM processors use Reduced Instruction Set Computer (RISC).

Can x86 be as power efficient as ARM?

It may still have some relevance in the microcontroller realm, but has nothing useful to contribute to the modern era. An x86 chip can be more power efficient than an ARM processor, or vice versa, but it'll be the result of other factors — not whether it's x86 or ARM.


2 Answers

Main differences:

  • ARM is a RISC style architecture - instructions have a regular size (32-bit for standard ARM and 16-bits for Thumb mode, though Thumb has some instructions that chew up 2 instruction 'slots')

  • up through at least ARM v5 architecture (I'm not sure what v6 does), the interrupt model on ARM is vastly different than on Intel - instead of pushing registers onto the stack, the ARM swaps to a different set of registers which 'shadow' the normal set. The mode of the processor determines which register file is visible (and not all registers are necessarily shadowed). it's a pretty complex arrangement. Newer ARM Architectures (v7 anyway) have an interrupt model that's closer to Intel's where registers are pushed on to the stack when an interrupt occurs.

Arm instruction have some interesting features that aren't in Intel's:

  • instructions have conditional flags built in - so each instruction can execute as a NOP if the specified condition flags don't match the current status register flag state (this can be used to avoid all those jumps around one or two instructions that you often see in Intel assembly).
  • the ARM has shifting logic that can be embedded as part of the instruction. So when using a register as a source operand, you can shift it as an intrinsic part of the instruction. This helps with indexing arrays, sometimes with arithmetic.

On the other side, the ARM can't do much with memory directly except load from and store to it. Intel assembly can perform more operations directly on memory.

Note that the ARM architecture version doesn't correspond directly to the actual ARM processor versions - for example, if I remember right the ARM7 is a architecture v5 processor. Personally, I find this far more confusing than it should be.

The ARM Architecture references are freely downloadable from http://www.arm.com. I also suggest getting copies of Hitex's guides to various ARM microcontrollers for a good starting point.

There have been several Stackoverflow questions regarding pointers to getting started with ARM. Reviewing them will give you a lot of good places to start:

  • Suggested resources for newbie ARM programmer?
  • https://stackoverflow.com/questions/270078/resources-for-learning-arm-assembly (archived)
  • How to start off with ARM processors?
like image 137
Michael Burr Avatar answered Oct 11 '22 21:10

Michael Burr


You should also realise that ARM license their IP rather than produce chips. A licensee may configure their ARM core microprocessor in a number of ways. Most importantly w.r.t. your question is that the ARM core itself defines only two interrupts IRQ and FIRQ, most often, there is a vendor specific interrupt controller, so you need to know exactly whose microprocessor is used in your device if you need to know how to handle interrupts. iPAQ models have variously used Intel StongARM and XScale processors. If you want to develop at that level, you should download the user reference manual for the specific part.

All that said, interrupt services and device drivers are provided by the OS so you probably don't need to worry about such low level details. In fact I would question the choice of assembler as your development language. There are few reasons to choose assembler over C or C++, on ARM (the compiler will almost certainly out perform you in terms of code performance). Moreover on Windows Mobile, the most productive application level language is likely to be C#.

like image 24
Clifford Avatar answered Oct 11 '22 21:10

Clifford