style: format arrays
This commit is contained in:
parent
2fab257d1f
commit
b65b5838f7
1 changed files with 53 additions and 53 deletions
10
README.md
10
README.md
|
|
@ -39,7 +39,7 @@ All computation happens inside registers - RAM just holds the data until it’s
|
||||||
#### Special registers
|
#### Special registers
|
||||||
|
|
||||||
| 64-bit | 32-bit | 16-bit | Name | Purpose |
|
| 64-bit | 32-bit | 16-bit | Name | Purpose |
|
||||||
|--------|--------|--------|------|---------|
|
|----------|----------|---------|---------------------|---------------------------------------------------------|
|
||||||
| `rsp` | `esp` | `sp` | Stack Pointer | Points to the top of the stack |
|
| `rsp` | `esp` | `sp` | Stack Pointer | Points to the top of the stack |
|
||||||
| `rbp` | `ebp` | `bp` | Base Pointer | Marks the base of the current stack frame |
|
| `rbp` | `ebp` | `bp` | Base Pointer | Marks the base of the current stack frame |
|
||||||
| `rip` | `eip` | `ip` | Instruction Pointer | Points to the next instruction to execute |
|
| `rip` | `eip` | `ip` | Instruction Pointer | Points to the next instruction to execute |
|
||||||
|
|
@ -48,7 +48,7 @@ All computation happens inside registers - RAM just holds the data until it’s
|
||||||
#### General-purpose registers
|
#### General-purpose registers
|
||||||
|
|
||||||
| 64-bit | 32-bit | 16-bit | 8-bit high | 8-bit low | Category | Conventional use |
|
| 64-bit | 32-bit | 16-bit | 8-bit high | 8-bit low | Category | Conventional use |
|
||||||
|--------|--------|--------|------------|-----------|----------|-----------------|
|
|-------------|---------------|---------------|------------|---------------|--------------|---------------------------|
|
||||||
| `rax` | `eax` | `ax` | `ah` | `al` | Caller-saved | Return value, accumulator |
|
| `rax` | `eax` | `ax` | `ah` | `al` | Caller-saved | Return value, accumulator |
|
||||||
| `rbx` | `ebx` | `bx` | `bh` | `bl` | Callee-saved | General purpose |
|
| `rbx` | `ebx` | `bx` | `bh` | `bl` | Callee-saved | General purpose |
|
||||||
| `rcx` | `ecx` | `cx` | `ch` | `cl` | Caller-saved | 4th argument |
|
| `rcx` | `ecx` | `cx` | `ch` | `cl` | Caller-saved | 4th argument |
|
||||||
|
|
@ -86,7 +86,7 @@ All computation happens inside registers - RAM just holds the data until it’s
|
||||||
##### Conditional jumps
|
##### Conditional jumps
|
||||||
|
|
||||||
| Instruction | Flags | Condition | Description |
|
| Instruction | Flags | Condition | Description |
|
||||||
|-------------|-------|-----------|-------------|
|
|---------------|------------|--------------|---------------------------|
|
||||||
| `jmp` | - | always | Unconditional jump |
|
| `jmp` | - | always | Unconditional jump |
|
||||||
| `je` / `jz` | ZF | ZF = 1 | Equal / Zero |
|
| `je` / `jz` | ZF | ZF = 1 | Equal / Zero |
|
||||||
| `jne` / `jnz` | ZF | ZF = 0 | Not equal / Not zero |
|
| `jne` / `jnz` | ZF | ZF = 0 | Not equal / Not zero |
|
||||||
|
|
@ -106,7 +106,7 @@ All computation happens inside registers - RAM just holds the data until it’s
|
||||||
#### Arithmetic
|
#### Arithmetic
|
||||||
|
|
||||||
| Instruction | Description |
|
| Instruction | Description |
|
||||||
|-------------|-------------|
|
|-----------------|-------------------------------------------------------------|
|
||||||
| `add dst, src` | dst = dst + src |
|
| `add dst, src` | dst = dst + src |
|
||||||
| `sub dst, src` | dst = dst - src |
|
| `sub dst, src` | dst = dst - src |
|
||||||
| `inc dst` | dst = dst + 1 |
|
| `inc dst` | dst = dst + 1 |
|
||||||
|
|
@ -159,7 +159,7 @@ Additional arguments are pushed onto the stack. The return value is stored in `r
|
||||||
**Register preservation:**
|
**Register preservation:**
|
||||||
|
|
||||||
| Type | Registers | Who saves | Behavior |
|
| Type | Registers | Who saves | Behavior |
|
||||||
|------|-----------|-----------|----------|
|
|--------------|-----------------------------------------------|-----------|------------------------------------------------------------------------------------|
|
||||||
| Caller-saved | `rax`, `rcx`, `rdx`, `rsi`, `rdi`, `r8`–`r11` | Caller | **Will be overwritten** by the called function - save them before `call` if needed |
|
| Caller-saved | `rax`, `rcx`, `rdx`, `rsi`, `rdi`, `r8`–`r11` | Caller | **Will be overwritten** by the called function - save them before `call` if needed |
|
||||||
| Callee-saved | `rbx`, `rbp`, `r12`–`r15` | Callee | Must be restored before returning |
|
| Callee-saved | `rbx`, `rbp`, `r12`–`r15` | Callee | Must be restored before returning |
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue