File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -476,8 +476,13 @@ 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.
479+ // Changes compared to Apple's implementation:
480+ // * Replace `svc` instruction by calling `__darling_handle_svc` (as a
481+ // consequence, an additional `PUSH_FRAME` and `POP_FRAME` has been
482+ // added)
483+ // * Set the carry flag, by using the `cmn` instruction.
484+ // * Convert the negative error code into a positive error code before
485+ // calling `cerror` (errno must be a positive integer).
481486#define DO_SYSCALL (num , cerror ) \
482487 mov x16, #(num) %%\
483488 PUSH_FRAME %%\
@@ -487,6 +492,7 @@ pseudo: ;\
487492 b.cc 2f %%\
488493 ARM64_STACK_PROLOG %%\
489494 PUSH_FRAME %%\
495+ neg x0, x0 %%\
490496 bl _##cerror %%\
491497 POP_FRAME %%\
492498 ARM64_STACK_EPILOG %%\
Original file line number Diff line number Diff line change @@ -476,8 +476,13 @@ 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.
479+ // Changes compared to Apple's implementation:
480+ // * Replace `svc` instruction by calling `__darling_handle_svc` (as a
481+ // consequence, an additional `PUSH_FRAME` and `POP_FRAME` has been
482+ // added)
483+ // * Set the carry flag, by using the `cmn` instruction.
484+ // * Convert the negative error code into a positive error code before
485+ // calling `cerror` (errno must be a positive integer).
481486#define DO_SYSCALL (num , cerror ) \
482487 mov x16, #(num) %%\
483488 PUSH_FRAME %%\
@@ -487,6 +492,7 @@ pseudo: ;\
487492 b.cc 2f %%\
488493 ARM64_STACK_PROLOG %%\
489494 PUSH_FRAME %%\
495+ neg x0, x0 %%\
490496 bl _##cerror %%\
491497 POP_FRAME %%\
492498 ARM64_STACK_EPILOG %%\
You can’t perform that action at this time.
0 commit comments