Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. #include <signal.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <ucontext.h>
  5. #include <stdint.h>
  6. #include <stdlib.h>
  7.  
  8. void print(int sig, siginfo_t *info, void* v)
  9. {
  10. ucontext_t* ctx = (ucontext_t*)v;
  11. printf("CTX %p\n",ctx);
  12. printf("mcontext off %ld\n",(intptr_t)&ctx->uc_mcontext - (intptr_t)ctx);
  13. printf("gregs off %ld\n", (intptr_t)&ctx->uc_mcontext.gregs - (intptr_t)ctx);
  14. printf("fpregs off %ld\n", (intptr_t)ctx->uc_mcontext.fpregs - (intptr_t)ctx);
  15. printf("XMM0 %llx\n", *((long long*) & ctx->uc_mcontext.fpregs->_xmm[0]));
  16. printf("XMM1 %llx\n", *((long long*) & ctx->uc_mcontext.fpregs->_xmm[1]));
  17. exit(-1);
  18. }
  19. int main(){
  20. long long C1 = 0x1122334455667788LL;
  21. long long C2 = 0xAABBAABBAABBCCCCLL;
  22. struct sigaction sa;
  23. //sa.sa_handler=print;
  24. sa.sa_sigaction=print;// warning here: assignment from incompatible pointer type
  25. sa.sa_flags=SA_SIGINFO;
  26. sigaction(SIGSEGV,&sa,NULL);
  27. asm volatile(
  28. "movdqu %0, %%xmm0;"
  29. "movdqu %1, %%xmm1;"
  30. "movl $42, (0)" // BOOOOOOOOOM
  31. : : "m" (C1), "m" (C2));
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement