summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
Commit message (Collapse)AuthorAgeFilesLines
* Change the behavior of isa_nmi to log an error message instead ofps2000-08-061-9/+31
| | | | | | | | | panicing and return a status so that we can decide whether to drop into DDB or panic. If the status from isa_nmi is true, panic the kernel based on machdep.panic_on_nmi, otherwise if DDB is enabled, drop to DDB based on machdep.ddb_on_nmi. Reviewed by: peter, phk
* Handle write page faults (both write only or read-modify-write) as MI vmluoqi2000-07-311-3/+3
| | | | | write-only faults. This would allow write-only mmapped regions to function correctly.
* Change the way NMI's are handled. Before, if DDB was enabled andps2000-07-141-12/+14
| | | | | | | | | | | | | a NMI occured, you could type continue in DDB and the kernel would not attempt to detect what type of NMI was recieved. Now we check for the type of NMI first and then go to DDB if it is enabled. This will solve the problem with having DDB enabled and getting an NMI due to some possibly bad error and being able to continue the operation of the kernel when you really want to panic and know what happened. Submitted by: jhb
* Fix my own style bugs (use of spaces instead of tabs for indentation).bsd2000-07-011-18/+18
| | | | This is a style-only change.
* Commit major SMP cleanups and move the BGL (big giant lock) in thedillon2000-03-281-38/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syscall path inward. A system call may select whether it needs the MP lock or not (the default being that it does need it). A great deal of conditional SMP code for various deadended experiments has been removed. 'cil' and 'cml' have been removed entirely, and the locking around the cpl has been removed. The conditional separately-locked fast-interrupt code has been removed, meaning that interrupts must hold the CPL now (but they pretty much had to anyway). Another reason for doing this is that the original separate-lock for interrupts just doesn't apply to the interrupt thread mechanism being contemplated. Modifications to the cpl may now ONLY occur while holding the MP lock. For example, if an otherwise MP safe syscall needs to mess with the cpl, it must hold the MP lock for the duration and must (as usual) save/restore the cpl in a nested fashion. This is precursor work for the real meat coming later: avoiding having to hold the MP lock for common syscalls and I/O's and interrupt threads. It is expected that the spl mechanisms and new interrupt threading mechanisms will be able to run in tandem, allowing a slow piecemeal transition to occur. This patch should result in a moderate performance improvement due to the considerable amount of code that has been removed from the critical path, especially the simplification of the spl*() calls. The real performance gains will come later. Approved by: jkh Reviewed by: current, bde (exception.s) Some work taken from: luoqi's patch
* I applied the wrong patch set. Back out anything associateddufault2000-03-021-1/+0
| | | | | | | | | with the known bogus currtpriority. This undoes the previous changes to sys/i386/i386/trap.c, sys/alpha/alpha/trap.c, sys/sys/systm.h Now we have the patch set approved by bde. Approved by: bde
* Patches that eliminate extra context switches in FIFO case.dufault2000-03-021-0/+1
| | | | | | | Fixes p1003_1b regression test in the simple case of no RR and FIFO processes competing. Reviewed by: jkh, bde
* Don't forget to reset the hardware debug registers when a process thatbsd2000-02-201-1/+19
| | | | | | | | | | was using them exits. Don't allow a user process to cause the kernel to take a TRCTRAP on a user space address. Reviewed by: jlemon, sef Approved by: jkh
* Add a new mechanism, cndbctl(), to tell the console driver thatyokota2000-01-111-4/+2
| | | | | | | | | | | | | | | | | | | | | ddb is entered. Don't refer to `in_Debugger' to see if we are in the debugger. (The variable used to be static in Debugger() and wasn't updated if ddb is entered via traps and panic anyway.) - Don't refer to `in_Debugger'. - Add `db_active' to i386/i386/db_interface.d (as in alpha/alpha/db_interface.c). - Remove cnpollc() stub from ddb/db_input.c. - Add the dbctl function to syscons, pcvt, and sio. (The function for pcvt and sio is noop at the moment.) Jointly developed by: bde and me (The final version was tweaked by me and not reviewed by bde. Thus, if there is any error in this commit, that is entirely of mine, not his.) Some changes were obtained from: NetBSD
* Passing "0" or "FALSE" as the fourth argument to vm_fault is wrong. Italc1999-11-091-4/+6
| | | | should be "VM_FAULT_NORMAL".
* useracc() the prequel:phk1999-10-291-1/+0
| | | | | | | | | | | Merge the contents (less some trivial bordering the silly comments) of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts the #defines for the vm_inherit_t and vm_prot_t types next to their typedefs. This paves the road for the commit to follow shortly: change useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE} as argument.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* On FPU exceptions, pass a useful error code (one of the FPE_...cracauer1999-07-251-4/+4
| | | | | | | | | | | | | | | | macros) to the signal handler, for old-style BSD signal handlers as the second (int) argument, for SA_SIGINFO signal handlers as siginfo_t->si_code. This is source-compatible with Solaris, except that we have no <siginfo.h> (which isn't even mentioned in POSIX 1003.1b). An rather complete example program is at http://www3.cons.org/cracauer/freebsd-signal.c This will be added to the regression tests in src/. This commit also adds code to disable the (hardware) FPU from userconfig, so that you can use a software FP emulator on a machine that has hardware floating point. See LINT.
* Changed the global `idt' from an array to a pointer so that npx.cbde1999-06-181-3/+2
| | | | | | | | | | | | | automatically hacks on the active copy of the IDT if f00f_hack() has changed it. This also allows simplifications in setidt(). This fixes breakage of FP exception handling by rev.1.55 of sys/kernel.h. FP exceptions were sent to npx.c's probe handlers because npx.c "restored" the old handlers to the wrong copy of the IDT. The SYSINIT for f00f_hack() was purposely run quite late to avoid problems like this, but it is bogusly associated with the SYSINIT for proc0 so it was moved with the latter. Problem reported and fix tested by: Martin Cracauer <cracauer@cons.org>
* Unifdef VM86.jlemon1999-06-011-10/+1
| | | | Reviewed by: silence on on -current
* Add sufficient braces to keep egcs happy about potentially ambiguouspeter1999-05-061-2/+3
| | | | if/else nesting.
* Enable vmspace sharing on SMP. Major changes are,luoqi1999-04-281-8/+3
| | | | | | | | | | | | | | | | | - %fs register is added to trapframe and saved/restored upon kernel entry/exit. - Per-cpu pages are no longer mapped at the same virtual address. - Each cpu now has a separate gdt selector table. A new segment selector is added to point to per-cpu pages, per-cpu global variables are now accessed through this new selector (%fs). The selectors in gdt table are rearranged for cache line optimization. - fask_vfork is now on as default for both UP and SMP. - Some aio code cleanup. Reviewed by: Alan Cox <alc@cs.rice.edu> John Dyson <dyson@iquest.net> Julian Elischer <julian@whistel.com> Bruce Evans <bde@zeta.org.au> David Greenman <dg@root.com>
* unifdef -DVM_STACK - it's been on for a while for x86 and was checkedpeter1999-04-191-31/+1
| | | | and appeared to be working for the Alpha some time ago.
* Make TIMER_FREQ a normal, undocumented option. Raise confusion tophk1999-03-091-1/+2
| | | | | | | a higher level with example in LINT. Clarify comment about PPS_SYNC. Ignore for now that it doesn't work in FLL mode, it will in a few days.
* Add (but don't activate) code for a special VM option to makejulian1999-01-061-1/+37
| | | | | | | | | | | | | downward growing stacks more general. Add (but don't activate) code to use the new stack facility when running threads, (specifically the linux threads support). This allows people to use both linux compiled linuxthreads, and also the native FreeBSD linux-threads port. The code is conditional on VM_STACK. Not using this will produce the old heavily tested system. Submitted by: Richard Seaman <dick@tar.com>
* Improved DDB_UNATTENDED behaviour. From the submitter:msmith1998-12-281-2/+6
| | | | | | | | | | | | | | | | | | | | | | There's something that's been bugging me for a while, so I decided to fix it. FreeBSD now will DTRT WRT DDB and DDB_UNATTENDED (!debugger_on_panic), at least in my opinion. The behavior change is such that: 1. Nothing changes when debugger_on_panic != 0. 2. When DDB_UNATTENDED (!debugger_on_panic), if a panic occurs, the machine will reboot. Also, if a trap occurs, the machine will panic and reboot, unlike how it broke to DDB before. HOWEVER, a trap inside DDB will not cause a panic, allowing full use of DDB without having to worry about the machine being stuck at a DDB prompt if something goes wrong during the day. Patches for this behavior follow my signature, and it would be a boon to anyone (like me) who uses DDB_UNATTENDED, but actually wants the machine to panic on a trap (otherwise, what's the use, if the machine causes a fatal trap rather than a true panic, of debugger_on_panic?). The changes cause no adverse behavior, but do involve two symbols becoming global Submitted by: Brian Feldman <green@unixhelp.org>
* Removed bogus casts of USRSTACK and/or the other operand in binarybde1998-12-161-7/+4
| | | | expressions involving USRSTACK.
* Avoid compiler warning (printf arg type mismatch) when compiling #ifdef DEBUGarchie1998-12-061-2/+2
|
* - For some old Cyrix CPUs, %cr2 is clobbered by interrupts. Thiskato1998-12-021-27/+59
| | | | | | | | | | | | | | | problem is worked around by using an interrupt gate for the page fault handler. This code was originally made for NetBSD/pc98 by Naofumi Honda <honda@kururu.math.sci.hokudai.ac.jp> and has already been in PC98 tree. Because of this bug, trap_fatal cannot show correct page fault address if %cr2 is obtained in this function. Therefore, trap_fatal uses the value from trap() function. - The trap handler always enables interruption when buggy application or kernel code has disabled interrupts and then trapped. This code was prepared by Bruce Evans <bde@FreeBSD.org>. Submitted by: Bruce Evans <bde@FreeBSD.org> Naofumi Honda <honda@kururu.math.sci.hokudai.ac.jp>
* Fixed printf format errors.bde1998-08-231-2/+2
|
* Translate T_PROTFLT to SIGSEGV instead of SIGBUS when running undereivind1998-04-281-1/+5
| | | | | | | | | Linux emulation. This make Allegro Common Lisp 4.3 work under FreeBSD! Submitted by: Fred Gilham <gilham@csl.sri.com> Commented on by: bde, dg, msmith, tg Hoping he got everything right: eivind
* Support compiling with `gcc -ansi'.bde1998-04-151-4/+4
|
* Eradicate the variable "time" from the kernel, using various measures.phk1998-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "time" wasn't a atomic variable, so splfoo() protection were needed around any access to it, unless you just wanted the seconds part. Most uses of time.tv_sec now uses the new variable time_second instead. gettime() changed to getmicrotime(0. Remove a couple of unneeded splfoo() protections, the new getmicrotime() is atomic, (until Bruce sets a breakpoint in it). A couple of places needed random data, so use read_random() instead of mucking about with time which isn't random. Add a new nfs_curusec() function. Mark a couple of bogosities involving the now disappeard time variable. Update ffs_update() to avoid the weird "== &time" checks, by fixing the one remaining call that passwd &time as args. Change profiling in ncr.c to use ticks instead of time. Resolution is the same. Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call hzto() which subtracts time" sequences. Reviewed by: bde
* Moved some #includes from <sys/param.h> nearer to where they are actuallybde1998-03-281-1/+2
| | | | used.
* Add the ability to make real-mode BIOS calls from the kernel. Currently,jlemon1998-03-231-1/+33
| | | | | | | | | | | everything is contained inside #ifdef VM86, so this option must be present in the config file to use this functionality. Thanks to Tor Egge, these changes should work on SMP machines. However, it may not be throughly SMP-safe. Currently, the only BIOS calls made are memory-sizing routines at bootup, these replace reading the RTC values.
* Back out DIAGNOSTIC changes.eivind1998-02-061-2/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+2
|
* Make POWERFAIL_NMI, PPS_SYNC and NATM new style options.eivind1998-01-311-1/+2
| | | | This also fixes a couple of defunct options; submitted by bde.
* Changes to allow event-based process monitoring and control.sef1997-12-061-1/+12
|
* document and make the NO_F00F_HACK a proper option...jmg1997-12-041-2/+3
| | | | | | also, sort some option includes while I'm here.. Forgotten by: sef
* After consultation with David, changejkh1997-12-041-5/+5
| | | | | | #ifndef NO_F00F_HACK to #if defined(I586_CPU) && !defined(NO_F00F_HACK)
* Work around for the Intel Pentium F00F bug; this is Intel's recommendedsef1997-12-031-1/+24
| | | | | | | workaround. Note that this currently eats up two pages extra in the system; this could be alleviated by aligning idt correctly, and then only dealing with that (as opposed to the current method of allocated two pages and copying the IDT table to that, and then setting that to be the IDT table).
* Fixed some #include messes.bde1997-11-241-7/+11
| | | | Hid the check of the user %cs in syscall() under `#ifdef DIAGNOSTIC'.
* Move the "retval" (3rd) parameter from all syscall functions and putphk1997-11-061-8/+8
| | | | | | | | | | | | it in struct proc instead. This fixes a boatload of compiler warning, and removes a lot of cruft from the sources. I have not removed the /*ARGSUSED*/, they will require some looking at. libkvm, ps and other userland struct proc frobbing programs will need recompiled.
* Compensate for pcb.h tweaks.peter1997-10-101-1/+6
| | | | (Bruce pointed out the nesting)
* Convert the VM86 option from a global option to an option only dependedpeter1997-10-101-1/+2
| | | | | on by the files that use it. Changing the VM86 option now only causes a recompile of a dozen files or so rather than the entire kernel.
* autoconf.c:gibbs1997-09-211-1/+3
| | | | | | | | | | | | | Add cpu_rootconf and cpu_dumpconf so that configuring these two devices can be better controlled by the MI configuration code. machdep.c: MD initialization code for the new callout interface. trap.c: Add support for printing out whether cam interrupts are masked during a panic.
* Cosmetic adjustment for the trap/double fault/panic cpu id listing.peter1997-09-051-8/+9
| | | | It now prints the apic id in hex rather than decimal.
* Remove the vm86 support as an LKM, and link it directly into the kerneljlemon1997-08-281-4/+5
| | | | | if 'options "VM86"' is in the config file. The LKM was really for development, and has probably outlived its usefulness.
* Clean up the SMP AP bootstrap and eliminate the wretched idle procs.peter1997-08-261-1/+6
| | | | | | | | | | | | | | | | | | | | - We now have enough per-cpu idle context, the real idle loop has been revived (cpu's halt now with nothing to do). - Some preliminary support for running some operations outside the global lock (eg: zeroing "free but not yet zeroed pages") is present but appears to cause problems. Off by default. - the smp_active sysctl now behaves differently. It's merely a 'true/false' option. Setting smp_active to zero causes the AP's to halt in the idle loop and stop scheduling processes. - bootstrap is a lot safer. Instead of sharing a statically compiled in stack a number of times (which has caused lots of problems) and then abandoning it, we use the idle context to boot the AP's directly. This should help >2 cpu support since the bootlock stuff was in doubt. - print physical apic id in traps.. helps identify private pages getting out of sync. (You don't want to know how much hair I tore out with this!) More cleanup to follow, this is more of a checkpoint than a 'finished' thing.
* Revert my previous commit about using CS_SECURE macro.charnier1997-08-211-5/+5
| | | | Requested by: Bruce.
* Preperation for moving cpl into critical region access.fsmp1997-08-201-1/+9
| | | | | | | | Several new fine-grained locks. New FAST_INTR() methods: - separate simplelock for FAST_INTR, no more giant lock. - FAST_INTR()s no longer checks ipending on way out of ISR. sio made MP-safe (I hope).
* Use CS_SECURE macro.charnier1997-08-181-5/+5
| | | | Reviewed by: John Dyson
* Back out a part of the disk scheduling "improvements" :-(. Let me knowdyson1997-08-121-2/+2
| | | | how the system works now!!!
* Modify the scheduling policy to take into account disk I/O waitsdyson1997-08-091-1/+14
| | | | | | as chargeable CPU usage. This should mitigate the problem of processes doing disk I/O hogging the CPU. Various users have reported the problem, and test code shows that the problem should now be gone.
OpenPOWER on IntegriCloud