Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <signal.h>
- #include <stdio.h>
- #include <string.h>
- #include <ucontext.h>
- #include <stdint.h>
- #include <stdlib.h>
- void print(int sig, siginfo_t *info, void* v)
- {
- ucontext_t* ctx = (ucontext_t*)v;
- printf("CTX %p\n",ctx);
- printf("mcontext off %ld\n",(intptr_t)&ctx->uc_mcontext - (intptr_t)ctx);
- printf("gregs off %ld\n", (intptr_t)&ctx->uc_mcontext.gregs - (intptr_t)ctx);
- printf("fpregs off %ld\n", (intptr_t)ctx->uc_mcontext.fpregs - (intptr_t)ctx);
- printf("XMM0 %llx\n", *((long long*) & ctx->uc_mcontext.fpregs->_xmm[0]));
- printf("XMM1 %llx\n", *((long long*) & ctx->uc_mcontext.fpregs->_xmm[1]));
- exit(-1);
- }
- int main(){
- long long C1 = 0x1122334455667788LL;
- long long C2 = 0xAABBAABBAABBCCCCLL;
- struct sigaction sa;
- //sa.sa_handler=print;
- sa.sa_sigaction=print;// warning here: assignment from incompatible pointer type
- sa.sa_flags=SA_SIGINFO;
- sigaction(SIGSEGV,&sa,NULL);
- asm volatile(
- "movdqu %0, %%xmm0;"
- "movdqu %1, %%xmm1;"
- "movl $42, (0)" // BOOOOOOOOOM
- : : "m" (C1), "m" (C2));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement