summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_trap.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* VM86 kernel support.dyson1997-08-091-5/+20
| | | | | | | Work done by BSDI, Jonathan Lemon <jlemon@americantv.com>, Mike Smith <msmith@gsoft.com.au>, Sean Eric Fagan <sef@kithrup.com>, and probably alot of others. Submitted by: Jnathan Lemon <jlemon@americantv.com>
* Removed unused #includes.bde1997-07-201-5/+1
|
* Preliminary support for per-cpu data pages.peter1997-06-221-15/+4
| | | | | | | | | | | | | | | | This eliminates a lot of #ifdef SMP type code. Things like _curproc reside in a data page that is unique on each cpu, eliminating the expensive macros like: #define curproc (SMPcurproc[cpunumber()]) There are some unresolved bootstrap and address space sharing issues at present, but Steve is waiting on this for other work. There is still some strictly temporary code present that isn't exactly pretty. This is part of a larger change that has run into some bumps, this part is standalone so it should be safe. The temporary code goes away when the full idle cpu support is finished. Reviewed by: fsmp, dyson
* Preserve %fs and %gs across context switches. This has a relatively lowbde1997-06-071-1/+20
| | | | | | | cost since it is only done in cpu_switch(), not for every exception. The extra state is kept in the pcb, and handled much like the npx state, with similar deficiencies (the state is not preserved across signal handlers, and error handling loses state).
* Move interrupt handling code from isa.c to a new file. This should makedfr1997-06-021-2/+2
| | | | | | | isa.c (slightly) more portable and will make my life developing the really portable version much easier. Reviewed by: peter, fsmp
* Include file updates.. <machine/spl.h> -> <machine/ipl.h>, addpeter1997-05-311-1/+2
| | | | | <machine/ipl.h> to those files that were depending on getting SWI_* implicitly via <machine/cpufunc.h>
* remove opt_smp.h and fix the reason it was needed.peter1997-05-291-3/+2
|
* md_regs is now a struct trapframe *peter1997-05-071-3/+3
|
* Make sure that *fork() always returns with %edx == 1 in thedyson1997-05-051-1/+2
| | | | | child. This was sometimes not happening correctly during my threads code work.
* Man the liferafts! Here comes the long awaited SMP -> -current merge!peter1997-04-261-1/+20
| | | | | | | | | | | | | | | | There are various options documented in i386/conf/LINT, there is more to come over the next few days. The kernel should run pretty much "as before" without the options to activate SMP mode. There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment. This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code!
* Fixed printing of registers in dbflalt_handler(). The registersbde1997-04-141-9/+7
| | | | | | | were always in a tss; that tss just changed from the one in the pcb to common_tss (who knows where it was when there was no curpcb?). Not using the pcb also fixed the problem that there is no pcb in idle(), so we now always get useful register values.
* The biggie: Get rid of the UPAGES from the top of the per-process addresspeter1997-04-071-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | space. (!) Have each process use the kernel stack and pcb in the kvm space. Since the stacks are at a different address, we cannot copy the stack at fork() and allow the child to return up through the function call tree to return to user mode - create a new execution context and have the new process begin executing from cpu_switch() and go to user mode directly. In theory this should speed up fork a bit. Context switch the tss_esp0 pointer in the common tss. This is a lot simpler since than swithching the gdt[GPROC0_SEL].sd.sd_base pointer to each process's tss since the esp0 pointer is a 32 bit pointer, and the sd_base setting is split into three different bit sections at non-aligned boundaries and requires a lot of twiddling to reset. The 8K of memory at the top of the process space is now empty, and unmapped (and unmappable, it's higher than VM_MAXUSER_ADDRESS). Simplity the pmap code to manage process contexts, we no longer have to double map the UPAGES, this simplifies and should measuably speed up fork(). The following parts came from John Dyson: Set PG_G on the UPAGES that are now in kernel context, and invalidate them when swapping them out. Move the upages object (upobj) from the vmspace to the proc structure. Now that the UPAGES (pcb and kernel stack) are out of user space, make rfork(..RFMEM..) do what was intended by sharing the vmspace entirely via reference counting rather than simply inheriting the mappings.
* No longer use an i386tss as the basis of our pcb - it wasn't particularlypeter1997-04-071-4/+4
| | | | | | | | | | | | | | | | convenient and makes life difficult for my next commit. We still need an i386tss to point to for the tss slot in the gdt, so we use a common tss shared between all processes. Note that this is going to break debugging until this series of commits is finished. core dumps will change again too. :-( we really need a more modern core dump format that doesn't depend on the pcb/upages. This change makes VM86 mode harder, but the following commits will remove a lot of constraints for the VM86 system, including the possibility of extending the pcb for an IO port map etc. Obtained from: bde
OpenPOWER on IntegriCloud