Skip to content

Commit 3c5bf64

Browse files
committed
Remove preserves_flags on 32-bit x86.
The `__kernel_vsyscall` function used on 32-bit x86 does not preserve the flags register, so remove the `preserves_flags` option on inline asm blocks that call it.
1 parent e14eb95 commit 3c5bf64

File tree

1 file changed

+4
-8
lines changed
  • src/backend/linux_raw/arch/inline

1 file changed

+4
-8
lines changed

src/backend/linux_raw/arch/inline/x86.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
//! instruction.
66
//!
77
//! Most `rustix` syscalls use the vsyscall mechanism rather than going using
8-
//! `int 0x80` sequences.
8+
//! `int 0x80` sequences, as vsyscall is much faster.
9+
//!
10+
//! Syscalls made with `int 0x80` preserve the flags register, while syscalls
11+
//! made using vsyscall do not.
912
1013
#![allow(dead_code)]
1114

@@ -25,7 +28,6 @@ pub(in crate::backend) unsafe fn indirect_syscall0(
2528
"call {callee}",
2629
callee = in(reg) callee,
2730
inlateout("eax") nr.to_asm() => r0,
28-
options(preserves_flags)
2931
);
3032
FromAsm::from_asm(r0)
3133
}
@@ -42,7 +44,6 @@ pub(in crate::backend) unsafe fn indirect_syscall1(
4244
callee = in(reg) callee,
4345
inlateout("eax") nr.to_asm() => r0,
4446
in("ebx") a0.to_asm(),
45-
options(preserves_flags)
4647
);
4748
FromAsm::from_asm(r0)
4849
}
@@ -76,7 +77,6 @@ pub(in crate::backend) unsafe fn indirect_syscall2(
7677
inlateout("eax") nr.to_asm() => r0,
7778
in("ebx") a0.to_asm(),
7879
in("ecx") a1.to_asm(),
79-
options(preserves_flags)
8080
);
8181
FromAsm::from_asm(r0)
8282
}
@@ -97,7 +97,6 @@ pub(in crate::backend) unsafe fn indirect_syscall3(
9797
in("ebx") a0.to_asm(),
9898
in("ecx") a1.to_asm(),
9999
in("edx") a2.to_asm(),
100-
options(preserves_flags)
101100
);
102101
FromAsm::from_asm(r0)
103102
}
@@ -128,7 +127,6 @@ pub(in crate::backend) unsafe fn indirect_syscall4(
128127
in("ebx") a0.to_asm(),
129128
in("ecx") a1.to_asm(),
130129
in("edx") a2.to_asm(),
131-
options(preserves_flags)
132130
);
133131
FromAsm::from_asm(r0)
134132
}
@@ -161,7 +159,6 @@ pub(in crate::backend) unsafe fn indirect_syscall5(
161159
in("ecx") a1.to_asm(),
162160
in("edx") a2.to_asm(),
163161
in("edi") a4.to_asm(),
164-
options(preserves_flags)
165162
);
166163
FromAsm::from_asm(r0)
167164
}
@@ -203,7 +200,6 @@ pub(in crate::backend) unsafe fn indirect_syscall6(
203200
in("ecx") a1.to_asm(),
204201
in("edx") a2.to_asm(),
205202
in("edi") a4.to_asm(),
206-
options(preserves_flags)
207203
);
208204
FromAsm::from_asm(r0)
209205
}

0 commit comments

Comments
 (0)