'Hello world' doesn't work on silicon
pavel-stryber opened this issue · 3 comments
pavel-stryber commented
HelloSilicon/Chapter 01/HelloWorld.s
Line 15 in 3228b59
adr X1, helloworld needs to be changed to:adrp x1, helloworld@PAGEadd x1, x1, helloworld@PAGEOFFbelow commented
How does it not work? I just re-tested it, and it produces the expected output.
As the data here is read only and contained in the .text segment, I believe it is OK to use adr here.
pavel-stryber commented
I've missed to remove '.data' directive from the original source. Sorry for inconvenience.
I had following:
.global _start // Provide program starting address
.align 2
_start: mov x0, #1
adr x1, helloworld
mov x2, #13 // length of the string
mov x16, #4 // write system call
svc #0x80 // Output the string
mov x0, #0
mov x16, #1
svc #0x80 // call to terminate
.data
helloworld: .ascii "Hello World!\n"
below commented
Always happy to discuss assembly ;) Thanks for asking questions!