From a9f41d7303d93c60621ca072f9f25bde0e58d9e2 Mon Sep 17 00:00:00 2001 From: William Orr Date: Mon, 2 May 2016 11:18:15 -0700 Subject: [PATCH] Replace movaps with movups objdump on my system and code snippet in blog agree - problem is caused by `movups` not `movaps`. Fix surrounding text and doc link to reflect this. --- blog/post/2015-09-02-set-up-rust.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/post/2015-09-02-set-up-rust.md b/blog/post/2015-09-02-set-up-rust.md index 477389d7..e90cf4cc 100644 --- a/blog/post/2015-09-02-set-up-rust.md +++ b/blog/post/2015-09-02-set-up-rust.md @@ -271,12 +271,12 @@ So let's look at the first exception: `old:0xffffffff` means that the CPU wasn't > objdump -D build/kernel-x86_64.bin | grep "10018a:" 10018a: 0f 10 05 c7 01 00 00 movups 0x1c7(%rip),%xmm0 ... ``` -Through `objdump -D` we disassemble our whole kernel and `grep` picks the relevant line. The instruction at `0x10018a` seems to be a valid `movaps` instruction. It's a [SSE] instruction that moves 128 bit between memory and SSE-registers (e.g. `xmm0`). But why the `Invalid Opcode` exception? The answer is hidden behind the [movaps documentation][movaps]: The section _Protected Mode Exceptions_ lists the conditions for the various exceptions. The short code of the `Invalid Opcode` is `#UD`. An `#UD` exception occurs: +Through `objdump -D` we disassemble our whole kernel and `grep` picks the relevant line. The instruction at `0x10018a` seems to be a valid `movups` instruction. It's a [SSE] instruction that moves 128 bit between memory and SSE-registers (e.g. `xmm0`). But why the `Invalid Opcode` exception? The answer is hidden behind the [movups documentation][movups]: The section _Protected Mode Exceptions_ lists the conditions for the various exceptions. The short code of the `Invalid Opcode` is `#UD`. An `#UD` exception occurs: > If an unmasked SIMD floating-point exception and OSXMMEXCPT in CR4 is 0. If EM in CR0 is set. If OSFXSR in CR4 is 0. If CPUID feature flag SSE is 0. [SSE]: https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions -[movaps]: http://www.c3se.chalmers.se/Common/VTUNE-9.1/doc/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/mergedProjects/instructions/instruct32_hh/vc181.htm +[movups]: http://www.c3se.chalmers.se/Common/VTUNE-9.1/doc/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/mergedProjects/instructions/instruct32_hh/vc206.htm The rough translation of this cryptic definition is: _If SSE isn't enabled_. So apparently Rust uses SSE instructions by default and we didn't enable SSE before. To fix this, we can either disable SSE instructions in the compiler or enable SSE in our kernel. We do the latter, as it's easier.