Skip to content

Commit

Permalink
WIP windows
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Aug 14, 2018
1 parent 7c73df9 commit 3be3c1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
8 changes: 4 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ environment:
matrix:
- TARGET: x86_64-pc-windows-msvc
MSYS2_BITS: 64
- TARGET: i686-pc-windows-msvc
MSYS2_BITS: 32
# - TARGET: i686-pc-windows-msvc
# MSYS2_BITS: 32

# branches to build
branches:
Expand All @@ -26,15 +26,15 @@ install:
- cd xargo
- set RUSTFLAGS=-Zalways-encode-mir -Zmir-emit-validate=1
- xargo build
- set RUSTFLAGS=
- cd ..

build: false

test_script:
- set RUSTFLAGS=-g
- set RUST_BACKTRACE=1
- cargo build --release
- cargo test --release
# - cargo test --release
- set MIRI_SYSROOT=C:\Users\appveyor\.xargo\HOST
- cargo test --release

Expand Down
10 changes: 4 additions & 6 deletions src/fn_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,12 +646,12 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
"TryEnterCriticalSection" => {
// pretend these do not exist/nothing happened, by returning zero
let ptr_size = self.memory.pointer_size();
self.write_scalar(dest, Scalar::from_int(0, ptr_size), dest_ty)?;
self.write_scalar(dest, Scalar::from_int(0, dest_layout.size), dest_ty)?;
},
"GetLastError" => {
// this is c::ERROR_CALL_NOT_IMPLEMENTED
let ptr_size = self.memory.pointer_size();
self.write_scalar(dest, Scalar::from_int(120, ptr_size), dest_ty)?;
self.write_scalar(dest, Scalar::from_int(120, dest_layout.size), dest_ty)?;
},

// Windows TLS
Expand All @@ -665,8 +665,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
if dest_layout.size.bits() < 128 && key >= (1u128 << dest_layout.size.bits() as u128) {
return err!(OutOfTls);
}
let ptr_size = self.memory.pointer_size();
self.write_scalar(dest, Scalar::from_uint(key, ptr_size), dest_layout.ty)?;
self.write_scalar(dest, Scalar::from_uint(key, dest_layout.size), dest_layout.ty)?;
}
"TlsGetValue" => {
let key = self.value_to_scalar(args[0])?.to_bytes()?;
Expand All @@ -677,10 +676,9 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
let key = self.value_to_scalar(args[0])?.to_bytes()?;
let new_ptr = self.into_ptr(args[1].value)?.unwrap_or_err()?;
self.memory.store_tls(key, new_ptr)?;
let ptr_size = self.memory.pointer_size();

// Return success (1)
self.write_scalar(dest, Scalar::from_int(1, ptr_size), dest_ty)?;
self.write_scalar(dest, Scalar::from_int(1, dest_layout.size), dest_ty)?;
}

// We can't execute anything else
Expand Down

0 comments on commit 3be3c1f

Please sign in to comment.