summaryrefslogtreecommitdiff
path: root/sys/arch/m88k
AgeCommit message (Collapse)Author
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
2022-12-06_C_LABEL() and _ASM_LABEL() are no longer useful in the "everythingPhilip Guenther
is ELF" world. Eliminate use of them in m88k code. ok aoyama@
2022-12-06m88k, luna88k: switch to clockintrScott Soule Cheloha
- Initialize tick_nsec during cpu_initclocks() We have no control over the interrupt clock on luna88k, so this switch is trivial. Bringup help and testing from aoyama@ and miod@. Link: https://marc.info/?l=openbsd-tech&m=166776371203450&w=2 ok aoyama@ mlarkin@
2022-11-02Clean up more ancient history: since 2015 the libc stubs forPhilip Guenther
fork/vfork/__tfork haven't cared about the second return register. So, stop setting retval[1] in kern_fork.c and stop setting the second return register in the MD child_return() routines. With the above, we have no multi-register return values on LP64, so stop touching that register in the trapframe on those archs. testing miod@ and aoyama@ 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-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-09-04spellingJonathan Gray
2022-08-29use ansi volatile keyword, not __volatileJonathan Gray
ok miod@ guenther@
2022-08-12use string literal for format stringJonathan Gray
ok miod@
2022-08-02Correctly detect xmem operations faulting on missing pages on 88110.Miod Vallat
These must be handled as write faults rather than read faults, since xmem performs both a read and a write, and unlike on 88100, we don't have an easy bit to check. This solves libcrypto spinning on its locks on 88110.
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-02-21Convert KVA allocation to km_alloc(9).Mark Kettenis
ok mpi@
2022-02-01When a struct ipovly needs to be computed and checksummed in in4_cksum(),Miod Vallat
do not bother operating on its first 8 bytes, which will always be zero. ok visa@
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-09-24Fix two bugs in m88k fcmp{,u} emulation.Kenji Aoyama
- Use of goto will skip zeroing of 88110-specific comparison bits (bitn 12-17) in some cases. (Move their zeroing closer to the point of their computation.) - Computing of the "in interval" bits should not be performed when the S2 operand is negative. Spotted by Tetsuya Isaki (nono project), suggested diff and description from Miod Vallat. Tested on the real hardware by Isaki and me.
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-05-04Fix 2nd and 3rd arguments' cast in atomic_cas_ptr().Kenji Aoyama
This fixes compile errors (actually warnings) on m88k in sys/net/pf.c revision 1.1116 changes. Diff from Miod Vallat, tested on GENERIC and GENERIC.MP by me.
2021-03-11spellingJonathan Gray
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-30As done on other architectures, narrow the KERNEL_LOCK only aroundTheo de Raadt
uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
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-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-27miod's proposal for traps was also wrong, causing one type of kernelTheo de Raadt
trap to reach the userland check. as suggested, this might fix it.
2020-09-25miod notes T_USER needs to be a bit, it was not.Theo de Raadt
The "snowflake" uniqueness of every MD trap impl often gets in the way of precisely & correctly interfacing to MI layers. The differences also complicates review, and causes new MI requirements to be incorrectly written. Thus an architecture will fall behind, not just because they are slow or rare, but because the code behaviour becomes increasingly incorrect. It is sad.
2020-09-25add uvm_map_isentry check for 88100, and alter the KERNEL_LOCKTheo de Raadt
management. Comments from miod.
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-23|= is not supposed to be spelled +=Theo de Raadt
2020-08-19Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().Martin Pieuchot
ok kettenis@, visa@
2020-07-08do not need these versions of timetc.hTheo de Raadt
2020-07-06Add support for timeconting in userland.Paul Irofti
This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
2020-06-30Remove obsolete <machine/stdarg.h> header. Nowadays the varargVisa Hankala
functionality is provided by <sys/stdarg.h> using compiler builtins. Tested in a ports bulk build on amd64 by naddy@ OK naddy@ mpi@
2020-06-23Fix format strings (%p --> %lx) in debug code.Kenji Aoyama
ok dlg@
2020-05-31introduce "cpu_rnd_messybits" for use instead of nanotime in dev/rnd.c.David Gwynne
rnd.c uses nanotime to get access to some bits that change quickly between events that it can mix into the entropy pool. it doesn't use nanotime to get a monotonically increasing set or ordered and accurate timestamps, it just wants something with bits that change. there's been discussions for years about letting rnd use a clock that's super fast to read, but not necessarily accurate, but it wasn't until recently that i figured out it wasn't interested in time at all, so things like keeping a fast clock coherent between cpu cores or correct according to ntp is unecessary. this means we can just let rnd read the cycle counters on cpus and things will be fine. cpus with cycle counters that vary in their speed and arent kept consistent between cores may even be desirable in this context. so this is the first step in converting rnd.c to reading cycle counter. it copies the nanotime backend to each arch, and they can replace it with something MD as a second step later on. djm@ suggested rnd_messybytes, but we landed on cpu_rnd_messybits. thanks to visa for his eyes. ok deraadt@ visa@ deraadt@ says he will help handle any MD fallout that occurs.
2020-05-27Retire <machine/varargs.h>.Visa Hankala
Nothing uses the header anymore. OK deraadt@ mpi@
2020-05-26Rewrite m88k mutex code as a slight variation of the MI mutex code.Kenji Aoyama
This will make mutex spinning time visible in top(1), and also might improve stability. The major change in this is that the old assembly code acquires mutexes with an atomic exchange operation, but releases them with a regular store, but the new code always uses atomic exchange operations. The mutex.h changes to the macros conform to <sys/mutex.h> to be able to reset the system while in ddb. Suggested from Miod Vallat, tested by me. The stability in heavy load is greatly improved in my case.
2019-12-11%r26 hasn't been used by the threads implementation since 2016, so stopPhilip Guenther
resetting it in child_return() and update the comment in tcb.h to reflect reality ok miod@ aoyama@
2019-11-10TRUE/FALSE conversions missed in previous.Martin Pieuchot