I do not understand more than 5% of the code I am messing up, so this hack is probably broken...
Then I tested a bit more the code with different testcases... and I found a new bug when writing a reload value smaller than the current counter (the counter will then read as 0). It is due to this piece of code in armv7m_systick.c : systick_read() :
/* The interrupt in triggered when the timer reaches zero.
However the counter is not reloaded until the next clock
tick. This is a hack to return zero during the first tick. */
if (val > s->reload) {
val = 0;
}
Well this is not really a prb for me with normal code, and it looks like under control, but I can open another bug if needed.
I finally implemented a workaround to correct the problem:
in cpus.c : qemu_start_ warp_timer( ), in the "if (deadline > 0) { ... }" part, I added:
CPUState *cpu;
CPU_FOREACH( cpu) {
atomic_ mb_set( &cpu->exit_ request, 1);
}
I do not understand more than 5% of the code I am messing up, so this hack is probably broken...
Then I tested a bit more the code with different testcases... and I found a new bug when writing a reload value smaller than the current counter (the counter will then read as 0). It is due to this piece of code in armv7m_systick.c : systick_read() :
/* The interrupt in triggered when the timer reaches zero.
However the counter is not reloaded until the next clock
tick. This is a hack to return zero during the first tick. */
if (val > s->reload) {
val = 0;
}
Well this is not really a prb for me with normal code, and it looks like under control, but I can open another bug if needed.