Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void flush_gdt(uint16_t cs, uint16_t ds)
- {
- uint64_t scratch0;
- __asm goto(
- "lea %l[lngjmp_target](%%rip), %0\n"
- "push %1\n"
- "push %0\n"
- "ljmpq *(%%rsp)"
- : "=&r"(scratch0)
- : "g"(cs)
- : "rax"
- : lngjmp_target);
- __builtin_unreachable();
- lngjmp_target:
- __asm(
- "add $0x10,%%rsp\n"
- "mov %0, %%ds\n"
- "mov %0, %%es\n"
- "mov %0, %%fs\n"
- "mov %0, %%gs\n"
- "mov %0, %%ss\n"
- :
- : "rm"(ds));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement