summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/trap.c
Commit message (Collapse)AuthorAgeFilesLines
* Catch up to moving headers:jhb2000-10-201-2/+2
| | | | | - machine/ipl.h -> sys/ipl.h - machine/mutex.h -> sys/mutex.h
* - Change fast interrupts on x86 to push a full interrupt frame and tojhb2000-10-061-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | return through doreti to handle ast's. This is necessary for the clock interrupts to work properly. - Change the clock interrupts on the x86 to be fast instead of threaded. This is needed because both hardclock() and statclock() need to run in the context of the current process, not in a separate thread context. - Kill the prevproc hack as it is no longer needed. - We really need Giant when we call psignal(), but we don't want to block during the clock interrupt. Instead, use two p_flag's in the proc struct to mark the current process as having a pending SIGVTALRM or a SIGPROF and let them be delivered during ast() when hardclock() has finished running. - Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways. It was broken on the x86 if it was turned on since cpl is gone. It's only use was to bogusly run softclock() directly during hardclock() rather than scheduling an SWI. - Remove the COM_LOCK simplelock and replace it with a clock_lock spin mutex. Since the spin mutex already handles disabling/restoring interrupts appropriately, this also lets us axe all the *_intr() fu. - Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use temporary fast interrupts for the APIC trial. - Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending signals in hardclock() that are to be delivered in ast(). Submitted by: jakeb (making statclock safe in a fast interrupt) Submitted by: cp (concept of delaying signals until ast())
* Various whitespace cleanups after the SMPng commit, which jumbled thingsjhb2000-10-061-19/+19
| | | | around a bit in the trap handling code.
* Don't treat a kernel stack fault the same as a general protect fault orjhb2000-10-061-0/+3
| | | | a segment not present fault in the non-vm86 case.
* Fixed hang on booting with -d. mtx_enter() was called on an uninitializedbde2000-09-131-4/+2
| | | | | lock. The quick fix in trap.c was not quite the version tested and had no effect; back it out.
* Quick fix for hang on booting with -d. mtx_enter() was called beforebde2000-09-121-2/+4
| | | | | | curproc was initialized. curproc == NULL was interpreted as matching the process holding Giant... Just skip mtx_enter() and mtx_exit() in trap() if (curproc == NULL && cold) (&& cold for safety).
* Major update to the way synchronization is done in the kernel. Highlightsjasone2000-09-071-183/+208
| | | | | | | | | | | | | | | include: * Mutual exclusion is used instead of spl*(). See mutex(9). (Note: The alpha port is still in transition and currently uses both.) * Per-CPU idle processes. * Interrupts are run in their own separate kernel threads and can be preempted (i386 only). Partially contributed by: BSDi (BSD/OS) Submissions by (at least): cp, dfr, dillon, grog, jake, jhb, sheldonh
* 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.
OpenPOWER on IntegriCloud