Skip to content

Commit b1c7c14

Browse files
author
Peter Huene
committed
Fix incorrect scaling for SaveXmm128Far.
The `SaveXmm128Far` unwind op should have a 32-bit unscaled value. The value was accidentally scaled down by 16 while calculating whether or not the `SaveXmm128` or `SaveXmm128Far` unwind op should be used.
1 parent b391817 commit b1c7c14

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cranelift/codegen/src/isa/unwind/winx64.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ impl UnwindCode {
8080
stack_offset,
8181
} => {
8282
writer.write_u8(*offset);
83-
let stack_offset = stack_offset / 16;
84-
if stack_offset <= core::u16::MAX as u32 {
83+
let scaled_stack_offset = stack_offset / 16;
84+
if scaled_stack_offset <= core::u16::MAX as u32 {
8585
writer.write_u8((*reg << 4) | (UnwindOperation::SaveXmm128 as u8));
86-
writer.write_u16::<LittleEndian>(stack_offset as u16);
86+
writer.write_u16::<LittleEndian>(scaled_stack_offset as u16);
8787
} else {
8888
writer.write_u8((*reg << 4) | (UnwindOperation::SaveXmm128Far as u8));
89-
writer.write_u16::<LittleEndian>(stack_offset as u16);
89+
writer.write_u16::<LittleEndian>(*stack_offset as u16);
9090
writer.write_u16::<LittleEndian>((stack_offset >> 16) as u16);
9191
}
9292
}

0 commit comments

Comments
 (0)