#
1.135 |
|
03-Mar-2024 |
miod |
Cope with the rare case of an imprecise FPU exception caught when reenabling the FPU as part of the regular processing of another exception.
|
#
1.134 |
|
18-Feb-2024 |
miod |
Fix format strings in TRAPDEBUG code and unbreak 88110_syscall. NFC
|
#
1.133 |
|
23-Jan-2024 |
aoyama |
Delete unused labels which cause error in making kernel.
ok miod@
|
#
1.132 |
|
11-Jan-2024 |
miod |
Since no system call takes more than 6 arguments, and no more than one 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@
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.134 |
|
18-Feb-2024 |
miod |
Fix format strings in TRAPDEBUG code and unbreak 88110_syscall. NFC
|
#
1.133 |
|
23-Jan-2024 |
aoyama |
Delete unused labels which cause error in making kernel.
ok miod@
|
#
1.132 |
|
11-Jan-2024 |
miod |
Since no system call takes more than 6 arguments, and no more than one 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@
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.133 |
|
23-Jan-2024 |
aoyama |
Delete unused labels which cause error in making kernel.
ok miod@
|
#
1.132 |
|
11-Jan-2024 |
miod |
Since no system call takes more than 6 arguments, and no more than one 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@
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.132 |
|
11-Jan-2024 |
miod |
Since no system call takes more than 6 arguments, and no more than one 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@
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.131 |
|
15-Dec-2023 |
miod |
Drop no-longer-applicable comment.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.130 |
|
13-Dec-2023 |
miod |
Fix syscall number bounds check computations.
|
#
1.129 |
|
12-Dec-2023 |
deraadt |
remove support for syscall(2) -- the "indirection system call" because 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
|
Revision tags: OPENBSD_7_4_BASE
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.128 |
|
02-Aug-2023 |
miod |
Revert r1.31 - contrary to what I wrote, scaled versions of ld.d and st.d are 64-bit loads and stores and may hit aligned-to-32-bits-but-not-64-bits addresses.
|
Revision tags: OPENBSD_7_3_BASE
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.127 |
|
11-Feb-2023 |
deraadt |
__syscall() is no longer neccessary since the system calls which needed it are now unpadded ok kettenis guenther
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.126 |
|
31-Jan-2023 |
deraadt |
On systems without xonly mmu hardware-enforcement, we can still mitigate 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
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.125 |
|
16-Jan-2023 |
deraadt |
we spent far too long debugging a weird go library problem (incorrect 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
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.124 |
|
09-Jan-2023 |
miod |
Use PROT_EXEC when servicing instruction faults. ok aoyama@
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.123 |
|
02-Nov-2022 |
guenther |
Clean up more ancient history: since 2015 the libc stubs for 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@
|
Revision tags: OPENBSD_7_2_BASE
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.122 |
|
12-Aug-2022 |
jsg |
use string literal for format string ok miod@
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.121 |
|
02-Aug-2022 |
miod |
Correctly detect xmem operations faulting on missing pages on 88110. 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.
|
Revision tags: OPENBSD_7_1_BASE
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.120 |
|
09-Dec-2021 |
guenther |
We only have one syscall table: inline sysent/SYS_MAXSYSCALL and 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@
|
Revision tags: OPENBSD_6_9_BASE OPENBSD_7_0_BASE
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.119 |
|
30-Oct-2020 |
deraadt |
As done on other architectures, narrow the KERNEL_LOCK only around uvm_fault (and some similar "fault emulation" code which scream danger danger) tested by aoyama
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.118 |
|
21-Oct-2020 |
deraadt |
uvm_grow() now does the vm_maxsaddr check (before locking), so callers don't need to do it ok kettenis
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.117 |
|
08-Oct-2020 |
deraadt |
use access_type as the PROT_* variable for uvm_fault() consistantly ok kettenis
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
Revision tags: OPENBSD_6_8_BASE
|
#
1.116 |
|
27-Sep-2020 |
deraadt |
miod's proposal for traps was also wrong, causing one type of kernel trap to reach the userland check. as suggested, this might fix it.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.115 |
|
25-Sep-2020 |
deraadt |
add uvm_map_isentry check for 88100, and alter the KERNEL_LOCK management. Comments from miod.
|
#
1.114 |
|
24-Sep-2020 |
deraadt |
Only perform uvm_map_inentry() checks for PROC_SP for userland pagefaults. 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
|
#
1.113 |
|
23-Sep-2020 |
deraadt |
|= is not supposed to be spelled +=
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.112 |
|
19-Aug-2020 |
mpi |
Push KERNEL_LOCK/UNLOCK() dance inside trapsignal().
ok kettenis@, visa@
|
Revision tags: OPENBSD_6_7_BASE
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.111 |
|
11-Dec-2019 |
guenther |
%r26 hasn't been used by the threads implementation since 2016, so stop resetting it in child_return() and update the comment in tcb.h to reflect reality
ok miod@ aoyama@
|
Revision tags: OPENBSD_6_6_BASE
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.110 |
|
06-Sep-2019 |
deraadt |
If uvm_map_inentry returns false then a signal has been delivered, and userret() must be called on trap() exit to deliver it, rather than repeating the same cause infinitely. discovered by George Koehler ok kettenis bluhm visa
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.109 |
|
09-Jul-2019 |
deraadt |
I wrote the pc-page-writeable and sp-not-MAP_STACK code to be shared, and then ran into the messaging being poor. Then I fixed the messages. But there are two sub-cases of sp-not-MAP_STACK -- one at syscall time, and another at regular userland trap (on some architectures), and I bungled that messaging. Correct that now, while I look for yet another better way... discovered by millert, who ran an pre-MAP_STACK binary.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
#
1.108 |
|
17-Jun-2019 |
deraadt |
add code to check stack pointer is within MAP_STACK from miod
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.107 |
|
08-Sep-2017 |
deraadt |
If you use sys/param.h, you don't need sys/types.h
|
Revision tags: OPENBSD_6_1_BASE
|
#
1.106 |
|
15-Feb-2017 |
miod |
Make this build (and run) with gcc 4.
|
#
1.105 |
|
19-Oct-2016 |
guenther |
Change process_{domem,auxv_offset}() to take a process instead of a proc. Make process_auxv_offset() take and release a reference of the vmspace like process_domem() does.
ok kettenis@
|
Revision tags: OPENBSD_6_0_BASE
|
#
1.104 |
|
13-Jun-2016 |
dlg |
rename raiseipl to splraise()
another step toward making splraise an MI api.
ok aoyama@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.103 |
|
13-Sep-2015 |
miod |
<sys/systm.h> must be before <sys/syscall_mi.h> now.
|
Revision tags: OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.102 |
|
10-Feb-2015 |
miod |
Enable `va < VM_MIN_ADDRESS' check now that VM_MIN_ADDRESS is nonzero.
|
#
1.101 |
|
16-Nov-2014 |
deraadt |
Replace a plethora of historical protection options with just PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
|
Revision tags: OPENBSD_5_6_BASE
|
#
1.100 |
|
02-Jul-2014 |
miod |
Make sure the kernel lock is held when invoking process_domem(); fixes ptrace operation on MP kernels.
|
#
1.99 |
|
01-Jul-2014 |
miod |
Replace the assembly 88100 FPU imprecise exception code (mostly triggered by denormal results) with C code using softfloat to correctly round the inexact results in the best possible way according to the current rounding mode.
No functional change intended, and this assembly code was surprisingly almost non-buggy, as opposed to the precise exception code replaced a few weeks ago; still an improvement as this replaces 900 lines of arcane assembly with 90 lines of understandable C code.
|
#
1.98 |
|
09-Jun-2014 |
miod |
Replace the unmaintainable assembler code responsible for 88100 precise FPU fault handling with a C wrapper around the softfloat code, as already done for 88110 kernels.
As a bonus, attempting to read or write FPU control registers but fcr62 and fcr63 in userland will now correctly signal an illegal instruction, instead of leaving the destination register unchanged and pretending nothing bad happened.
Be sure to rm m88100_fp.d in your kernel compile directory after updating your tree.
|
#
1.97 |
|
09-Jun-2014 |
miod |
More format string fixes (in 88110 code)
|
#
1.96 |
|
31-May-2014 |
miod |
Address several problems in signal delivery on 88100 processors: - when building the sigcontext, rewind the pipeline for recoverable exceptions, so that sigreturn actually has a chance to cause the interrupted instruction to be run again. - when returning with sigreturn, and the sigcontext contains valid DAE information, the DAE need to be emulated before returning, for the processor will not reissue them. - finally, when the sigframe is allocated on the current process' stack, be careful not to stomp upon addresses referenced by the DAE information, for this would defeat the previous point.
All these changes only affect 88100 processors only. 88110 operation is unchanged.
While there, do not copyout an empty siginfo struct if the signal handler does not expect any.
Hair-pulling evil testcase provided by aoyama@, based upon one of devel/libsigsegv configure tests (which would spin on 88100 and run happily on 88110).
|
#
1.95 |
|
31-May-2014 |
miod |
Introduce m88100_rewind_insn() to rewind the execution pipeline one instruction, rather than gazillions of inline variants. This also makes the situations where we clear specific bits in the fip or nip registers more visible.
No functional change.
|
#
1.94 |
|
26-May-2014 |
miod |
Do not change the state of the carry bit in the psr when returning with ERESTART or EJUSTRETURN, for we're not supposed to. (Actually, setting the carry bit upon syscall failure doesn't make much sense on m88k, since this is not how the syscall stubs check for failure)
|
#
1.93 |
|
11-May-2014 |
guenther |
Move the increment of uvmexp.softs back to the caller of mi_ast(): it needs to be done atomicly on some MP archs and we don't have atomic_add_int() everywhere yet. Also, mi_ast() was meant to be inline.
noted by miod@
|
#
1.92 |
|
10-May-2014 |
guenther |
Factor out the common ast bits into mi_ast()
ok deraadt@
|
#
1.91 |
|
08-May-2014 |
miod |
Format string fixes for m88k; remove -Wno-format from the m88k kernels.
|
#
1.90 |
|
18-Apr-2014 |
guenther |
Have each thread keeps its own (counted!) reference to the process's ucreds to avoid possible use-after-free references when swapping ids in threaded processes. "Do I have the right creds?" checks are always made with the threads creds.
Inspired by FreeBSD and NetBSD "right time" deraadt@
|
#
1.89 |
|
26-Mar-2014 |
guenther |
Move p_emul and p_sigcode from proc to process. Tweak the handling of ktrace EMUL when changing ktracing: only generate one per process (not one per thread) and pass the correct proc pointer down to the VFS layer. Permit generating of NAMI and CSW records inside ktrace(2) itself.
ok deraadt@ millert@
|
Revision tags: OPENBSD_5_5_BASE
|
#
1.88 |
|
05-Sep-2013 |
miod |
Service the 88100 floating-point exceptions through trap(), keeping the existing assembly code for now. Make sure the trapframe images of %fpsr and %fpcr are updated by the assembly handlers (in addition to the real registers which were already updated). When returning into trap(), check these updated value to decide whether a signal ought to be sent to the userland process.
With these changes, computations which ought to cause a signal to be delivered will indeed trigger the signal, even when they are handled by the completion code in the floating point exception handlers.
This fixes the libc/ieeefp/except and lib/fenv regress tests on 88100 systems, finally!
|
#
1.87 |
|
26-Aug-2013 |
miod |
Use %r27 as the thread control block pointer, allowing for __get_tcb() calls in libpthread to be optimized away.
While there, follow DG/UX's example of using more than one register for thread purposes (after all, the ABI reserves four of them), and also use %r26 to store a pointer to the current thread's errno.
Since it is not possible to initialize %r26 at thread creation without intrusive and potentially race-prone changes, have __tfork() reset %r26 to zero, and libpthread's __cerror lazy initialize it. As soon as %r26 is nonzero, it will be used instead of calling __errno().
This means that binaries linked against HEAD libpthread need to run on HEAD kernels, and we are belatedly jumping on the 64-bit time_t bump (since there are no 64-bit time_t m88k snapshots yet).
Joint work with guenther@; "Your love of asm is sick and wrong, and yet beautiful." and ok guenther@
|
#
1.86 |
|
18-Aug-2013 |
miod |
data_access_emulation() may fault. Be sure to clear pcb_onfault before invoking it.
While there, rework the return-to-pcb_onfault logic to avoid falling through the DAE code. This allows us to get rid of the bogus DMT_SKIP flag as well: DAE is only necessary if DMT_VALID is set in DMT0, and DMT0 is reset to zero afterwards.
|
Revision tags: OPENBSD_5_4_BASE
|
#
1.85 |
|
12-Apr-2013 |
miod |
Double-register load and store instructions using an odd-numbered register as the low part trigger an `illegal instruction' trap on the 88110 (and I can't see this documented anywhere in the manual). Of course there is code "in the wild" which uses such constructs (libgmp is one such example).
Extend double_reg_fixup() to take the trap type as an extra argument, and explicitely allow ld.d or st.d instructions with odd-numbered registers at aligned addresses if we are invoked from the `illegal instruction' trap handler, to give this code a chance to run on 88110.
|
Revision tags: OPENBSD_5_3_BASE
|
#
1.84 |
|
07-Jan-2013 |
miod |
Correctly signal SIGSEGV, instead of SIGBUS, for faults caused by access to pages mapped without read (or write) permissions. The existing logic would incorrectly match uvm_fault() returning EACCES with the CMMU fault logic reporting a bus error (which will still cause SIGBUS to be sent).
|
#
1.83 |
|
31-Dec-2012 |
guenther |
Remove emulation errno mapping code from platforms that no longer have non-native emulations.
ok miod@
|
#
1.82 |
|
07-Aug-2012 |
guenther |
<sys/ktrace.h> is now pulled in via <sys/syscall_mi.h>, so drop it from here
|
#
1.81 |
|
07-Aug-2012 |
guenther |
Move the common bits of syscall invocation and return handling into an MI file, <sys/syscall_mi.h>, correcting inconsistencies and the handling when copyin() of arguments fails.
Tested on i386, amd64, sparc64, and alpha (thanks naddy@) Any issues with other platforms will be fixed in tree.
header name from millert@; ok miod@
|
Revision tags: OPENBSD_5_2_BASE
|
#
1.80 |
|
11-Apr-2012 |
mikeb |
The first ktrace record for a newly spawned thread is a return from a fork syscall done by the parent. Use __tfork, not rfork here to match the ktrace records for the parent (CALL __tfork, RET __tfork). ok guenther
|
Revision tags: OPENBSD_5_1_BASE
|
#
1.79 |
|
16-Nov-2011 |
deraadt |
Make userret() MI. On architectures which jammed stuff into it in the past, pull that code out seperately. ok guenther miod
|
Revision tags: OPENBSD_5_0_BASE
|
#
1.78 |
|
11-Jul-2011 |
guenther |
Revert art@'s moving around of the KERNEL_LOCK()/KERNEL_UNLOCK() calls, as it causes hangs in some ports, including libsigsegv's configure script
confirmed by krw@, landry@
|
#
1.77 |
|
07-Jul-2011 |
art |
There is a bunch of places in the kernel entry points where we don't hold the kernel lock, but still need call one function that needs it.
Instead of grabbing the lock all over the place, move the locks into the affected functions: trapsignal, scdebug*, ktrsyscall, ktrsysret, systrace_redirect and ADDUPROF. In the cases we already hold the biglock we'll just recurse.
kettenis@, beck@ ok
|
#
1.76 |
|
06-Jul-2011 |
art |
Clean up after P_BIGLOCK removal. KERNEL_PROC_LOCK -> KERNEL_LOCK KERNEL_PROC_UNLOCK -> KERNEL_UNLOCK
oga@ ok
|
#
1.75 |
|
06-Apr-2011 |
miod |
Fix a typo causing a sanity check in m88110_syscall() to never trigger.
|
#
1.74 |
|
03-Apr-2011 |
guenther |
Move PPWAIT flag from struct proc to process, so that rthreads in a vforked child behave correctly. Have the parent in a vfork() wait on a (different) flag in *its* process instead of the child to prevent a possible use-after-free. When ktracing the child return from a fork, call it rfork if an rthread was created.
ok blambert@
|
Revision tags: OPENBSD_4_9_BASE
|
#
1.73 |
|
31-Dec-2010 |
miod |
Standardize cache handling functions and defines to use wb/wbinv/inv instead of flush/sync/inval. No functional change.
|
#
1.72 |
|
23-Dec-2010 |
miod |
Check for pcb_onfault being set for genuine kernel data faults, copyout() may be invoked with an address under the kernel text and we're about to stop having such pages always mapped.
|
#
1.71 |
|
20-Dec-2010 |
miod |
KNF
|
#
1.70 |
|
20-Dec-2010 |
miod |
mvme88k kernels running on 88110 systems have been prone to panicing for ``invalid opcode'' in kernel mode after being idle for a few hours, since many months already. This panic does not make sense.
Recently, I've been able to gather enough samples and, looking at the instructions surrounding the panic location, I have narrowed a pattern, and I'll conveniently blame these panics upon a (to the best of my knowledge) new genuine 88110 bug.
The exception handler will now recognize this situation and apply a large hammer of workaround - probably not the best workaround that could be devised, but it's short, easy to implement, and works 100% of the time so far. Besides, since the machine is idle, who cares as long as it keeps running?
(the curious reader will find more information in the trap.c comments)
|
Revision tags: OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE
|
#
1.69 |
|
01-Mar-2009 |
miod |
Files forgotten during last commit:
Rework nmi handling to handle ``complex'' NMI faster, and return as fast as possible from the exception, without doing the AST and softintr dance.
This should avoid too much stack usage under load.
ok deraadt@
|
#
1.68 |
|
16-Feb-2009 |
miod |
Since NMI are now handled separately, remove the ``interrupt type'' argument from interrupt() and related function pointers.
|
#
1.67 |
|
13-Feb-2009 |
miod |
Use a different dispatcher for the NMI traps on 88110, these are too different from regular hardware interrupts to be worth handling the same way.
Disable IPI reception while we are handling pending IPIs. And do not reenable them by mistake if we need to send an IPI in return.
This lets GENERIC.MP boot single user on a MVME197DP. There are still many bugs to fix.
|
#
1.66 |
|
08-Feb-2009 |
miod |
Don't bother trying to recover from DSR_WE data faults in kernel mode, pmap makes sure these can't happen.
|
#
1.65 |
|
01-Feb-2009 |
miod |
Remove dma_cachectl() and rename dma_cachectl_pa() to dma_cachectl() now that the old vs(4) code is gone.
|
#
1.64 |
|
27-Nov-2008 |
miod |
On 88100 cpus, make sure userland processes start with SNIP and SFIP valid (i.e. with the valid bit set in them). Found the hard way by Anders Gavare trying his latest gxemul, proves the hardware is more permitting than one would expect it to be...
|
Revision tags: OPENBSD_4_4_BASE
|
#
1.63 |
|
02-May-2008 |
miod |
Grab the biglock unconditionnaly when system calls go through systrace; spotted by drahn
|
#
1.62 |
|
01-Apr-2008 |
miod |
typo
|
Revision tags: OPENBSD_4_3_BASE
|
#
1.61 |
|
25-Dec-2007 |
miod |
Restart the m88110 floating-point trap code from scratch, basing it on the sparc{,64} floating-point emulator, adapted to the 88110 specifics. Handling of these traps is now entirely done in C for convenience.
Although there are a few rounding issues to address, and the XRF is ignored, this allows all the ieee754 regression tests to pass (lib/libc/ieeefp, sys/kern/signal/fpsig, sys/kern/signal/sigfpe).
|
#
1.60 |
|
12-Dec-2007 |
miod |
Make non-88110 kernels (aviion, luna88k) kernels compile again.
|
#
1.59 |
|
08-Dec-2007 |
miod |
Better siginfo fault codes for floating point exceptions on 88110, with more work in progress to handle these exceptions correctly, and document a new undocumented and evil chip bug while there.
|
#
1.58 |
|
04-Dec-2007 |
miod |
In double_reg_fixup(), do not rely on tf_r[0] being zero.
|
#
1.57 |
|
04-Dec-2007 |
miod |
Faster splassert_check()
|
#
1.56 |
|
04-Dec-2007 |
miod |
Fix userland vs system test in errata #16 handling.
|
#
1.55 |
|
02-Dec-2007 |
miod |
Do not take biglock for NOLOCK system calls.
|
#
1.54 |
|
02-Dec-2007 |
miod |
Only check for errata #16 for instruction faults.
|
#
1.53 |
|
25-Nov-2007 |
jmc |
spelling fixes, from Martynas Venckus;
|
#
1.52 |
|
22-Nov-2007 |
miod |
Introduce an inline function to skip an instruction on 88110 and use it whenever necessary, instead of duplicating the same code 10+ times.
|
#
1.51 |
|
22-Nov-2007 |
miod |
A decent workaround for errata #16. I have verified it gets triggered, the hard way.
|
#
1.50 |
|
22-Nov-2007 |
miod |
On 88110, skip the faulting instruction in double_reg_fixup() if it can recover, otherwise we'll fault in a loop.
|
#
1.49 |
|
22-Nov-2007 |
miod |
Quote a few errata to explain why odd things are done in oddly ways on 88110.
|
#
1.48 |
|
21-Nov-2007 |
miod |
Move pmap_set_modify() prototype to a header file
|
#
1.47 |
|
21-Nov-2007 |
miod |
Move external interrupt and ast handling from m881[01]0_trap() to their own functions, which do not need to be processor-specific.
This speeds up the exception return sequence a bit.
|
#
1.46 |
|
20-Nov-2007 |
miod |
A line got lost while hand-editing diffs...
|
#
1.45 |
|
20-Nov-2007 |
miod |
Move 88110 trap-on-write processing from two duplicated sections in trap.c to a single function in pmap.c, which will do the right thing and also perform mod/ref vm_page flags accounting.
|
#
1.44 |
|
20-Nov-2007 |
miod |
Fix MP locking issues when processing data access faults on 88110, similar to the fix already applied to 88100.
|
#
1.43 |
|
17-Nov-2007 |
miod |
Replace many ``unsigned'' variables with ``unsigned int'', ``u_int'' or other appropriate types. No functional change.
|
#
1.42 |
|
14-Nov-2007 |
miod |
When processing a data access fault, keep the kernel lock while invoking data_access_emulation() to complete the interrupted pipeline operations, as data_access_emulation() can fault in turn.
|
#
1.41 |
|
28-Oct-2007 |
miod |
When handling a userland data fault occuring in kernel mode, take the kernel lock with KERNEL_LOCK, not KERNEL_PROC_LOCK. This lets bsd.mp run multiuser on a single-processor board.
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.40 |
|
11-May-2007 |
pedro |
Don't use LK_CANRECURSE for the kernel lock, okay miod@ art@
|
#
1.39 |
|
15-Mar-2007 |
art |
Since p_flag is often manipulated in interrupts and without biglock it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int.
Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way.
kettenis@ ok
|
Revision tags: OPENBSD_4_1_BASE
|
#
1.38 |
|
11-Feb-2007 |
miod |
Rework the cache handling routines again. We now try to operate on the exact address range we've been given, rounded to cache line boundaries, instead of being lazy and operating on pages as soon as the range was large enough.
Also, since the ranges we'll be invoked for are reasonably small, it does not make sense to check for segment sizes - we're always smaller, really.
While there, hardcode the size in cmmu_flush_data_cache(), which becomes cmmu_flush_data_page(), since it was always invoked for complete pages.
|
#
1.37 |
|
24-Dec-2006 |
miod |
Define PROC_PC. Then, since profiling information is being reported in statclock(), do not bother doing this in userret() anymore. As a result, userret() does not need its pc and ticks arguments, simplify.
|
#
1.36 |
|
24-Dec-2006 |
miod |
Check for want_resched when processing AST and nowhere else. But then, when doing so, do not check for signals - userret() will do this.
|
#
1.35 |
|
20-Nov-2006 |
miod |
In syscall handlers, fix copyin() failure path wrt locking macros.
|
#
1.34 |
|
10-Nov-2006 |
miod |
Fetch syscall arguments beyond r9 with copyin() from the userland stack, instead of having the userland syscall code put the first three locations from the stack in r10-r12.
This will speed-up most of the system calls (but mmap) once these fetches are removed, in a few weeks from now.
|
Revision tags: OPENBSD_4_0_BASE
|
#
1.33 |
|
08-May-2006 |
miod |
Replace gazillions of badvaddr() or badwordaddr() calls with badaddr() calls. With a few prototype declarations shuffling, this finally allows <machine/locore.h> to die.
|
#
1.32 |
|
08-May-2006 |
miod |
Clean the internal m88k trap type codes; while there, simplify and factorize the build of the VBR page betweem luna88k and mvme88k.
Tested by aoyama@ and I.
|
#
1.31 |
|
04-May-2006 |
miod |
scaled version of ld.d and st.d is obviously not a 64 bit transaction, so there is no need to take care of it in double_reg_fixup(), as it will never trigger the kind of misalignment faults this function recovers from. Doh!
|
#
1.30 |
|
02-May-2006 |
miod |
Replace db_{disable,enable}_interrupts with expanded version of themselves, having macros for this is not worth doing.
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.29 |
|
11-Dec-2005 |
miod |
Work in progress SMP code; mvme88k boards can spin up secondary CPUs, kernel boots single user. Still a lot of polishing and bugfixing to do.
|
#
1.28 |
|
11-Dec-2005 |
miod |
Replace procfs_domem() with a similar interface, process_domem(), which lives out of procfs and gets a ptrace request PT_{READ,WRITE}_{I,D} as argument; also procfs_checkioperm() becomes process_checkioperm().
From art@ some time ago; ok kettenis@ pedro@
|
#
1.27 |
|
07-Dec-2005 |
miod |
Sprinkle holds and releases of the kernel lock whenever necessary; no functional change for UP kernels.
|
#
1.26 |
|
04-Dec-2005 |
miod |
Simplify ptrace branch handling code.
|
#
1.25 |
|
03-Dec-2005 |
miod |
Switch m88k ports to __HAVE_CPUINFO. Current cpu pointer is held in SR0 on all running processors. Tested aoyama@ and I
|
#
1.24 |
|
01-Dec-2005 |
miod |
Get rid of PMAP_NULL and xx_ENTRY_NULL and simply use NULL when necessary.
|
#
1.23 |
|
28-Nov-2005 |
miod |
Maintain an interrupt depth counter for CLKF_INTR to be correct. Tested aoyama@ martin@ and I.
|
#
1.22 |
|
28-Nov-2005 |
miod |
Switch to per-process AST flags and clean AST-related codepaths; speeds up forks as a bonus. Tested on luna88k and mvme88k by aoyama@ martin@ and I.
|
#
1.21 |
|
15-Sep-2005 |
miod |
In syscall(), do not recompute the struct proc * after the syscall has succeeded. This used to be necessary for fork(), when returning in the child, but we return in the child in child_return() which does TRT.
ok art@
|
#
1.20 |
|
15-Sep-2005 |
miod |
Change child_return() to record a proper ktrace record for vfork child processes.
ok art@ uwe@ (some time ago)
|
Revision tags: OPENBSD_3_8_BASE
|
#
1.19 |
|
06-Aug-2005 |
miod |
In cache_flush(), after testing for curproc != NULL, do not use curproc blindly...
|
#
1.18 |
|
18-May-2005 |
miod |
Rework the single step implementation; mostly delaying breakpoint removal so that single stepping delay slots work. Also added the ability to single step through system calls (which cause an implicit branch if successfull).
works for me, "looks ok" kettenis@
|
#
1.17 |
|
30-Apr-2005 |
miod |
Remove m88k_psr_type and function with utterly long names to control the psr, and use get_psr() / set_psr() or simple macros that expand into them everywhere. No functional change.
|
#
1.16 |
|
27-Apr-2005 |
miod |
Allow userland to cause the data cache to be flushed for any arbitrary address range in the current process, using trap #451.
This is necessary for proper gcc trampolines operation, and, later, ld.so...
|
Revision tags: OPENBSD_3_7_BASE
|
#
1.15 |
|
06-Dec-2004 |
miod |
Use uvm_grow() to account for stack growth, rather than home-grown code or nothing. Inspired by a similar recent change in NetBSD.
|
#
1.14 |
|
09-Nov-2004 |
miod |
Kill guarded_access() - the way we map OBIO, there is no need for special treatement of interrupt vectors variables, a simple read will do.
While there, speed up the interrupt handlers a bit: - remove old debug code or only compile it if option DEBUG. - use short circuits for setipl() if we know interrupts are disabled at this point: there is no need playing with the psr in these cases.
|
#
1.13 |
|
08-Nov-2004 |
miod |
Kill struct md_p, which was really only necessary for mvme88k; on luna88k it disappears completely, while mvme88k keeps 3 global variables, one of them scheduled to disappear very soon.
|
#
1.12 |
|
01-Oct-2004 |
miod |
guarded_access() is really only used by the MVME188 interrupt engine, so do not provide it on luna88k. Makes trap() slightly faster on non-MVME188 kernels.
|
#
1.11 |
|
30-Sep-2004 |
miod |
Introduce sparc-like CPU_ISFOO macros, to short-circuit evaluations when compiling for one flavour only.
This makes code slightly smaller on all m88k-based platforms (my roughly 1KB), and saves more than meets the eye on luna88k, which is m88100-based.
|
Revision tags: OPENBSD_3_6_BASE
|
#
1.10 |
|
26-Jul-2004 |
miod |
Shrink more code if option PTRACE is not set; also use ss_put_value() in trap handlers instead of inlining it by hand.
|
#
1.9 |
|
22-Jul-2004 |
miod |
Reset pcb_onfault to NULL before invoking uvm_fault().
|
#
1.8 |
|
22-Jun-2004 |
miod |
Do not use db_printf() without a godd reason; while there, shrinken some messages.
|
#
1.7 |
|
22-Jun-2004 |
miod |
After 88110 exception processing, do not reset the in-frame [di][lp]ar values, they won't be put back to registers anyways...
|
#
1.6 |
|
22-Jun-2004 |
miod |
On 88110, simplify enip processing: - always fetch its value when building trapframe, it is faster than only doing it after checking if it will have a meaningful value. - don't bother setting it to a safe value if we change exip to a non-delayslot address.
|
Revision tags: SMP_SYNC_A SMP_SYNC_B
|
#
1.5 |
|
07-Jun-2004 |
miod |
Allow userland to issue ld.d or st.d with a long, but not long long aligned address, by recovering from the misaligned address exception.
|
#
1.4 |
|
03-Jun-2004 |
miod |
branches: 1.4.2; Signal bus errors when a write back operation fails on 88110.
|
#
1.3 |
|
03-Jun-2004 |
miod |
Be sure to preserve r3 for syscalls which return 32-bit values.
|
#
1.2 |
|
07-May-2004 |
miod |
Make #endif /* foo */ comments really match the #if condition.
|
#
1.1 |
|
29-Apr-2004 |
miod |
Continue factorizing m88k common code, this time files in <arch>/<arch> which were copied verbatim from mvme88k to luna88k.
This requires backing out syntactic sugar in mvme88k kernel configuration files which would deduct the required processor types from the board models, as the common code only depends upon the M88100 and M88110 defines.
|