mirror of
https://github.com/pkivolowitz/asm_book.git
synced 2026-06-21 02:26:59 +08:00
typo found by Katie
This commit is contained in:
parent
e7a99b1072
commit
372a2598f5
2 changed files with 22 additions and 16 deletions
|
|
@ -67,13 +67,18 @@ ram: .quad 0xFFFFFFFFFFFFFFFF // 14
|
||||||
// 17
|
// 17
|
||||||
```
|
```
|
||||||
|
|
||||||
`Line 14` puts an identifiable pattern into 8 bytes of RAM and gives them the symbol `ram`.
|
`Line 14` puts an identifiable pattern into 8 bytes of RAM and gives
|
||||||
|
them the symbol `ram`.
|
||||||
|
|
||||||
`Line 6` gets the address of these bytes into `x1`.
|
`Line 6` gets the address of these bytes into `x1`.
|
||||||
|
|
||||||
The next four lines put zeros into that memory using progressively wider store instructions.
|
The next four lines put zeros into that memory using progressively wider
|
||||||
|
store instructions.
|
||||||
|
|
||||||
The following is a `gdb` session running the above program. Line numbers have been added to assist with the description of the session. Rather than describe all after a wall of text, descriptions will be provided inline.
|
The following is a `gdb` session running the above program. Line numbers
|
||||||
|
have been added to assist with the description of the session. Rather
|
||||||
|
than describe all after a wall of text, descriptions will be provided
|
||||||
|
inline.
|
||||||
|
|
||||||
```text
|
```text
|
||||||
(gdb) b main // 1
|
(gdb) b main // 1
|
||||||
|
|
@ -164,7 +169,8 @@ Adding the `g` (for `g`iant) we can see all 8 bytes.
|
||||||
0xaaaaaaab1010: 0xffffffffffffff00 // 29
|
0xaaaaaaab1010: 0xffffffffffffff00 // 29
|
||||||
```
|
```
|
||||||
|
|
||||||
We just did a `strb` and looking at memory, we see one byte's worth of zeros.
|
We just did a `strb` and looking at memory, we see one byte's worth of
|
||||||
|
zeros.
|
||||||
|
|
||||||
*Note: this brings up an interesting question... which byte is actually
|
*Note: this brings up an interesting question... which byte is actually
|
||||||
sitting at the address of `ram`? We will have to look into this more
|
sitting at the address of `ram`? We will have to look into this more
|
||||||
|
|
@ -203,8 +209,8 @@ the address `ram`? When we examined the `long` just after putting in one
|
||||||
byte of zero, we saw this:
|
byte of zero, we saw this:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
(gdb) x/gx &ram // 28
|
(gdb) x/gx &ram // 28
|
||||||
0xaaaaaaab1010: 0xffffffffffffff00 // 29
|
0xaaaaaaab1010: 0xffffffffffffff00 // 29
|
||||||
```
|
```
|
||||||
|
|
||||||
Notice the zeros come at the end. Keep in mind, these bytes are printed
|
Notice the zeros come at the end. Keep in mind, these bytes are printed
|
||||||
|
|
@ -233,16 +239,16 @@ Given this program (not intended for meaningful execution... just
|
||||||
e`x`amining memory):
|
e`x`amining memory):
|
||||||
|
|
||||||
```asm
|
```asm
|
||||||
.global main // 1
|
.global main // 1
|
||||||
.text // 2
|
.text // 2
|
||||||
.align 2 // 3
|
.align 2 // 3
|
||||||
// 4
|
// 4
|
||||||
main: mov x0, xzr // 5
|
main: mov x0, xzr // 5
|
||||||
ret // 6
|
ret // 6
|
||||||
// 7
|
// 7
|
||||||
.data // 8
|
.data // 8
|
||||||
ram: .quad 0xAABBCCDDEEFF0011 // 9
|
ram: .quad 0xAABBCCDDEEFF0011 // 9
|
||||||
.end // 10
|
.end // 10
|
||||||
```
|
```
|
||||||
|
|
||||||
let's take a look at the memory at location `ram` in two ways. Once
|
let's take a look at the memory at location `ram` in two ways. Once
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in a new issue