Skip to content

Commit 59096eb

Browse files
committed
Set Carry Flag If Returned Value Is Between [-1, -4095]
Based off of how we handle the carry flag for x86.
1 parent 542043e commit 59096eb

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

gen/bsdsyscalls/SYS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,14 @@ pseudo: ;\
476476
*/
477477

478478
#ifdef DARLING
479+
// In addition to changing the macro to use __darling_handle_svc instead of the
480+
// syscall (svc) instruction, We are also setting the carry flag as well.
479481
#define DO_SYSCALL(num, cerror) \
480482
mov x16, #(num) %%\
481483
PUSH_FRAME %%\
482484
bl __darling_handle_svc %%\
483485
POP_FRAME %%\
486+
cmn x0, #4095 %%\
484487
b.cc 2f %%\
485488
ARM64_STACK_PROLOG %%\
486489
PUSH_FRAME %%\

libsyscall/custom/SYS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,14 @@ pseudo: ;\
476476
*/
477477

478478
#ifdef DARLING
479+
// In addition to changing the macro to use __darling_handle_svc instead of the
480+
// syscall (svc) instruction, We are also setting the carry flag as well.
479481
#define DO_SYSCALL(num, cerror) \
480482
mov x16, #(num) %%\
481483
PUSH_FRAME %%\
482484
bl __darling_handle_svc %%\
483485
POP_FRAME %%\
486+
cmn x0, #4095 %%\
484487
b.cc 2f %%\
485488
ARM64_STACK_PROLOG %%\
486489
PUSH_FRAME %%\

0 commit comments

Comments
 (0)