I've hacked up a version of libpayload which doesn't depend on TSC to get payloads running on my platform. It seems an unnecessary limitation of the library that it needs this, and also that it checks CPU speed before the payload main() is called, meaning you can't avoid it in your payload implementation without recompilation of the lib.
I was just wondering if there would be any interest in a patch to remove the dependency. It doesn't look too tricky, however the ndelay function is hard to implement without TSC. Is this function really needed? Which payloads are likely to suffer if it's inaccurate? mdelay can be pretty accurate using the PIT, udelay could perhaps be based on port 80 reads instead.
A scheme could be put in place to detect the TSC instruction and fall back on alternative routines if it doesn't exist, however as far as I can see this will involve creation of an illegal instruction trap, setting up the IDT etc, which might not be desirable. Removing TSC altogether may be more appropriate, especially if the ndelay() routine isn't really needed (my CPU is 150MHz).
Or we could just add a compilation option, however since libpayload is a library I don't think that's ideal.
Any thoughts?
kind regards, Biff.