This commit is contained in:
Miloslav Ciz 2021-10-02 22:49:22 -05:00
parent a45a8f6fba
commit ffc358bdf3
1 changed files with 131 additions and 0 deletions

View File

@ -0,0 +1,131 @@
x86
--------------------------------------------------------------------------------
- a family of inst. sets (not a single one), extended with back. compat.
- mainly for desktops
- arch.: register-memory
- CISC, 3000+ instructions total (~1000 mnemonics)
- variable instruction size (usually 2-3 bytes)
- little endian
- partially "open"
patented anymore
- 16, 32, 64 bit
- supports (usually as extension) float, SIMD, MMX, SSE, ...
- modes:
- real: 20b segmented addr. (~1 Mib RAM), no mem. protection
- unreal: weird
- protected: 16 MB (1 GB) of physical (virtual) RAM, protected memory
- long
- ...
- bloat, implementations use speculation, reordering, prediction, microcode,
pipelines etc.
- registers:
general purpose registers:
64b | RAX | RBX | RCX | RDX |
32b | | EAX | | EBX | | CAX | | EDX |
16b | | | AX | | | BX | | | CX | | | DX |
8b | | |AH AL | | |BH BL | | |CH CL | | |DH DL |
other registers:
(E/R)FLAGS <- various flags set by operations
CF PF AF ZF SF TF IF DF OF ...
carry parity aux. zero sign trap int. dir. overflow
(E/R)SP <- stack pointer
(E/R)BP <- stack base pointer
(E/R)IP <- instruciton poitner
(E/R)SI <- source pointer
(E/R)DI <- destination pointer
CS <- code pointer \
DS <- data pointer | segment
SS <- stack | registers
ES,FS,GS <- extra pointer /
- instruction format:
- 0 to 4 prefix bytes modifying the instruction
- 1 to 2 bytes opcode identifying the instruction
- 0 to 1 bytes describing the operands (memory/registers)
- 0 to 1 bytes of a weird "scaled index byte"
- 0 to 4 memory displacement bytes, specify the address offset
- 0 to 4 immediate bytes, specify a constant value
- basic instructions:
ADD add
ADC add with carry
CALL call procedure (pushes EIP and jumps)
DEC decrement
DIV unsigned divide
IDIV signed divide
IMUL signed multiply
INC increment
JNE, JNZ, JZ, ... jump if condition (not equal, not zero, zero, ...)
JMP unconditional jump
MOV move (copy data)
MUL unsigned multiply
NEG negation (two's complement)
NOP no operation
POP pop from stack
PUSH push onto stack
ROL rotate left
SHR shift right
ARM (advanced RISC machines)
--------------------------------------------------------------------------------
- family of instruction sets (ARMv1, ARMv2, ARMv3, ...)
- mainly for embedded, simple, low energy sonsumption and heat
- arch.: register-register
- "proprietary"
- fixed instr. length (32b), BUT there is also a Thumb subset that encodes
instrs. as 16b (smaller code but fewer instructions), and Thumb2 (variable
instr. size)
- little endian, can be switched to big
- RISC, 232 instructions (~50 mnemonics)
- 32b, 64b
- mostly 1 CPI
- modes:
- user: unpriviledged (can't do certain things)
- supervisor: priviledged
- undefined: after undefined inst.
- abort: after memory access violation
- ...
- doesn't have divide instruction!
- implementaitons don't use microcode, are often simple without caches etc.
- instruction format:
| operand |dst|src||opc||0|co |
| 2 |reg|reg||ode||0| nd|
--------........--------........
Almost all instruciton can have a condition.
- registers:
- all 32 bit
- general purpose: R0 - R12
- stack pointer: R13
- link register: R14 (function return address)
- program counter: R15
- flags: CPSR (CPU mode, thumb, endian, zero, carry, ...)
- basic instructions:
ADC add with carry
ADD add
AND and operation
B, BNE, BEQ, ... branch if (always, not equal, equal, ...)
CMP compare
LDR load memory to register
MOV move register/constant to register
MUL multiply
STR store register to memory
SWI software interrupt
RISC-V
--------------------------------------------------------------------------------
POWER PC
--------------------------------------------------------------------------------