Skip to contentSkip to conversation

Sparc32 - sched_clock missing

DISCUSSION Georg Chini 2 participants 3 messages Oct 4, 2003 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore
#0 lore raw

Hello out there,

tried to build Kernel 2.6.0-test6-bk4 on my sparc32 machine and found that the function sched_clock is missing in time.c. Can anyone tell me what I have to put there? Please CC to me.

Thanks in advance
Georg Chini

#1 lore raw
Quoted 9 lines · Georg Chini

Hello out there,

tried to build Kernel 2.6.0-test6-bk4 on my sparc32 machine and found that the function sched_clock is missing in time.c. Can anyone tell me what I have to put there? Please CC to me.

This is the minimal version to get you going.

A better implementation would use a higer-resolution counter, if the hardware has such a thing.

arch/sparc/kernel/time.c renamed from arch/sparc/kernel/time.c~sparc32-sched_clock +9 -0
diff -puN arch/sparc/kernel/time.c~sparc32-sched_clock arch/sparc/kernel/time.c
@@ -617,3 +617,12 @@ static int set_rtc_mmss(unsigned long no
 		return -1;
 	}
 }
+
+/*
+ * Returns nanoseconds
+  */
+
+unsigned long long sched_clock(void)
+{
+	return (unsigned long long)jiffies * (1000000000 / HZ);
+}

_

#2 lore raw

Thanks a lot, I can compile and boot the kernel now. But still the keyboard does not work...

Regards
Georg Chini

Quoted 36 lines · Andrew Morton
Quoted 8 lines · Georg Chini

Hello out there,

tried to build Kernel 2.6.0-test6-bk4 on my sparc32 machine and found that the function sched_clock is missing in time.c. Can anyone tell me what I have to put there? Please CC to me.

This is the minimal version to get you going.

A better implementation would use a higer-resolution counter, if the hardware has such a thing.

diff -puN arch/sparc/kernel/time.c~sparc32-sched_clock arch/sparc/kernel/time.c

arch/sparc/kernel/time.c renamed from arch/sparc/kernel/time.c~sparc32-sched_clock +9 -0
@@ -617,3 +617,12 @@ static int set_rtc_mmss(unsigned long no
 		return -1;
 	}
 }
+
+/*
+ * Returns nanoseconds
+  */
+
+unsigned long long sched_clock(void)
+{
+	return (unsigned long long)jiffies * (1000000000 / HZ);
+}

_