Thanks for the quick reply,
It would be preferable if this was in two patches - one to check for cpuid and one to check for the tsc.
OK I can do that.
Can't the existing timer_counter in the BDA be used instead?
I got some earlier iteration which used the *_timer value but it did not work for some reason (most likely I forgot all the magic for real mode)
I think using extra variables will remove the complexity with day rollover and custom changes to the timer variable either from option ROM or from BIOS API.
BTW, what's the impact of writing to the PORT_PIT_MODE? Will it corrupt the old value? (Not an issue for the patch, as obviously something is better than nothing for your board.)
I think none, it is a readback command of the 8254 chip which allows to read back the latch and configuration. The mode of timer or timer itself should not be affected. I think this may need to be protected if some interrupt jump in. I had in previous patch the IRQ_save/restore stuff but you told me that irqs are enabled only during yields. Maybe it would be safer to have the irq_save / restore here too?
- SET_GLOBAL(no_tsc, 0);
FYI - SET_GLOBAL(x,y) is the same as writing "x=y". The macro is only available in 32bit mode, so it's not really any different.
Ok but lets keep it orthogonal.
- // Emulate the CPUID if 386/486
This is too early (can't assign global variables here on QEmu). I suggest you put in maininit() after the malloc_fixup() call.
It is too late there. There is some CPUID instruction executed from xen_probe(). Yes I xen is enabled for coreboot for some reason... The whole point of the cpuid emulation is to have it globally available and not making it dependent on particular configuration. Not sure how to solve it here.
These already exist in types.h.
OK I remove them,
Thanks for the review.