We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e1992eb commit 62250ebCopy full SHA for 62250eb
riscv-asm.md
@@ -464,19 +464,25 @@ The following example shows loading a constant using the `%hi` and
464
`%lo` assembler functions.
465
466
```assembly
467
- .equ UART_BASE, 0x40003080
+ .equ UART0_BASE, 0x40003080 # positive offset
468
+ .equ UART1_BASE, 0x40003880 # negative offset
469
- lui a0, %hi(UART_BASE)
470
- addi a0, a0, %lo(UART_BASE)
+ lui a0, %hi(UART0_BASE)
471
+ addi a0, a0, %lo(UART0_BASE)
472
+
473
+ lui a0, %hi(UART1_BASE)
474
+ addi a0, a0, %lo(UART1_BASE)
475
```
476
477
Which generates the following assembler output
478
as seen by `objdump`:
479
480
481
0000000000000000 <.text>:
- 0: 40003537 lui a0,0x40003
- 4: 08050513 addi a0,a0,128 # 40003080 <UART_BASE>
482
+ 0: 40003537 lui a0,0x40003
483
+ 4: 08050513 addi a0,a0,128 # 40003080 <UART0_BASE>
484
+ 8: 40004537 lui a0,0x40004
485
+ c: 88050513 addi a0,a0,-1920 # 40003880 <UART1_BASE>
486
487
488
Function Calls
0 commit comments