Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -1,3 +1,3 @@
mov x5, #0
ldrb w5, [x0]
cmp x5, #0
mov x5, #0
ldrb w5, [x0]
cmp x5, #0

View file

@ -6,51 +6,51 @@
.global _start
_start:
stp x29, x30, [sp, -16]!
ldr x0, =str1
mov x29, sp
bl str_empty // str_empty("");
ldr x0, =str2
bl str_empty // str_empty("non-empty");
ldp x29, x30, [sp], 16
mov x0, #0
b _exit
stp x29, x30, [sp, -16]!
ldr x0, =str1
mov x29, sp
bl str_empty // str_empty("");
ldr x0, =str2
bl str_empty // str_empty("non-empty");
ldp x29, x30, [sp], 16
mov x0, #0
b _exit
str1: .asciz ""
str2: .asciz "non-empty"
str1: .asciz ""
str2: .asciz "non-empty"
.align 4
// void str_empty(const char *s) - print "String is empty" if s is empty, "String is not empty" otherwise
str_empty:
mov x5, #0
ldrb w5, [x0]
ldr x1, =msg_empty
ldr x3, =msg_not_empty
mov x2, #16
mov x4, #20
cmp x5, #0
csel x1, x1, x3, eq // msg = s[0] == 0 ? msg_empty : msg_not_empty;
csel x2, x2, x4, eq // len = s[0] == 0 ? 16 : 20;
mov x0, #STDOUT
b _write // write(stdout, msg, len);
mov x5, #0
ldrb w5, [x0]
ldr x1, =msg_empty
ldr x3, =msg_not_empty
mov x2, #16
mov x4, #20
cmp x5, #0
csel x1, x1, x3, eq // msg = s[0] == 0 ? msg_empty : msg_not_empty;
csel x2, x2, x4, eq // len = s[0] == 0 ? 16 : 20;
mov x0, #STDOUT
b _write // write(stdout, msg, len);
msg_empty:
.ascii "String is empty\n"
.ascii "String is empty\n"
msg_not_empty:
.ascii "String is not empty\n"
.ascii "String is not empty\n"
.align 4
//////////////// system call wrappers
// ssize_t _write(int fd, void *buf, size_t count)
_write:
stp x29, x30, [sp, -16]!
mov x8, #SVC_WRITE
mov x29, sp
svc #0
ldp x29, x30, [sp], 16
ret
stp x29, x30, [sp, -16]!
mov x8, #SVC_WRITE
mov x29, sp
svc #0
ldp x29, x30, [sp], 16
ret
// void _exit(int retval)
_exit:
mov x8, #SVC_EXIT
svc #0
mov x8, #SVC_EXIT
svc #0