/* It's at the target address, check if it has a matching type */
static bool check_matching_type(struct type_state *state,
struct data_loc_info *dloc, int reg,
- Dwarf_Die *type_die)
+ Dwarf_Die *cu_die, Dwarf_Die *type_die)
{
Dwarf_Word size;
u32 insn_offset = dloc->ip - dloc->ms->sym->start;
return true;
}
+ if (map__dso(dloc->ms->map)->kernel && arch__is(dloc->arch, "x86")) {
+ u64 addr;
+ int offset;
+
+ if (dloc->op->segment == INSN_SEG_X86_GS && dloc->op->imm) {
+ pr_debug_dtp(" this-cpu var\n");
+
+ addr = dloc->op->offset;
+
+ if (get_global_var_type(cu_die, dloc, dloc->ip, addr,
+ &offset, type_die)) {
+ dloc->type_offset = offset;
+ return true;
+ }
+ }
+ }
+
pr_debug_dtp("\n");
return false;
}
if (this_ip == dloc->ip) {
found = check_matching_type(&state, dloc, reg,
- type_die);
+ cu_die, type_die);
goto out;
}
op_loc->offset, dl);
}
+ /* This CPU access in kernel - pretend PC-relative addressing */
+ if (map__dso(ms->map)->kernel && arch__is(arch, "x86") &&
+ op_loc->segment == INSN_SEG_X86_GS && op_loc->imm) {
+ dloc.var_addr = op_loc->offset;
+ op_loc->reg1 = DWARF_REG_PC;
+ }
+
mem_type = find_data_type(&dloc);
if (mem_type)
istat->good++;