/* reset cpu states */
if(self->cpu_states[i].mode_stack->len > 0) {
g_array_remove_range(self->cpu_states[i].mode_stack, 0, self->cpu_states[i].mode_stack->len);
- self->cpu_states[i].last_irq = -1;
+ if(self->cpu_states[i].irq_stack->len)
+ g_array_remove_range(self->cpu_states[i].irq_stack, 0, self->cpu_states[i].irq_stack->len);
self->cpu_states[i].last_soft_irq = -1;
self->cpu_states[i].last_trap = -1;
}
tcs->cpu_states = g_new(LttvCPUState, nb_cpu);
for(j = 0; j<nb_cpu; j++) {
tcs->cpu_states[j].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode));
- tcs->cpu_states[j].last_irq = -1;
+ tcs->cpu_states[j].irq_stack = g_array_new(FALSE, FALSE, sizeof(gint));
tcs->cpu_states[j].last_soft_irq = -1;
tcs->cpu_states[j].last_trap = -1;
g_assert(tcs->cpu_states[j].mode_stack != NULL);
retval = g_new(LttvCPUState, n);
for(i=0; i<n; i++) {
- retval[i].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode));
- retval[i].last_irq = states[i].last_irq;
retval[i].last_soft_irq = states[i].last_soft_irq;
retval[i].last_trap = states[i].last_trap;
+
+ retval[i].irq_stack = g_array_new(FALSE, FALSE, sizeof(gint));
+ g_array_set_size(retval[i].irq_stack, states[i].irq_stack->len);
+ for(j=0; j<states[i].irq_stack->len; j++) {
+ g_array_index(retval[i].irq_stack, gint, j) = g_array_index(states[i].irq_stack, gint, j);
+ }
+
+ retval[i].mode_stack = g_array_new(FALSE, FALSE, sizeof(LttvCPUMode));
g_array_set_size(retval[i].mode_stack, states[i].mode_stack->len);
for(j=0; j<states[i].mode_stack->len; j++) {
g_array_index(retval[i].mode_stack, GQuark, j) = g_array_index(states[i].mode_stack, GQuark, j);
for(i=0; i<n; i++) {
g_array_free(states[i].mode_stack, TRUE);
+ g_array_free(states[i].irq_stack, TRUE);
}
g_free(states);
cpu_push_mode(s->cpu_state, LTTV_CPU_IRQ);
/* update irq status */
- s->cpu_state->last_irq = irq;
+ g_array_append_val(s->cpu_state->irq_stack, irq);
irq_push_mode(&ts->irq_states[irq], LTTV_IRQ_BUSY);
return FALSE;
cpu_pop_mode(s->cpu_state);
/* update irq status */
- if (s->cpu_state->last_irq != -1)
- irq_pop_mode(&ts->irq_states[s->cpu_state->last_irq]);
+ if (s->cpu_state->irq_stack->len > 0) {
+ gint last = g_array_index(s->cpu_state->irq_stack, gint, s->cpu_state->irq_stack->len-1);
+ g_array_remove_index(s->cpu_state->irq_stack, s->cpu_state->irq_stack->len-1);
+ irq_pop_mode(&ts->irq_states[last]);
+ }
return FALSE;
}
if (minfo->name == LTT_EVENT_IRQ_ENTRY) {
irq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
} else if (minfo->name == LTT_EVENT_IRQ_EXIT) {
- irq = ts->cpu_states[cpu].last_irq;
- if (irq == -1)
- return 0;
+ irq = g_array_index(ts->cpu_states[cpu].irq_stack, gint, ts->cpu_states[cpu].irq_stack->len-1);
} else
return 0;
softirq = ltt_event_get_long_unsigned(e, lttv_trace_get_hook_field(th, 0));
} else if (minfo->name == LTT_EVENT_SOFT_IRQ_EXIT) {
softirq = ts->cpu_states[cpu].last_soft_irq;
- if (softirq == -1)
- return 0;
} else
return 0;
|| minfo->name == LTT_EVENT_PAGE_FAULT_EXIT
|| minfo->name == LTT_EVENT_PAGE_FAULT_NOSEM_EXIT) {
trap = ts->cpu_states[cpu].last_trap;
- /* Handle case where a trace starts with a trap exit event */
- if (trap == -1)
- return 0;
} else
return 0;