Skip to content

Commit

Permalink
Use att_syntax for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Demindiro committed Jul 7, 2022
1 parent 51971a2 commit fbc0922
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions src/mem/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ pub unsafe fn copy_forward(mut dest: *mut u8, mut src: *const u8, count: usize)
inout("ecx") pre_byte_count => _,
inout("rdi") dest => dest,
inout("rsi") src => src,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
}
asm!(
"rep movsq",
inout("rcx") qword_count => _,
inout("rdi") dest => dest,
inout("rsi") src => src,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
if byte_count > 0 {
asm!(
"rep movsb",
inout("ecx") byte_count => _,
inout("rdi") dest => _,
inout("rsi") src => _,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
}
}
Expand All @@ -74,13 +74,13 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
asm!(
"std",
"rep movsb",
"sub rsi, 7",
"sub rdi, 7",
"mov rcx, {qword_count}",
"sub $7, %rsi",
"sub $7, %rdi",
"mov {qword_count}, %rcx",
"rep movsq",
"add rsi, 7",
"add rdi, 7",
"mov ecx, {pre_byte_count:e}",
"add $7, %rsi",
"add $7, %rdi",
"mov {pre_byte_count:e}, %ecx",
"rep movsb",
"cld",
pre_byte_count = in(reg) pre_byte_count,
Expand All @@ -89,7 +89,7 @@ pub unsafe fn copy_backward(dest: *mut u8, src: *const u8, count: usize) {
inout("rdi") dest.add(count - 1) => _,
inout("rsi") src.add(count - 1) => _,
// We modify flags, but we restore it afterwards
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
}

Expand Down Expand Up @@ -120,23 +120,23 @@ pub unsafe fn set_bytes(mut dest: *mut u8, c: u8, count: usize) {
inout("ecx") pre_byte_count => _,
inout("rdi") dest => dest,
in("rax") c,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
}
asm!(
"rep stosq",
inout("rcx") qword_count => _,
inout("rdi") dest => dest,
in("rax") c,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
if byte_count > 0 {
asm!(
"rep stosb",
inout("ecx") byte_count => _,
inout("rdi") dest => _,
in("rax") c,
options(nostack, preserves_flags)
options(att_syntax, nostack, preserves_flags)
);
}
}
Expand Down

0 comments on commit fbc0922

Please sign in to comment.