+ diff -u linux/examples/measurement/irq_jitter.c.ORIG linux/examples/measurement/irq_jitter.c --- linux/examples/measurement/irq_jitter.c.ORIG Sun Feb 29 19:31:34 2004 +++ linux/examples/measurement/irq_jitter.c Fri Jun 4 00:38:28 2004 @@ -46,8 +46,22 @@ #if defined(CONFIG_X86) && defined(CONFIG_X86_TSC) #include /* rdtscll - ia32 specific */ #define hwtimer(x) rdtscll(x) +#elif defined(CONFIG_PPC) +#include +static inline void ppc_timebase(long long *x) +{ + unsigned long tbl, tbu1, tbu2; + do + { + tbu1 = get_tbu(); + tbl = get_tbl(); + tbu2 = get_tbu(); + } while (tbu1 != tbu2); + *x = (long long)tbl + ((long long)tbu1 << 32); +} +#define hwtimer(x) ppc_timebase(&(x)) #else - #error "Only X86 supported for now" + #error "Only X86 and PPC supported for now" #endif @@ -88,7 +102,8 @@ IPIPE_DYNAMIC_MASK); } - scaller = cpu_khz/1000; + /* might be incorrect due to rounding effects */ + scaller = (unsigned long)sys_info.cpufreq / 1000000; period = (1000/HZ)*1000; printk("scaller set to %ld\n",(unsigned long) scaller); printk("period set to %ld\n",(long) period); + diff -u linux/examples/measurement/Makefile.ORIG linux/examples/measurement/Makefile --- linux/examples/measurement/Makefile.ORIG Sun Feb 29 19:31:34 2004 +++ linux/examples/measurement/Makefile Fri Jun 4 00:00:56 2004 @@ -3,21 +3,35 @@ # Environment" feature in the general setup when configuring this # kernel. +ifndef LINUXSRC LINUXSRC = /usr/src/linux -ARCH = i686 +endif + +DEBUG = -g -ggdb +DEFINES = -D__KERNEL__ -DMODULE $(DEBUG) -DEFINES = -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB +include $(LINUXSRC)/.config + +ifdef CONFIG_PPC +CFLAGS = $(DEFINES) -O2 -Wall -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer \ + -fsigned-char -msoft-float -pipe -ffixed-r2 \ + -Wno-uninitialized -mmultiple -mstring \ + -I$(LINUXSRC)/include -I$(LINUXSRC)/arch/ppc +else +ARCH = i686 CFLAGS = $(DEFINES) -I$(LINUXSRC)/include -Wall -Wstrict-prototypes \ -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing \ -fno-common -mpreferred-stack-boundary=2 -march=${ARCH} +endif all: irq_jitter.o virtual_irq_jitter.o virtual_irq_jitter.o: virtual_irq_jitter.c - gcc $(CFLAGS) -o $@ -c $< + $(CROSS_COMPILE)gcc $(CFLAGS) -o $@ -c $< irq_jitter.o: irq_jitter.c - gcc $(CFLAGS) -o $@ -c $< + $(CROSS_COMPILE)gcc $(CFLAGS) -o $@ -c $< clean: rm -f *.o + diff -u linux/examples/measurement/virtual_irq_jitter.c.ORIG linux/examples/measurement/virtual_irq_jitter.c --- linux/examples/measurement/virtual_irq_jitter.c.ORIG Fri Jun 4 00:24:42 2004 +++ linux/examples/measurement/virtual_irq_jitter.c Fri Jun 4 01:04:49 2004 @@ -134,9 +134,13 @@ unsigned int a1, a2; unsigned long long res; +#ifdef __LITTLE_ENDIAN a1 = ((unsigned int*)&a)[0]; a2 = ((unsigned int*)&a)[1]; - +#else + a1 = ((unsigned int*)&a)[1]; + a2 = ((unsigned int*)&a)[0]; +#endif res = a1/b0 + (unsigned long long)a2 * (unsigned long long)(0xffffffff/b0) + a2 / b0 + + diff -u linux/examples/simple/Makefile.ORIG linux/examples/simple/Makefile --- linux/examples/simple/Makefile.ORIG Sun Feb 29 19:31:33 2004 +++ linux/examples/simple/Makefile Fri Jun 4 00:01:24 2004 @@ -3,23 +3,38 @@ # Environment" feature in the general setup when configuring this # kernel. +ifndef LINUXSRC LINUXSRC = /usr/src/linux +endif -DEFINES = -D__KERNEL__ -DMODULE -DEXPORT_SYMTAB -CFLAGS = $(DEFINES) -I$(LINUXSRC)/include -Wall -Wstrict-prototypes -Wno-trigraphs \ - -O2 -fomit-frame-pointer -fno-strict-aliasing -fno-common \ - -mpreferred-stack-boundary=2 -march=i686 +DEBUG = -g -ggdb +DEFINES = -D__KERNEL__ -DMODULE $(DEBUG) + +include $(LINUXSRC)/.config + +ifdef CONFIG_PPC +CFLAGS = $(DEFINES) -O2 -Wall -Wstrict-prototypes -Wno-trigraphs \ + -fno-strict-aliasing -fno-common -fomit-frame-pointer \ + -fsigned-char -msoft-float -pipe -ffixed-r2 \ + -Wno-uninitialized -mmultiple -mstring \ + -I$(LINUXSRC)/include -I$(LINUXSRC)/arch/ppc +else +ARCH = i686 +CFLAGS = $(DEFINES) -I$(LINUXSRC)/include -Wall -Wstrict-prototypes \ + -Wno-trigraphs -O2 -fomit-frame-pointer -fno-strict-aliasing \ + -fno-common -mpreferred-stack-boundary=2 -march=${ARCH} +endif all: adtest.o interdomain_irq.o interdomain_mutex.o adtest.o: adtest.c - gcc $(CFLAGS) -o $@ -c $< + $(CROSS_COMPILE)gcc $(CFLAGS) -o $@ -c $< interdomain_irq.o: interdomain_irq.c - gcc $(CFLAGS) -o $@ -c $< + $(CROSS_COMPILE)gcc $(CFLAGS) -o $@ -c $< interdomain_mutex.o: interdomain_mutex.c - gcc $(CFLAGS) -o $@ -c $< + $(CROSS_COMPILE)gcc $(CFLAGS) -o $@ -c $< clean: rm -f *.o