Skip to content

Instantly share code, notes, and snippets.

@numanturle
Created December 12, 2021 21:05
Show Gist options
  • Save numanturle/8e7b1fd6c00a15e742400fb2f0c81716 to your computer and use it in GitHub Desktop.
Save numanturle/8e7b1fd6c00a15e742400fb2f0c81716 to your computer and use it in GitHub Desktop.
.data
/* Data segment: define our message string and calculate its length. */
msg:
.ascii "Hello, ARM64!\n"
len = . - msg
.text
/* Our application's entry point. */
.globl _start
_start:
/* syscall write(int fd, const void *buf, size_t count) */
mov x0, #1 /* fd := STDOUT_FILENO */
ldr x1, =msg /* buf := msg */
ldr x2, =len /* count := len */
mov w8, #64 /* write is syscall #64 */
svc #0 /* invoke syscall */
/* syscall exit(int status) */
mov x0, #0 /* status := 0 */
mov w8, #93 /* exit is syscall #1 */
svc #0 /* invoke syscall */
@numanturle
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment