I am compiling XEN Kernel 2.6.29.2 on Ubuntu 9.04 32bit
GCC is 4.3.3 and some issues with new compiler’s optimization.
This is on-going memo… I have compiled the kernel but it seems not compatible with Ubuntu 9.04.
So, I switched the xen kernel version supported by debian team.
References:
(1) http://www.infohit.net/blog/post/running-xen-on-ubuntu-intrepid-and-jaunty.html
(2) http://linux.derkeiler.com/Mailing-Lists/Kernel/2008-05/msg01854.html
(3) http://www.comptechdoc.org/os/linux/usersguide/linux_ugkernel.html
(4) http://bderzhavets.wordpress.com/2009/01/03/setup-xen-330-ubuntu-intrepid-server-dom0-via-build-xen-kernel-based-on-httpxenbitsxensourcecomextlinux-2627-xenhg/
Errors:
(1) undefined reference to `__udivdi3′
arch/x86/kernel/built-in.o: In function `timer_interrupt’:
/usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c:465: undefined reference to `__udivdi3′
make: *** [.tmp_vmlinux1] Error 1
root@ubunzzo:/usr/src/linux-2.6.29.2-xen# vi /usr/src/linux-2.6.29.2-xen/arch/x86/kernel/time_32-xen.c
My attempt after reading reference (2) was successful, I inserted the asm(“”:”+r”(delta)) to the timer_interrupt function at the while scope at line number around 500.
/* System-wide jiffy work. */
if (delta >= NS_PER_TICK) {
do_div(delta, NS_PER_TICK);
processed_system_time += delta * NS_PER_TICK;
while (delta > HZ) {
asm("":"+r"(delta));
do_timer(HZ);
delta -= HZ;
}
do_timer(delta);
}
* This works because this asm fools gcc compiler not to use optimization.
I guess do_timer internally uses do_div macro?
I found the same kind of fix in linux kernel here
The AT&T assembly format still looks confusing…