Replaced common u64.h functions with operators.

Change-Id: I71b7b4879209eeff89ce5748d67102afebf871dc
This commit is contained in:
Gerard
2013-11-21 12:09:58 +01:00
committed by Lionel Sambuc
parent cd36dd7703
commit 78da142dab
37 changed files with 141 additions and 273 deletions

View File

@@ -127,12 +127,12 @@ int register_local_timer_handler(const irq_handler_t handler)
u64_t ms_2_cpu_time(unsigned ms)
{
return mul64u(tsc_per_ms[cpuid], ms);
return (u64_t)(tsc_per_ms[cpuid]) * ms;
}
unsigned cpu_time_2_ms(u64_t cpu_time)
{
return div64u(cpu_time, tsc_per_ms[cpuid]);
return (unsigned long)(cpu_time / tsc_per_ms[cpuid]);
}
short cpu_load(void)

View File

@@ -515,14 +515,14 @@ static void apic_calibrate_clocks(unsigned cpu)
rm_irq_handler(&spurious_irq);
lapic_delta = lapic_tctr0 - lapic_tctr1;
tsc_delta = sub64(tsc1, tsc0);
tsc_delta = tsc1 - tsc0;
lapic_bus_freq[cpuid] = system_hz * lapic_delta / (PROBE_TICKS - 1);
BOOT_VERBOSE(printf("APIC bus freq %u MHz\n",
lapic_bus_freq[cpuid] / 1000000));
cpu_freq = mul64(div64u64(tsc_delta, PROBE_TICKS - 1), make64(system_hz, 0));
cpu_freq = (tsc_delta / (PROBE_TICKS - 1)) * make64(system_hz, 0);
cpu_set_freq(cpuid, cpu_freq);
cpu_info[cpuid].freq = div64u(cpu_freq, 1000000);
cpu_info[cpuid].freq = (unsigned long)(cpu_freq / 1000000);
BOOT_VERBOSE(cpu_print_freq(cpuid));
}

View File

@@ -33,7 +33,7 @@ static void intel_arch_watchdog_init(const unsigned cpu)
*/
cpuf = cpu_get_freq(cpu);
while (ex64hi(cpuf) || ex64lo(cpuf) > 0x7fffffffU)
cpuf = div64u64(cpuf, 2);
cpuf /= 2;
cpuf = make64(-ex64lo(cpuf), ex64hi(cpuf));
watchdog->resetval = watchdog->watchdog_resetval = cpuf;
@@ -159,7 +159,7 @@ static int intel_arch_watchdog_profile_init(const unsigned freq)
/* FIXME works only if all CPUs have the same freq */
cpuf = cpu_get_freq(cpuid);
cpuf = div64u64(cpuf, freq);
cpuf /= freq;
/*
* if freq is too low and the cpu freq too high we may get in a range of
@@ -223,7 +223,7 @@ static int amd_watchdog_profile_init(const unsigned freq)
/* FIXME works only if all CPUs have the same freq */
cpuf = cpu_get_freq(cpuid);
cpuf = -div64u64(cpuf, freq);
cpuf = -cpuf / freq;
watchdog->profile_resetval = cpuf;

View File

@@ -500,7 +500,7 @@ void cpu_print_freq(unsigned cpu)
u64_t freq;
freq = cpu_get_freq(cpu);
printf("CPU %d freq %lu MHz\n", cpu, div64u(freq, 1000000));
printf("CPU %d freq %lu MHz\n", cpu, (unsigned long)(freq / 1000000));
}
int is_fpu(void)