Skip to content

Commit e3618be

Browse files
committed
Tidy up comments in the x86 syscall code.
1 parent b233ea8 commit e3618be

File tree

1 file changed

+7
-10
lines changed
  • src/imp/linux_raw/arch/inline

1 file changed

+7
-10
lines changed

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

+7-10
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,10 @@ pub(in crate::imp) unsafe fn syscall5(
400400
a4: ArgReg<'_, A4>,
401401
) -> RetReg<R0> {
402402
let r0;
403-
// As in syscall 4, use xchg to handle a3. a4 should go in edi, and
404-
// we can use that register as an operand.
403+
// As in `syscall4`, use xchg to handle a3. a4 should go in edi, and we can
404+
// use that register as an operand. Unlike in `indirect_syscall5`, we don't
405+
// have a `callee` operand taking up a register, so we have enough
406+
// registers and don't need to use a slice.
405407
asm!(
406408
"xchg esi, {a3}",
407409
"int $$0x80",
@@ -428,6 +430,7 @@ pub(in crate::imp) unsafe fn syscall5_readonly(
428430
a4: ArgReg<'_, A4>,
429431
) -> RetReg<R0> {
430432
let r0;
433+
// See the comments in `syscall5`.
431434
asm!(
432435
"xchg esi, {a3}",
433436
"int $$0x80",
@@ -455,14 +458,7 @@ pub(in crate::imp) unsafe fn syscall6(
455458
a5: ArgReg<'_, A5>,
456459
) -> RetReg<R0> {
457460
let r0;
458-
// Oof. a3 should go in esi, and a5 should go in ebp, and `asm!` won't
459-
// let us use either of those registers as operands. And we can't request
460-
// stack slots. And there are no other registers free. Use eax as a
461-
// temporary pointer to a slice, since it gets clobbered as the return
462-
// value anyway.
463-
//
464-
// This is another reason that syscalls should be compiler intrinsics
465-
// rather than inline asm.
461+
// See the comments in `indirect_syscall6`.
466462
asm!(
467463
"push ebp",
468464
"push esi",
@@ -494,6 +490,7 @@ pub(in crate::imp) unsafe fn syscall6_readonly(
494490
a5: ArgReg<'_, A5>,
495491
) -> RetReg<R0> {
496492
let r0;
493+
// See the comments in `indirect_syscall6`.
497494
asm!(
498495
"push ebp",
499496
"push esi",

0 commit comments

Comments
 (0)