x86_64 Does the Linux Kernel set the Carry Flag upon an Error?

clevor

New Member
Joined
Dec 25, 2023
Messages
1
Reaction score
0
Credits
15
I am working on developing small (<256 byte) programs for my Linux computer. My laptop runs Debian 12 with the kernel being version 6.1.0-16-amd64. Normally, I set up a routine to check if the kernel returns an error after a syscall. IIRC the minimum value indicating an error is -4096. I once optimized it to check if the second byte, AH in this case, is >-16. To simplify the code and reduce the binary size, I want to be able to conditionally jump based on a flag. I know FreeBSD sets the carry flag when an error occurs, but I couldn't find any information for Linux after a quick search. Is this behavior the same on Linux as it is FreeBSD?
 

Members online


Latest posts

Top