sync code with last improvements from OpenBSD

This commit is contained in:
purplerain 2023-08-23 09:28:13 +00:00
parent c346c8d04f
commit ab8d6e7bca
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
7 changed files with 44 additions and 42 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: clock.c,v 1.65 2023/07/25 18:16:20 cheloha Exp $ */
/* $OpenBSD: clock.c,v 1.66 2023/08/22 17:13:22 cheloha Exp $ */
/* $NetBSD: clock.c,v 1.39 1996/05/12 23:11:54 mycroft Exp $ */
/*-
@ -430,10 +430,16 @@ i8254_initclocks(void)
clockintr_cpu_init(NULL);
/* When using i8254 for clock, we also use the rtc for profclock */
(void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK,
/*
* When using i8254 for clock, we also use the rtc for profclock.
*
* These IRQs are not MP-safe, but it is harmless to lie about it
* because we cannot reach this point unless we are only booting
* a single CPU.
*/
(void)isa_intr_establish(NULL, 0, IST_PULSE, IPL_CLOCK | IPL_MPSAFE,
clockintr, 0, "clock");
(void)isa_intr_establish(NULL, 8, IST_PULSE, IPL_STATCLOCK,
(void)isa_intr_establish(NULL, 8, IST_PULSE, IPL_STATCLOCK | IPL_MPSAFE,
rtcintr, 0, "rtc");
rtcstart(); /* start the mc146818 clock */

View file

@ -1,4 +1,4 @@
/* $OpenBSD: kern_clock.c,v 1.113 2023/08/12 13:19:28 miod Exp $ */
/* $OpenBSD: kern_clock.c,v 1.114 2023/08/22 13:46:20 jsg Exp $ */
/* $NetBSD: kern_clock.c,v 1.34 1996/06/09 04:51:03 briggs Exp $ */
/*-
@ -111,13 +111,9 @@ initclocks(void)
void
hardclock(struct clockframe *frame)
{
#if defined(MULTIPROCESSOR) || defined(__hppa__) /* XXX */
struct cpu_info *ci = curcpu();
#endif
#if NDT > 0
DT_ENTER(profile, NULL);
if (CPU_IS_PRIMARY(ci))
if (CPU_IS_PRIMARY(curcpu()))
DT_ENTER(interval, NULL);
#endif
@ -125,7 +121,7 @@ hardclock(struct clockframe *frame)
* If we are not the primary CPU, we're not allowed to do
* any more work.
*/
if (CPU_IS_PRIMARY(ci) == 0)
if (CPU_IS_PRIMARY(curcpu()) == 0)
return;
tc_ticktock();