Closed rknath closed 9 years ago
Looks like the error code is different at the end. Is it because the memory isn't set up properly ?
I don't think the validator has support for immediate memory offsets as it is, but this would be easy to do, I think.
You need to explicitly setup the CpuState to map memmory starting at 0x1000. Take a look in the state/ folder, and (I think) the file is memory.h. This isn't an x64asm issue though (x64asm is just the assembler, not the rest of stoke). I'll close this.
I posted in the wrong place. I couldn't find a way to move it to stoke. I was getting similar error while testing code like movdqu (%rax), %xmm1
You should check the assembly or the spreadsheet yourself -- we can't debug for you! :)
I went over the spread sheet. I didn't notice anything for this instruction. For a new Stoke user (not a developer) with limited knowledge on how different features (to what extent) are implemented in stoke, it may not be always trivial to understand the exact cause of an error.
It's not trivial for us to understand the exact cause of an error either, especially when we can't reproduce it. In fact, debugging is fairly involved. I recommend you collect more information. You've said the tests failed, but you haven't shown the error message. Usually the validator error messages are packed with information. I would recommend investigating the following:
My first guess would be that it's just making sure the sandbox has memory mapped in the correct location. With movdqu (%rax), %xmm1
, the sandbox should have memory at the address pointed to by 'rax', although stategen should set this up for you.
movdqu 0x1000, %xmm1
It fails during validation.
is it because of the memory operand ????
git_diff diff --git a/Makefile b/Makefile index 66b78da..3260294 100644 --- a/Makefile +++ b/Makefile @@ -13,8 +13,8 @@
limitations under the License.
CONSTANT DEFINITIONS
-CXX=ccache g++ -std=c++11 -Werror -Wextra -Wfatal-errors +CCACHES=#ccache +CXX=$(CCACHES) g++ -std=c++11 -Werror -Wextra -Wfatal-errors
INC_FOLDERS=\ ./ \ @@ -198,12 +198,12 @@ src/ext/astyle: $(MAKE) -C src/ext/astyle/build/gcc -j8
src/ext/cpputil:
git clone https://github.com/eschkufz/cpputil src/ext/cpputil && \ cd src/ext/cpputil && \ git checkout e7b99c1
src/ext/x64asm:
diff --git a/src/validator/handlers/packed_handler.cc b/src/validator/handlers/packed_handler.cc index 0cad40b..5bff6f9 100644 --- a/src/validator/handlers/packed_handler.cc +++ b/src/validator/handlers/packed_handler.cc @@ -100,6 +100,12 @@ void PackedHandler::build_circuit(const x64asm::Instruction& instr, SymState& st
// Compute the result SymBitVector result;
} +
if(limit) { // Only apply binop to lower bits. Useful for scalar operations. diff --git a/src/validator/handlers/packed_handler.h b/src/validator/handlers/packed_handler.h index b314b29..7fc1a4d 100644 --- a/src/validator/handlers/packed_handler.h +++ b/src/validator/handlers/packed_handler.h @@ -690,6 +690,14 @@ public: return a ^ b; }, 0);
},128,128, false, false); +
}
cat movdqu.h class ValidatorMovdquTest : public ValidatorTest {};
TEST_F(ValidatorMovdquTest, NotANoop) {
target << "movdqu 0x1000, %xmm1" << std::endl; target << "retq" << std::endl;
//rewrite << "movdqu %xmm7, %ebx" << std::endl; rewrite << "retq" << std::endl;
assert_ceg(); } TEST_F(ValidatorMovdquTest, Identity) {
target << "movdqu 0x1000, %xmm1" << std::endl; target << "retq" << std::endl;
rewrite << "movdqu 0x1000, %xmm1" << std::endl; rewrite << "retq" << std::endl;
assert_equiv(); } TEST_F(ValidatorMovdquTest, LooksCorrect) {
target << "movdqu 0x1000, %xmm1" << std::endl; target << "retq" << std::endl;
stoke::Sandbox sb; sb.set_abi_check(false); stoke::StateGen sg(&sb); stoke::CpuState cs; sg.get(cs);
set_live_outs(x64asm::RegSet::empty() + x64asm::xmm1);
check_circuit(cs);
}
TEST_F(ValidatorMovdquTest, HardwareTest1){
target << "movdqu 0x1000, %xmm1" << std::endl; target << "retq" << std::endl;
stoke::Sandbox sb; sb.set_abi_check(false); stoke::StateGen sg(&sb); stoke::CpuState cs; sg.get(cs); cs.sse[x64asm::ymm1].get_fixed_quad(0) = 0x0001000200030004; cs.sse[x64asm::ymm1].get_fixed_quad(1) = 0x0005000600070008; cs.sse[x64asm::ymm1].get_fixed_quad(2) = 0xffffffffffffffff; cs.sse[x64asm::ymm1].get_fixed_quad(3) = 0xffffffffffffffff; set_live_outs(x64asm::RegSet::empty() + x64asm::xmm1); check_circuit(cs); }
[ FAILED ] ValidatorMovdquTest.NotANoop [ FAILED ] ValidatorMovdquTest.Identity [ FAILED ] ValidatorMovdquTest.LooksCorrect [ FAILED ] ValidatorMovdquTest.HardwareTest1