summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
AgeCommit message (Collapse)Author
4 daysCast atomic_load_int(9) to signed int when loading `securelevel'.Vitaliy Makkoveev
The return value of atomic_load_int(9) is unsigned so needs a cast, otherwise securelevel=-1 gets misrepresented. From Paul Fertser.
2024-11-07Constify strings in symbol-related ddb interfaces, and make the iteratorMiod Vallat
callback interface a bit simpler. ok beck@ claudio@ mpi@
2024-10-28Unlock KERN_ALLOWKMEM. The `allowkmem' is atomically accessed integer.Vitaliy Makkoveev
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
2024-10-23Rename `ci_intrdepth' to `ci_idepth'.Martin Pieuchot
ok jsg@, aoyama@
2024-10-22put opening { on same line as struct nameJonathan Gray
ok claudio@
2024-10-20add comma to fix offsets of trap type stringsJonathan Gray
ok miod@
2024-10-14remove unused struct sigstate; ok miod@Jonathan Gray
2024-08-08Make user ci_flags is declared volatile.Miod Vallat
2024-07-14Add elf_aux_info(3)Jeremie Courreges-Anglas
Designed to let userland peek at AT_HWCAP and AT_HWCAP2 using an already existing interface coming from FreeBSD. Headers bits were snatched from there. Input & ok kettenis@ libc bump and sets sync will follow soon
2024-06-26return type on a dedicated line when declaring functionsJonathan Gray
ok mglocker@
2024-06-23If an ioctl(2) request isn't implemented we should return ENOTTY.Mark Kettenis
ok deraadt@
2024-06-20Enable uvm percpu caches on luna88k.Kenji Aoyama
It survives 3.5 days "make build" and makes about 1.5% faster on 3 CPU machine:-) ok miod@ phessler@ dlg@
2024-06-09Add a compiler barrier where missing in CPU_BUSY_CYCLE() implemsJeremie Courreges-Anglas
Having differences between architectures is asking for problems. And adding a barrier here just makes sense in most cases. This is also what cpu_relax() provides in Linux land. ok kettenis@ claudio@
2024-06-05Pass cpu_fork() function to the new process through caller-saved registersMiod Vallat
in the pcb rather than on the stack. This makes the code simpler and faster and gets rid of one short timeframe where the stack pointer is only aligned to an 8 byte boundary instead of a 16 byte boundary.
2024-05-28cpu_emergency_disable() was only used by mvme88k and can be removed now.Claudio Jeker
This removes one of the SCHED_LOCK usages in arch. OK miod@
2024-05-22remove prototypes with no matching function; ok miod@Jonathan Gray
2024-05-21remove switch_exit() prototypes, replaced by sched_exit()Jonathan Gray
2024-05-16Stop treating IPL_NONE mutexes special in MULTIPROCESSOR kernels. WhileMark Kettenis
in theory these are safe to use in code that runs under the kernel lock they are nasty trips when converting code to run without the kernel lock. ok mpi@, claudio@
2024-03-31Stop referring to dead-since-30-years gatherstats() in comments.Miod Vallat
2024-03-08Make sure copyoutstr() invoked with a length of zero returns ENAMETOOLONG.Miod Vallat
This bug has been present in that file since the very beginning, more than 28 years ago.
2024-03-03Cope with the rare case of an imprecise FPU exception caught whenMiod Vallat
reenabling the FPU as part of the regular processing of another exception.
2024-03-03Workaround a 88100 errata where a FPU imprecise exception may be raisedMiod Vallat
for floating-point-to-int conversions by mistake (these instructions are not supposed to raise this exception).
2024-02-25clockintr: rename "struct clockintr_queue" to "struct clockqueue"Scott Soule Cheloha
The code has outgrown the original name for this struct. Both the external and internal APIs have used the "clockqueue" namespace for some time when operating on it, and that name is eyeball-consistent with "clockintr" and "clockrequest", so "clockqueue" it is.
2024-02-23ddb(4): db_read_bytes/db_write_bytes: change dst/src parameter to void*Scott Soule Cheloha
Almost all db_read_bytes() callers cast the destination buffer argument to char*, which suggests the API's prototype is incompatible with how the API is actually used. Change db_read_bytes() and db_write_bytes() to take a void* as the destination/source buffer parameter so callers don't need to cast the argument. With input from bluhm@. Bugs caught by Clemens Gossnitzer (ASCII approximation of name). Thread: https://marc.info/?l=openbsd-tech&m=170740813021636&w=2 ok bluhm@
2024-02-18Fix format strings in TRAPDEBUG code and unbreak 88110_syscall. NFCMiod Vallat
2024-02-14Remove never ever used cpu_exec() macro, apparently already obsolete by theMiod Vallat
time this file was introduced close to 30 years ago.
2024-02-14Make sure pmap_unmap_direct flushes dirty cache lines.Miod Vallat
2024-02-07Use tlb_flush() rather than complete invalidation in pmap_set_modify().Miod Vallat
This has been missed in 1.68.
2024-01-24clockintr: switch from callee- to caller-allocated clockintr structsScott Soule Cheloha
Currently, clockintr_establish() calls malloc(9) to allocate a clockintr struct on behalf of the caller. mpi@ says this behavior is incompatible with dt(4). In particular, calling malloc(9) during the initialization of a PCB outside of dt_pcb_alloc() is (a) awkward and (b) may conflict with future changes/optimizations to PCB allocation. To side-step the problem, this patch changes the clockintr subsystem to use caller-allocated clockintr structs instead of callee-allocated structs. clockintr_establish() is named after softintr_establish(), which uses malloc(9) internally to create softintr objects. The clockintr subsystem is no longer using malloc(9), so the "establish" naming is no longer apt. To avoid confusion, this patch also renames "clockintr_establish" to "clockintr_bind". Requested by mpi@. Tweaked by mpi@. Thread: https://marc.info/?l=openbsd-tech&m=170597126103504&w=2 ok claudio@ mlarkin@ mpi@
2024-01-23Delete unused labels which cause error in making kernel.Kenji Aoyama
ok miod@
2024-01-11Since no system call takes more than 6 arguments, and no more than oneMiod Vallat
off_t argument, there is no need to process more than 6 arguments on 64-bit platforms and 8 on 32-bit platforms. Make the syscall argument gathering code simpler by removing never-used code to fetch more arguments from the stack, and local argument arrays when pointing to the trap frame does the job. ok guenther@ jsing@
2023-12-15Drop no-longer-applicable comment.Miod Vallat
2023-12-14NKMEMPAGES_MAX_DEFAULT is no longer used. Remove it from param.h.Claudio Jeker
OK miod@
2023-12-13Fix syscall number bounds check computations.Miod Vallat
2023-12-12remove support for syscall(2) -- the "indirection system call" becauseTheo de Raadt
it is a dangerous alternative entry point for all system calls, and thus incompatible with the precision system call entry point scheme we are heading towards. This has been a 3-year mission: First perl needed a code-generated wrapper to fake syscall(2) as a giant switch table, then all the ports were cleaned with relatively minor fixes, except for "go". "go" required two fixes -- 1) a framework issue with old library versions, and 2) like perl, a fake syscall(2) wrapper to handle ioctl(2) and sysctl(2) because "syscall(SYS_ioctl" occurs all over the place in the "go" ecosystem because the "go developers" are plan9-loving unix-hating folk who tried to build an ecosystem without allowing "ioctl". ok kettenis, jsing, afresh1, sthen
2023-12-12The sigtramp was calling sigreturn(2), and upon failure exit(2), whichTheo de Raadt
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?
2023-12-11Implement per-CPU caching for the page table page (vp) pool and the PTEMark Kettenis
descriptor (pted) pool in the arm64 pmap implementation. This significantly reduces the side-effects of lock contention on the kernel map lock that is (incorrectly) translated into excessive page daemon wakeups. This is not a perfect solution but it does lead to significant speedups on machines with many CPU cores. This requires adding a new pmap_init_percpu() function that gets called at the point where kernel is ready to set up the per-CPU pool caches. Dummy implementations of this function are added for all non-arm64 architectures. Some other architectures can probably benefit from providing an actual implementation that sets up per-CPU caches for pmap pools as well. ok phessler@, claudio@, miod@, patrick@
2023-12-10Add a new label "sigcodecall" inside every sigtramp definition, directlyTheo de Raadt
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
2023-10-24Normally context switches happen in mi_switch() but there are 3 casesClaudio Jeker
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@
2023-08-02Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.dMiod Vallat
are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
2023-07-25statclock: move profil(2), GPROF code to profclock(), gmonclock()Scott Soule Cheloha
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@.
2023-07-02all platforms, kernel: remove __HAVE_CLOCKINTR symbolScott Soule Cheloha
Every platform made the clockintr switch at least six months ago. The __HAVE_CLOCKINTR symbol is now redundant. Remove it. Prompted by claudio@. Link: https://marc.info/?l=openbsd-tech&m=168826181015032&w=2 "makes sense" mlarkin@
2023-04-13pmap_copy() has never, ever, been implemented in any of the platforms OpenBSDMiod Vallat
ever ran on, and it's unlikely to ever be implemented, so remove it. ok jsg@
2023-04-11fix double words in commentsJonathan Gray
feedback and ok jmc@ miod, ok millert@
2023-02-12m88k also needs to define PMAP_CHECK_COPYIN as 1.Kenji Aoyama
"this makes sense" miod@
2023-02-11__syscall() is no longer neccessary since the system calls which neededTheo de Raadt
it are now unpadded ok kettenis guenther
2023-01-31On systems without xonly mmu hardware-enforcement, we can still mitigateTheo de Raadt
against classic BROP with a range-checking wrapper in front of copyin() and copyinstr() which ensures the userland source doesn't overlap the main program text, ld.so text, signal tramp text (it's mapping is hard to distinguish so it comes along for the ride), or libc.so text. ld.so tells the kernel libc.so text range with msyscall(2). The range checking for 2-4 elements is done without locking (because all 4 ranges are immutable!) and is inexpensive. write(sock, &open, 400) now fails with EFAULT. No programs have been discovered which require reading their own text segments with a system call. On a machine without mmu enforcement, a test program reports the following: userland kernel ld.so readable unreadable mmap xz unreadable unreadable mmap x readable readable mmap nrx readable readable mmap nwx readable readable mmap xnwx readable readable main readable unreadable libc unmapped? readable unreadable libc mapped readable unreadable ok kettenis, additional help from miod
2023-01-16we spent far too long debugging a weird go library problem (incorrectTheo de Raadt
arguments to mmap) because it was using syscall(2) and that callpath is invisible in ktrace. make it visible, it will now show "(via syscall)" and such. ok guenther
2023-01-09Use PROT_EXEC when servicing instruction faults.Miod Vallat
ok aoyama@
2023-01-06Remove copystr(9), unless used internally by copy{in,out}str.Miod Vallat