Skip to content

Commit 1fbf998

Browse files
committed
Fix remaining windows hooks
1 parent 7c73df9 commit 1fbf998

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ install:
2626
- cd xargo
2727
- set RUSTFLAGS=-Zalways-encode-mir -Zmir-emit-validate=1
2828
- xargo build
29-
- set RUSTFLAGS=
3029
- cd ..
3130

3231
build: false
3332

3433
test_script:
34+
- set RUSTFLAGS=-g
3535
- set RUST_BACKTRACE=1
3636
- cargo build --release
3737
- cargo test --release

src/fn_call.rs

+4-8
Original file line numberDiff line numberDiff line change
@@ -645,13 +645,11 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
645645
"GetProcAddress" |
646646
"TryEnterCriticalSection" => {
647647
// pretend these do not exist/nothing happened, by returning zero
648-
let ptr_size = self.memory.pointer_size();
649-
self.write_scalar(dest, Scalar::from_int(0, ptr_size), dest_ty)?;
648+
self.write_scalar(dest, Scalar::from_int(0, dest_layout.size), dest_ty)?;
650649
},
651650
"GetLastError" => {
652651
// this is c::ERROR_CALL_NOT_IMPLEMENTED
653-
let ptr_size = self.memory.pointer_size();
654-
self.write_scalar(dest, Scalar::from_int(120, ptr_size), dest_ty)?;
652+
self.write_scalar(dest, Scalar::from_int(120, dest_layout.size), dest_ty)?;
655653
},
656654

657655
// Windows TLS
@@ -665,8 +663,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
665663
if dest_layout.size.bits() < 128 && key >= (1u128 << dest_layout.size.bits() as u128) {
666664
return err!(OutOfTls);
667665
}
668-
let ptr_size = self.memory.pointer_size();
669-
self.write_scalar(dest, Scalar::from_uint(key, ptr_size), dest_layout.ty)?;
666+
self.write_scalar(dest, Scalar::from_uint(key, dest_layout.size), dest_layout.ty)?;
670667
}
671668
"TlsGetValue" => {
672669
let key = self.value_to_scalar(args[0])?.to_bytes()?;
@@ -677,10 +674,9 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
677674
let key = self.value_to_scalar(args[0])?.to_bytes()?;
678675
let new_ptr = self.into_ptr(args[1].value)?.unwrap_or_err()?;
679676
self.memory.store_tls(key, new_ptr)?;
680-
let ptr_size = self.memory.pointer_size();
681677

682678
// Return success (1)
683-
self.write_scalar(dest, Scalar::from_int(1, ptr_size), dest_ty)?;
679+
self.write_scalar(dest, Scalar::from_int(1, dest_layout.size), dest_ty)?;
684680
}
685681

686682
// We can't execute anything else

0 commit comments

Comments
 (0)