Support getrandom in ptraceomatic

This commit is contained in:
Theodore Dubois 2018-11-04 19:35:17 -08:00
parent e982b7d2a6
commit ebcd6aefea

View File

@ -102,7 +102,8 @@ static int compare_cpus(struct cpu_state *cpu, struct tlb *tlb, int pid, int und
CHECK_XMMREG(6);
CHECK_XMMREG(7);
CHECK(fpregs.swd, cpu->fsw, "fsw");
#define FSW_MASK 0x7d00 // only look at top, c0, c2, c3
CHECK(fpregs.swd & FSW_MASK, cpu->fsw & FSW_MASK, "fsw");
CHECK(fpregs.cwd, cpu->fcw, "fcw");
#define CHECK_FPREG(i) \
CHECK(*(uint64_t *) &fpregs.st_space[i * 4], cpu->fp[(cpu->top + i)%8].signif, "st(" #i ") signif") \
@ -365,6 +366,9 @@ static void step_tracing(struct cpu_state *cpu, struct tlb *tlb, int pid, int se
case 265: // clock_gettime
pt_copy(pid, regs.rcx, sizeof(struct timespec_)); break;
case 355: // getrandom
pt_copy(pid, regs.rbx, regs.rcx); break;
case 90: // mmap
case 192: // mmap2
if (cpu->eax < 0xfffff000 && cpu->edi != (dword_t) -1) {