Lines Matching refs:context
105 copy_int_register(struct fetch_context *context, in copy_int_register() argument
112 context->ireg++; in copy_int_register()
116 copy_sse_register(struct fetch_context *context, struct value *valuep, in copy_sse_register() argument
124 size_t off = 4 * context->freg++; in copy_sse_register()
125 memcpy(u.sse, context->fpregs.xmm_space + off, sizeof(u.sse)); in copy_sse_register()
137 allocate_stack_slot(struct fetch_context *context, in allocate_stack_slot() argument
145 context->stack_pointer in allocate_stack_slot()
146 = (void *)align((unsigned long)context->stack_pointer, a); in allocate_stack_slot()
148 value_in_inferior(valuep, context->stack_pointer); in allocate_stack_slot()
149 context->stack_pointer += sz; in allocate_stack_slot()
153 allocate_x87(struct fetch_context *context, struct value *valuep, in allocate_x87() argument
163 allocate_stack_slot(context, valuep, sz, offset, archw); in allocate_x87()
197 reg = &context->fpregs.st_space[0]; in allocate_x87()
213 allocate_integer(struct fetch_context *context, struct value *valuep, in allocate_integer() argument
218 copy_int_register(context, valuep, \ in allocate_integer()
219 context->iregs.WHICH, offset); \ in allocate_integer()
225 switch (context->ireg) { in allocate_integer()
233 allocate_stack_slot(context, valuep, sz, offset, 8); in allocate_integer()
242 if (context->machine == EM_X86_64) { in allocate_integer()
243 switch (context->ireg) { in allocate_integer()
256 if (context->machine == EM_386) { in allocate_integer()
264 switch (context->ireg) { in allocate_integer()
279 switch (context->ireg) { in allocate_integer()
298 allocate_sse(struct fetch_context *context, struct value *valuep, in allocate_sse() argument
311 if (context->freg >= num_regs) { in allocate_sse()
315 allocate_stack_slot(context, valuep, sz, offset, 8); in allocate_sse()
318 copy_sse_register(context, valuep, 0, sz, offset); in allocate_sse()
326 allocate_class(enum arg_class cls, struct fetch_context *context, in allocate_class() argument
331 allocate_stack_slot(context, valuep, sz, offset, 8); in allocate_class()
336 return allocate_integer(context, valuep, sz, offset, pool); in allocate_class()
339 return allocate_sse(context, valuep, sz, offset, pool); in allocate_class()
342 return allocate_x87(context, valuep, sz, offset, pool, 8); in allocate_class()
348 classify(struct process *proc, struct fetch_context *context,
354 classify_eightbyte(struct process *proc, struct fetch_context *context, in classify_eightbyte() argument
368 if (classify(proc, context, info2, &cls2, sz, 1) < 0) in classify_eightbyte()
389 classify_eightbytes(struct process *proc, struct fetch_context *context, in classify_eightbytes() argument
409 if (classify_eightbyte(proc, context, info, &cls1, in classify_eightbytes()
411 || classify_eightbyte(proc, context, info, &cls2, in classify_eightbytes()
425 return classify_eightbyte(proc, context, info, classes, in classify_eightbytes()
457 classify(struct process *proc, struct fetch_context *context, in classify() argument
499 return classify_eightbytes(proc, context, info, classes, in classify()
516 ret = classify_eightbytes(proc, context, &flattened, in classify()
542 classify_argument(struct process *proc, struct fetch_context *context, in classify_argument() argument
566 return classify(proc, context, info, classes, sz, eightbytes); in classify_argument()
570 fetch_register_banks(struct process *proc, struct fetch_context *context, in fetch_register_banks() argument
573 if (ptrace(PTRACE_GETREGS, proc->pid, 0, &context->iregs) < 0) in fetch_register_banks()
575 context->ireg = 0; in fetch_register_banks()
579 0, &context->fpregs) < 0) in fetch_register_banks()
581 context->freg = 0; in fetch_register_banks()
583 context->freg = -1; in fetch_register_banks()
590 arch_fetch_arg_next_32(struct fetch_context *context, enum tof type, in arch_fetch_arg_next_32() argument
601 int cls = allocate_integer(context, valuep, in arch_fetch_arg_next_32()
607 allocate_stack_slot(context, valuep, sz, 0, 4); in arch_fetch_arg_next_32()
613 arch_fetch_retval_32(struct fetch_context *context, enum tof type, in arch_fetch_retval_32() argument
617 if (fetch_register_banks(proc, context, type == LT_TOF_FUNCTIONR) < 0) in arch_fetch_retval_32()
620 struct value *retval = &context->u.ix86.retval; in arch_fetch_retval_32()
624 memcpy(valuep, &context->u.ix86.retval, sizeof(*valuep)); in arch_fetch_retval_32()
647 cls = allocate_integer(context, valuep, sz, 0, POOL_RETVAL); in arch_fetch_retval_32()
653 cls = allocate_x87(context, valuep, sz, 0, POOL_RETVAL, 4); in arch_fetch_retval_32()
667 fetch_stack_pointer(struct fetch_context *context) in fetch_stack_pointer() argument
671 sp = (arch_addr_t)context->iregs.rsp; in fetch_stack_pointer()
673 sp = (arch_addr_t)context->iregs.esp; in fetch_stack_pointer()
679 arch_fetch_arg_init_32(struct fetch_context *context, in arch_fetch_arg_init_32() argument
683 context->stack_pointer = fetch_stack_pointer(context) + 4; in arch_fetch_arg_init_32()
689 struct value *retval = &context->u.ix86.retval; in arch_fetch_arg_init_32()
696 allocate_stack_slot(context, retval, 4, 0, 4); in arch_fetch_arg_init_32()
702 return context; in arch_fetch_arg_init_32()
759 arch_fetch_arg_clone(struct process *proc, struct fetch_context *context) in arch_fetch_arg_clone() argument
764 return memcpy(ret, context, sizeof(*ret)); in arch_fetch_arg_clone()
768 arch_fetch_pool_arg_next(struct fetch_context *context, enum tof type, in arch_fetch_pool_arg_next() argument
775 ssize_t nclasses = classify_argument(proc, context, info, valuep, in arch_fetch_pool_arg_next()
786 struct fetch_context tmp_context = *context; in arch_fetch_pool_arg_next()
802 allocate_class(CLASS_MEMORY, context, valuep, sz, 0, pool); in arch_fetch_pool_arg_next()
804 *context = tmp_context; /* Commit. */ in arch_fetch_pool_arg_next()
810 arch_fetch_fun_retval(struct fetch_context *context, enum tof type, in arch_fetch_fun_retval() argument
816 if (value_reserve(valuep, 8 * context->u.x86_64.num_ret_classes) == NULL in arch_fetch_fun_retval()
817 || fetch_register_banks(proc, context, in arch_fetch_fun_retval()
821 if (context->u.x86_64.num_ret_classes == 1 in arch_fetch_fun_retval()
822 && context->u.x86_64.ret_classes[0] == CLASS_MEMORY) in arch_fetch_fun_retval()
823 pass_by_reference(valuep, context->u.x86_64.ret_classes); in arch_fetch_fun_retval()
830 size_t sz1 = context->u.x86_64.num_ret_classes == 1 ? sz : 8; in arch_fetch_fun_retval()
831 for (i = 0; i < context->u.x86_64.num_ret_classes; ++i) { in arch_fetch_fun_retval()
833 = allocate_class(context->u.x86_64.ret_classes[i], in arch_fetch_fun_retval()
834 context, valuep, sz1, in arch_fetch_fun_retval()
836 assert(cls == context->u.x86_64.ret_classes[i]); in arch_fetch_fun_retval()
842 arch_fetch_arg_next(struct fetch_context *context, enum tof type, in arch_fetch_arg_next() argument
847 return arch_fetch_arg_next_32(context, type, proc, in arch_fetch_arg_next()
853 return arch_fetch_pool_arg_next(context, type, proc, in arch_fetch_arg_next()
858 return arch_fetch_pool_arg_next(context, type, proc, in arch_fetch_arg_next()
866 arch_fetch_retval(struct fetch_context *context, enum tof type, in arch_fetch_retval() argument
871 return arch_fetch_retval_32(context, type, proc, info, valuep); in arch_fetch_retval()
873 return arch_fetch_fun_retval(context, type, proc, info, valuep); in arch_fetch_retval()
877 arch_fetch_arg_done(struct fetch_context *context) in arch_fetch_arg_done() argument
879 if (context != NULL) in arch_fetch_arg_done()
880 free(context); in arch_fetch_arg_done()