- for (i = 0; i < opcnt; i++)
- if (!(ops[i].flags & OPF_DONE))
- break;
-
- while (ops[i].op == OP_PUSH && IS(opr_name(&ops[i], 0), "ecx")) {
- ops[i].flags |= OPF_RMD | OPF_DONE | OPF_NOREGS;
- g_stack_fsz += 4;
- ecx_push++;
- i++;
- }
-
- for (; i < opcnt; i++) {
- if (ops[i].op == OP_PUSH || (ops[i].flags & (OPF_JMP|OPF_TAIL)))
- break;
- if (ops[i].op == OP_SUB && ops[i].operand[0].reg == xSP
- && ops[i].operand[1].type == OPT_CONST)
- {
- g_stack_fsz += ops[i].operand[1].val;
- ops[i].flags |= OPF_RMD | OPF_DONE | OPF_NOREGS;
- i++;
- esp_sub = 1;
- break;
- }
- else if (ops[i].op == OP_MOV && ops[i].operand[0].reg == xAX
- && ops[i].operand[1].type == OPT_CONST
- && ops[i + 1].op == OP_CALL
- && IS(opr_name(&ops[i + 1], 0), "__alloca_probe"))
- {
- g_stack_fsz += ops[i].operand[1].val;
- ops[i].flags |= OPF_RMD | OPF_DONE | OPF_NOREGS;
- i++;
- ops[i].flags |= OPF_RMD | OPF_DONE | OPF_NOREGS;
- i++;
- esp_sub = 1;
- break;
- }
- }
+ i = scan_prologue(0, opcnt, &ecx_push, &esp_sub);