Age | Commit message (Collapse) | Author |
|
The return value of atomic_load_int(9) is unsigned so needs a cast,
otherwise securelevel=-1 gets misrepresented.
From Paul Fertser.
|
|
devices (ofnet, etc) for the VI board in the before-macppc days which nobody
remembers, and has never been needed for anything on macs.
|
|
file modified to use OpenFirmware routines:
``Make the freelist best fit code a tiny bit smarter to not use a block if
half or more would be wasted. Causes more effective re-use of blocks.''
Bump bootloader version in the unlikely case this misbehaves on some machines.
|
|
which got limited to at most two tries 26 years ago for the 2.3 release,
but the documentation was never updated to match this change. Do it now.
Reported by Nir Lichtman on tech@, file forgotten in previous commit
|
|
My PowerBook G4 had some old code in its instruction cache when it
jumped into OpenBSD's kernel. If I got unlucky with a reordered
kernel, it would trip over the old code, trap into ddb, and fail to
boot. The same kernel would boot fine on a different macppc with
different firmware. This problem is rare; I got unlucky only twice,
on 2022-04-26 and 2024-07-01.
This fix tells ofwboot to invalidate the instruction cache for the
loaded kernel before jumping there.
Adapted from NetBSD src/sys/arch/macppc/stand/ofwboot/boot.c
|
|
Also use atomic_load_int(9) to load `securelevel'. sysctl_securelevel()
is mp-safe, but will be under kernel lock until all existing
`securelevel' loading became mp-safe too.
ok mpi
|
|
Now curcpu()->ci_idepth == 0 would work on macppc as it does on
powerpc64 and other archs, by checking that we aren't in an interrupt.
This also makes macppc's splassert_check() less different.
locore.S checks for the 1st interrupt when it increments ci_idepth.
Using -1 for no interrupts had saved an instruction, as "addic." was
short for "addi; cmpwi". Using 0, it now does "cmpwi; addi" to
compare ci_idepth with 0 before incrementing it.
ok mpi@
|
|
ok claudio@
|
|
ok gkoehler@, jsg@
|
|
|
|
|
|
Input and ok jmc@, jsg@
|
|
ok gkoehler
|
|
|
|
Input from miod@ and gkoehler@, tests & ok gkoehler@
|
|
The spice^Wkernel must flow^Wbuild.
|
|
|
|
ok deraadt@
|
|
|
|
|
|
|
|
ok deraadt@, mlarkin@
|
|
|
|
ok bluhm@ jca@
|
|
no functional change, found by smatch warnings
ok miod@ bluhm@
|
|
This code affects iMac G3s with a slot-loading CD drive (from late
1999 to 2001, after the older tray-loading iMac G3s, and before the
iMac G4s). Detect such iMacs by their model string (PowerMac2,1 or
PowerMac2,2 or PowerMac4,1), and configure their headphones and
internal speakers in a different way. These iMacs have 3 places to
connect headphones (2 on front, 1 on right side). They also have no
audio connection to the CD drive, so turn off the noisy CD input.
From evan (dot) jss (at) protonmail (dot) ch; I edited the code to get
the model string.
|
|
|
|
linked (for performance). in this case, it grew larger than the
maximum text segment size; increase that size.
|
|
mcount.c, in the same way that -fno-ret-protector is set (because
the default ret-protector is an "always" generator). This change
ensures there is never a stack protector prologue/epilogue in the
functions in that file, no matter what stack protector selection
algorithm is in play.
ok kettenis guenther
|
|
|
|
doesn't make sense anymore. It is better to just issue an illegal
instruction.
ok kettenis, with some misgivings about inconsistant approaches between
architectures.
In the future we could change sigreturn(2) to never return an exit code,
but always just terminate the process. We stopped this system call
from being callable ages ago with msyscall(2), and there is no stub for
it in libc.. maybe that's the next step to take?
|
|
in front of the syscall instruction. This is used to calculate the start
of the syscall for SYS_sigreturn and pinned system calls.
ok kettenis
|
|
From jon (at) elytron (dot) openbsd (dot) amsterdam
ok gkoehler@
|
|
where a switch happens outside. Cleanup these code paths and make the
machine independent.
- when a process forks (fork, tfork, kthread), the new proc needs to
somehow be scheduled for the first time. This is done by proc_trampoline.
Since proc_trampoline is machine dependent assembler code change
the MP specific proc_trampoline_mp() to proc_trampoline_mi() and make
sure it is now always called.
- cpu_hatch: when booting APs the code needs to jump to the first proc
running on that CPU. This should be the idle thread for that CPU.
- sched_exit: when a proc exits it needs to switch away from itself and
then instruct the reaper to clean up the rest. This is done by switching
to the idle loop.
Since the last two cases require a context switch to the idle proc factor
out the common code to sched_toidle() and use it in those places.
Tested by many on all archs.
OK miod@ mpi@ cheloha@
|
|
|
|
All the state initialization once done in clockintr_init() has been
moved to other parts of the kernel. It's a dead function. Remove it.
Likewise, the clockintr_flags variable no longer sports any meaningful
flags. Remove it. This frees up the CL_* flag namespace, which might
be useful to the clockintr frontend if we ever need to add behavior
flags to any of those functions.
|
|
In order to separate the statclock from the clock interrupt subsystem
we need to move all statclock state out into the broader kernel.
Start by replacing the CL_RNDSTAT flag with a new global variable,
"statclock_is_randomized", in kern_clock.c. Update all clockintr_init()
callers to set the boolean instead of passing the flag.
Thread: https://marc.info/?l=openbsd-tech&m=169428749720476&w=2
|
|
no longer needed with zlib 1.3
ok tb@
|
|
To give the primary CPU an opportunity to perform clock interrupt
preparation in a machine-independent manner we need to separate the
"initialization" parts of cpu_initclocks() from the "start the clock
interrupt" parts. Currently, cpu_initclocks() does everything all at
once, so there is no space for this MI setup.
Many platforms have more-or-less already done this separation by
implementing a separate routine named "cpu_startclock()". This patch
promotes cpu_startclock() from de facto standard to mandatory API.
- Prototype cpu_startclock() in sys/systm.h alongside cpu_initclocks().
The separation of responsibility between the two routines is a bit
fuzzy but the basic guidelines are as follows:
+ cpu_initclocks() must initialize hz, stathz, and profhz, and call
clockintr_init().
+ cpu_startclock() must call clockintr_cpu_init() and start the clock
interrupt cycle on the calling CPU.
These guidelines will shift in the future, but that's the way things
stand as of *this* commit.
- In initclocks(): first call cpu_initclocks(), then do MI setup, and
last call cpu_startclock().
- On platforms where cpu_startclock() already exists: don't call
cpu_startclock() from cpu_initclocks() anymore.
- On platforms where cpu_startclock() doesn't yet exist: implement it.
Usually this is as simple as dividing cpu_initclocks() in two.
Tested on amd64 (i8254, lapic), arm64, i386 (i8254, lapic), macppc,
mips64/octeon, and sparc64. Tested on arm/armv7 (agtimer(4)) by
phessler@ and jmatthew@. Tested on m88k/luna88k by aoyama@. Tested
on powerpc64 by gkoehler@ and mlarkin@. Tested on riscv64 by
jmatthew@.
Thread: https://marc.info/?l=openbsd-tech&m=169195251322149&w=2
|
|
from jon at elytron dot openbsd dot amsterdam
feedback and ok miod@
|
|
This patch isolates profil(2) and GPROF from statclock(). Currently,
statclock() implements both profil(2) and GPROF through a complex
mechanism involving both platform code (setstatclockrate) and the
scheduler (pscnt, psdiv, and psratio). We have a machine-independent
interface to the clock interrupt hardware now, so we no longer need to
do it this way.
- Move profil(2)-specific code from statclock() to a new clock
interrupt callback, profclock(), in subr_prof.c. Each
schedstate_percpu has its own profclock handle. The profclock is
enabled/disabled for a given CPU when it is needed by the running
thread during mi_switch() and sched_exit().
- Move GPROF-specific code from statclock() to a new clock interrupt
callback, gmonclock(), in subr_prof.c. Where available, each cpu_info
has its own gmonclock handle . The gmonclock is enabled/disabled for
a given CPU via sysctl(2) in prof_state_toggle().
- Both profclock() and gmonclock() have a fixed period, profclock_period,
that is initialized during initclocks().
- Export clockintr_advance(), clockintr_cancel(), clockintr_establish(),
and clockintr_stagger() via <sys/clockintr.h>. They have external
callers now.
- Delete pscnt, psdiv, psratio. From schedstate_percpu, also delete
spc_pscnt and spc_psdiv. The statclock frequency is not dynamic
anymore so these variables are now useless.
- Delete code/state related to the dynamic statclock frequency from
kern_clockintr.c. The statclock frequency can still be pseudo-random,
so move the contents of clockintr_statvar_init() into clockintr_init().
With input from miod@, deraadt@, and claudio@. Early revisions
cleaned up by claudio. Early revisions tested by claudio@. Tested by
cheloha@ on amd64, arm64, macppc, octeon, and sparc64 (sun4v).
Compile- and boot- tested on i386 by mlarkin@. riscv64 compilation
bugs found by mlarkin@. Tested on riscv64 by jca@. Tested on
powerpc64 by gkoehler@.
|
|
a safe thread. Support is limited to amd64, i386 and arm64 at the
moment, macppc gets only an empty stub.
feedback from kettenis@
tested by bluhm@
ok phessler@
|
|
Move the clockqueue_init() call out of clockintr_cpu_init() and up
just before the sched_init_cpu() call for a given CPU.
This will allow sched_init_cpu() to allocate clockintr handles for a
given CPU's scheduler in a later patch.
Link: https://marc.info/?l=openbsd-tech&m=168661507607622&w=2
ok kettenis@, claudio@
|
|
few users to pci_mapreg_info().
ok jsg@
|
|
feedback and ok jmc@ miod, ok millert@
|
|
ok miod@ millert@
|
|
|
|
only compile tty-related code (stty command, tty variable) on platforms
where it makes sense for the boot loader to control it, rather than the
PROM/firmware/whatever.
|
|
We don't need to disable interrupts around ppc_mtdec(). The
underlying operation, mtdec, is atomic.
Link: https://marc.info/?l=openbsd-tech&m=167494864124073&w=2
ok gkoehler@
|
|
The timecounting code has had stubs for pulse-per-second (PPS) polling
since it was imported in 2004. At this point it seems unlikely that
anyone is going to finish adding PPS support, so let's remove the stubs:
- Delete the dead tc_poll_pps() call from tc_windup().
- Remove all tc_poll_pps symbols from the kernel.
Link: https://marc.info/?l=openbsd-tech&m=167519035723210&w=2
ok miod@
|