Basically every smartphone on the planet currently uses an ARM processor, an inexpensive and energy-efficient microprocessor. The design dates back to the 1980's, when ARM stood for the "Acorn RISC Machine"--Acorn was the company, and more on RISC below. Compared to x86, which is a high performance but extremely complicated machine, ARM is much simpler technology and much easier to license, which makes it very popular for custom chip designs and low power systems. In addition to cell phones, ARM is becoming popular in embedded systems like inside a robot or inside a hard drive, and NVIDIA has licensed ARM, probably for their upcoming massively parallel supercomputer chips.
From C or C++, an ARM machine is difficult to distinguish from any other 32-bit machine (64-bit ARM was quite late, and is only now starting to appear in higher-end devices like the Raspberry Pi 3).
std::cout<<"Yes, this is ARM.\n"; return 37;
However, note that both the machine code and assembly are completely different from x86:
ARM | x86 |
00000030 <foo>: 30: e92d4010 push {r4, lr} 34: e59f0010 ldr r0, [pc, #16] ...cout 38: e59f1010 ldr r1, [pc, #16] ...str 3c: e3a02012 mov r2, #18 ; 0x12 40: ebfffffe bl ...ostream... 44: e3a00025 mov r0, #37 ; 0x25 48: e8bd8010 pop {r4, pc} |
0000000000000027 <foo>: 27: 48 83 ec 08 sub rsp,0x8 2b: ba 11 00 00 00 mov edx,0x11 30: be 00 00 00 00 mov esi,...str 35: bf 00 00 00 00 mov edi,...cout 3a: e8 00 00 00 00 call ...ostream... 3f: b8 25 00 00 00 mov eax,0x25 44: 48 83 c4 08 add rsp,0x8 48: c3 ret |
First, note that the machine code, on the left, is all in one
block. This is because ARM is a "Reduced
Instruction Set Computer (RISC)" machine, while x86
is a "Complex Instruction Set Computer (CISC)" machine.
RISC refers to the fact that every ordinary ARM
instruction is a uniform 32 bits long, while CISC machines use
variable-length instructions: x86 uses 5 bytes for "mov eax,3"
and just 1 byte for "ret". The advantage with RISC is the
fixed-size instructions are simpler for the CPU to decode
quickly; the advantage with CISC is you save space on short
instructions, and can take as much room as you need for long
instructions, like to load a 64-bit constant into a
register.
In the 1980's, many groups were building new RISC machines, such as MIPS (nearly extinct, the last niche is inside routers), Power/PowerPC (used in mid 1990's to mid 2000's Macs, and modern server versions sold by IBM), SPARC (now sold by Oracle), and DEC Alpha (now extinct).