summaryrefslogtreecommitdiff
path: root/sys/arch/sh
AgeCommit message (Collapse)Author
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-05-30spellingJonathan Gray
ok jmc@ guenther@ tb@
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-10spellingJonathan Gray
2023-03-12sh, landisk: set HZ=64 againScott Soule Cheloha
The addition of HZ to sys/kernel.h in v1.26 overrides the default definition of HZ in sh/clock.c, changing landisk from HZ=64 to HZ=100. Explicitly set HZ=64 in the GENERIC and RAMDISK config(8) files to can change it from 100 back to 64. Not sure if this is the best thing, but it does fix the problem. Problem confirmed by, and fix tested by, miod@. ok miod@
2023-03-08Delete obsolete /* ARGSUSED */ lint comments.Philip Guenther
ok miod@ millert@
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-09Handle possible PROT_EXEC fault if PROT_READ fails; needed to cope withMiod Vallat
kern_exec.c 1.241
2023-01-06Remove copystr(9), unless used internally by copy{in,out}str.Miod Vallat
2023-01-01With the introduction of the PMAP_PREFER_{ALIGN,OFFSET} macros a long time ago,Miod Vallat
there are actually no more uses of the PMAP_PREFER() macro left in the kernel. Remove that macro but keep PMAP_PREFER as a simple #define for it to let uvm knows the PMAP_PREFER_{ALIGN,OFFSET} macros are available. ok mpi@
2022-12-08_C_LABEL() and _ASM_LABEL() are no longer useful in the "everythingPhilip Guenther
is ELF" world. Eliminate use of them in landisk code. ok deraadt@
2022-12-06sh, landisk: switch to clockintrScott Soule Cheloha
Patch review and testing by miod@. Link: https://marc.info/?l=openbsd-tech&m=166776412003652&w=2 ok mlarkin@, probably ok miod@
2022-10-30Simplfity setregs() by passing it the ps_strings and switchingPhilip Guenther
sys_execve() to return EJUSTRETURN. setregs() is the MD routine used by sys_execve() to set up the thread's trapframe and PCB such that, on 'return' to userspace, it has the register values defined by the ABI and otherwise zero. It had to set the syscall retval[] values previously because the normal syscall return path overwrites a couple registers with the retval[] values. By instead returning EJUSTRETURN that and some complexity with program-counter handling on m88k and sparc64 goes away. Also, give setregs() add a 'struct ps_strings *arginfo' argument so powerpc, powerpc64, and sh can directly get argc/argv/envp values for registers instead of copyin()ing the one in userspace. Improvements from miod@ and millert@ Testing assistance miod@, kettenis@, and aoyama@ ok miod@ kettenis@
2022-09-12Store mod/ref flags using md pg_flags values rather than a specific field inMiod Vallat
vm_page_md, which allows this struct to shrink a bit.
2022-09-10Remove pmap_collect() when a no-op, define __HAVE_PMAP_COLLECT otherwise.Miod Vallat
Use that define to shunt uvm_swapout_threads(), which is a noop when pmap_collect() does nothing. ok mpi@
2022-08-30Remove long unused WARN_REFERENCES macro; idea guenther@, ok jsg@ jca@Miod Vallat
2022-07-02remove machine/lock.h where unusedJonathan Gray
Previously for __cpu_simple_lock parts. Now only hppa and m88k use __cpu_simple_lock (and hppa uses atomic.h for it). ok miod@ visa@
2022-07-02Remove unused device poll functions.Visa Hankala
Also remove unneeded includes of <sys/poll.h> and <sys/select.h>. Some addenda from jsg@. OK miod@ mpi@
2022-05-27Convert KVA allocation to km_alloc(9).Mark Kettenis
ok deraadt@, mpi@
2022-04-14ddb: constify command tablesChristian Weisgerber
ok jca@
2022-04-12ddb: simplify machine command handlingChristian Weisgerber
Define a consistently named db_machine_command_table[] across all archs that implement the MD "machine" command, and hook this into the main command table instead of patching it at runtime. ok mpi@ jca@
2022-04-06constify struct cfattachChristian Weisgerber
2022-02-21entris -> entriesJonathan Gray
2022-02-21initiailze -> initializeJonathan Gray
2022-02-21instructinos -> instructionsJonathan Gray
2022-01-02priviledged -> privilegedJonathan Gray
2021-12-23Roll the syscalls that have an off_t argument to remove the explicit padding.Philip Guenther
Switch libc and ld.so to the generic stubs for these calls. WARNING: reboot to updated kernel before installing libc or ld.so! Time for a story... When gcc (back in 1.x days) first implemented long long, it didn't (always) pass 64bit arguments in 'aligned' registers/stack slots, with the result that argument offsets didn't match structure offsets. This affected the nine system calls that pass off_t arguments: ftruncate lseek mmap mquery pread preadv pwrite pwritev truncate To avoid having to do custom ASM wrappers for those, BSD put an explicit pad argument in so that the off_t argument would always start on a even slot and thus be naturally aligned. Thus those odd wrappers in lib/libc/sys/ that use __syscall() and pass an extra '0' argument. The ABIs for different CPUs eventually settled how things should be passed on each and gcc 2.x followed them. The only arch now where it helps is landisk, which needs to skip the last argument register if it would be the first half of a 64bit argument. So: add new syscalls without the pad argument and on landisk do that skipping directly in the syscall handler in the kernel. Keep compat support for the existing syscalls long enough for the transition. ok deraadt@
2021-12-09We only have one syscall table: inline sysent/SYS_MAXSYSCALL andPhilip Guenther
SYS_syscall as the nosys() function into the MD syscall entry routines and the SYSCALL_DEBUG support. Adjust alpha's syscall check to match the other archs. Also, make sysent const to get it into .rodata. With that, 'struct emul' is unused: delete it and all its references ok millert@
2021-10-06Change sendsig() interface so that the MD code does not need to accessClaudio Jeker
data from struct process anymore. This changes how siginfo and onstack are accessed and make sendsig() more MP friendly. With and OK semarie@ OK kettenis@
2021-08-30Remove typedef of db_addr_t; mpi converted the users of it to vaddr_t alreadyJasper Lievisse Adriaanse
back in 2019. ok mpi@
2021-07-06Introduce CPU_IS_RUNNING() and us it in scheduler-related code to preventMark Kettenis
waiting on CPUs that didn't spin up. This will allow us to spin down CPUs in the future to save power as well. ok mpi@
2021-06-02kernel: introduce per-CPU panic(9) message bufferscheloha
Add a 512-byte buffer (ci_panicbuf) to each cpu_info struct on each platform for use by panic(9). The first panic on a given CPU writes its message to this buffer. Subsequent panics on a given CPU print the panic message to the console but do not modify the buffer. This aids debugging in two cases: - If 2+ CPUs panic simultaneously there is no risk of garbled messages in the panic buffer. - If a CPU panics and then the operator causes a second panic while using ddb(4), the operator can still recall the first failure on a particular CPU. Misc. changes to support this bigger change: - Set panicstr atomically to identify the first CPU to reach panic(). - Tweak db_show_panic_cmd() to print all panic messages across all CPUs. Prefix the first panic with an asterisk ('*'). - Prefer db_printf() to printf() during a panic if we have it. Apparently it disturbs less global state. - On amd64, tweak fault() to write the local panic buffer. This needs more work. Prompted by bluhm@ and deraadt@. Mostly written by deraadt@. Discussed with bluhm@, deraadt@ and kettenis@. Borne from a discussion on tech@ about making panic(9) more MP-safe: https://marc.info/?l=openbsd-tech&m=162086462316143&w=2 ok kettenis@, visa@, bluhm@, deraadt@
2021-05-16b_saveaddr has a type of void * use NULL not 0Jonathan Gray
2021-03-11spellingJonathan Gray
2006-10-06Preliminary bits for SuperH-based ports, based on NetBSD/sh3 codebase withMiod Vallat
minor changes.
2021-02-23remove some unused includesJonathan Gray
2006-10-06Preliminary bits for SuperH-based ports, based on NetBSD/sh3 codebase withMiod Vallat
minor changes.
2021-01-01Remove useless redundant call of ttyopen().jan
Also remove dead DIALOUT macro. ok mpi@
2020-11-08In case of failure, call sigexit() from trapsignal instead of sensig().Martin Pieuchot
Simplify MD code and reduce the amount of recursion into the signal code which helps when dealing with locks. ok cheloha@, deraadt@
2020-10-21The condition around uvm_grow() can be simplified, as the error resultTheo de Raadt
adjustment is effectively a dead store ok kettenis
2020-10-21uvm_grow() now does the vm_maxsaddr check (before locking), so callers don'tTheo de Raadt
need to do it ok kettenis
2020-10-20alpha, loongson, sh, sparc64: recompute tick, tick_nsec when hz(9) is resetcheloha
Normally we set hz(9) at compile-time in sys/conf/param.c to the value of HZ. HZ is one of the fundamental compilation options(4). However, sometimes we need to reset hz(9) at runtime. Whenever we reset hz(9) we need to recompute tick and tick_nsec. Otherwise a variety of "time stuff" in the kernel will not work correctly. For example, most timeouts will expire "too slow" or "too fast". There are a bunch of other places we use tick and tick_nsec that will exhibit similar problems. Test-compiled by deraadt@.
2020-10-08use access_type as the PROT_* variable for uvm_fault() consistantlyTheo de Raadt
ok kettenis
2020-10-07Include <sys/systm.h> directly instead of relying on hidden UVM includes.Martin Pieuchot
The header is being pulled via uvm_extern.h -> uvm_map.h
2020-09-25landisk has legacy global variable want_resched, rather than post-MPTheo de Raadt
ci->ci_want_resched. convert to the modern style.
2020-09-24Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults.Theo de Raadt
This should be sufficient for identifying pivoted ROP. Doing so for other traps is at best opportunistic for finding a straight-running ROP chain, but the added (and rare) sleeping point has proven to be dangerous. Discussed at length with kettenis and mortimer. ok mortimer kettenis mpi
2020-09-22On sh architecture, general_exception() handles regular traps as well asTheo de Raadt
syscalls. The MI syscall code will perform uvm_map_inentry() against PROC_STACK. So avoid doing it twice.
2020-09-14Ensure the SH_(TRA)) register is read before a potential sleep in trap()Theo de Raadt
for same reasons as as recent bug diagnosed in amd64, i386, hppa, powerpc64...