Skip to content

Instantly share code, notes, and snippets.

@Badel2
Badel2 / spectre.c
Last active March 12, 2023 00:18
Spectre attack example implementation
/* https://spectreattack.com/spectre.pdf */
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif