Commit Graph

412 Commits

Author SHA1 Message Date
Paul Richards
94187a78bf is to lnc changes 1995-01-24 20:38:39 +00:00
David Greenman
fff3cea1a9 Moved various pmap 'bit' test/set functions back into real functions; gcc
generates better code at the expense of more of it.

Submitted by:	John Dyson
1995-01-24 09:57:39 +00:00
David Greenman
fbdfe8ac22 Changed buffer allocation policy (machdep.c)
Moved various pmap 'bit' test/set functions back into real functions; gcc
generates better code at the expense of more of it. (pmap.c)
Fixed a deadlock problem with pv entry allocations (pmap.c)
Added a new, optional function 'pmap_prefault' that does clustered page
table preloading (pmap.c)
Changed the way that page tables are held onto (trap.c).

Submitted by:	John Dyson
1995-01-24 09:56:33 +00:00
Bruce Evans
1a0518966d Don't use mi_switch() to terminate cpu_exit(). Calling it just happened to
work (mi_switch() counted the last timeslice again but this didn't affect
the exiting process' rusage because the rusage has already been finalized).

Remove stale comment.
1995-01-21 15:34:03 +00:00
Bruce Evans
cee6d3700d Remove unused definitions of vm statistics counters. Most of the
counting is now done in C.  There are still about 100 unused
definitions for other things.
1995-01-21 15:22:28 +00:00
Bruce Evans
e6891db8c5 Don't count context switches here, they are already counted in mi_switch(). 1995-01-21 15:20:23 +00:00
Andreas Schulz
c82762a9c3 Submitted by: Bruce Evans
Put in the much shorter and cleaner version for the calibrate_cycle_counter
for the Pentium that Bruce suggested. Tested here on my Pentium  and
it works okay.
1995-01-19 22:05:27 +00:00
Bruce Evans
2d2fb1bf6b The %eflags checking introduced in the previous commit was too zealous.
sigreturn() sometimes failed for ordinary returns from signal handlers.
Failures of ordinary returns "can't happen" and are badly handled.
"Temporary" fix: allow users to corrupt PSL_RF.  This is fairly
harmless.  A correct fix would involve saving the old %eflags (and
perhaps the old segment registers) where the user can't get at them.
1995-01-17 01:15:12 +00:00
David Greenman
7082ec8aa5 Fixed some page table reference count problems; these changes may not be
complete, but should be closer to correct than before.
1995-01-15 09:06:23 +00:00
Bruce Evans
20415301cd Fix security holes in sigreturn(), ptrace() and procfs. sigreturn()
attempted to check for insecure and fatal eflags and segment
selectors, but missed many cases and got the IOPL check back to
front.  The other syscalls didn't check at all.

sys_process.c, machdep.c:
Only allow PT_WRITE_U to write to the registers (ordinary and FP).

psl.h, locore.s, machdep.c:
Eliminate PSL_MBZ, PSL_MBO and PSL_USERCLR.  We are not supposed
to assume anything about the reserved bits.  Use PSL_USERCHANGE
and PSL_KERNEL instead.  Rename PSL_USERSET to PSL_USER.

exception.s:
Define a private label for use by doreti when returning to user
mode fails.

machdep.c:
In syscalls, allow changing only the eflags that can be changed on
486's in user mode (no longer attempt to allow benign IOPL changes;
allow changing the nasty PSL_NT; don't allow changing the i586
bits).

Don't attempt to check all the cases involving invalid selectors
and %eip's.  Just check for privilege violations and let the invalid
things cause a trap.

procfs_machdep.c:
Call the ptrace register functions to do all the work for reading
and writing ordinary registers and for single stepping.

trap.c:
Ignore traps caused by PSL_NT being set.  Previously, users could
cause a fatal trap in user mode by setting PSL_NT and executing an
iret, and a fatal trap in kernel mode by setting PSL_NT and making
a syscall.  PSL_NT was cleared too late and not in enough modes to
fix the problem.

Make all traps in user mode (except T_NMI) nonfatal.

Recover from traps caused by attempting to load invalid user
registers in doreti by restarting the traps so that they appear to
occur in user mode.
---

Fix bogons that I noticed while fixing the above:

psl.h:
Fix some comments.

Uniformize idempotency ifdef.

exception.s, machdep.c:
Remove rsvd[0-14].  rsvd0 hasn't been reserved since the 486 came
out.  Replace rsvd0 by `align'.  rsvd[0-11] used wrong (magic
non-unique) trap numbers.  Replace rsvd[1-14] by rsvd.

locore.s:
Enable alignment check flag on 486's and 586's.

machdep.c:
Use a better type for kstack[].

Use TFREGP() to find the registers.

Reformat ptrace functions from SEF to something closer to KNF.

procfs_machdep.c:
The wrong pointer to the registers got fixed as a side effect.

Implement reading and writing of FP registers.

/proc/*/*regs now work (only) for processes that are in memory.

Clean up comments.

trap.c, trap.h:
Remove unused trap types.
1995-01-14 13:20:26 +00:00
Jordan K. Hubbard
9949564470 Remove bogus scd0 driver - I should have looked at LINT first, anyway. 1995-01-14 10:48:56 +00:00
Bruce Evans
3117fbd98e Enable define of CR0_AM to prepare for implementing alignment checking.
Uniformize idempotency ifdef.
1995-01-14 10:44:55 +00:00
Bruce Evans
c277f99332 Declare a real `struct fpreg' to prepare for implementing reading and
writing of FP regs for procfs.

Uniformize idempotency ifdef.
1995-01-14 10:41:41 +00:00
Bruce Evans
1e1a3d012d Remove reference to impossible trap type T_KDBTRAP. We don't support
watchpoints.

Uniformize idempotency ifdef.
1995-01-14 10:34:52 +00:00
Bruce Evans
9bf308efab Eliminate T_KDBTRAP, which will soon go away. It was only used for an
unreachable case label in kdb_trap().

Use the correct case labels in kdb_trap() so that normal ddb entry doesn't
print a message.

Change all printf's to db_printf's.  Now you can put a breakpoint at printf,
and ddb entry messages don't spam the syslog output.

Cosmetic:

Use ISPL() instead of magic numbers.

Don't compile the unused function kdb_kbd_trap().

Improve some asms.

Print the arg to Debugger().
1995-01-14 10:24:48 +00:00
David Greenman
92c385361b Add missing object_lock/unlock. 1995-01-14 04:58:53 +00:00
Jordan K. Hubbard
0dd1eea105 Put UCONSOLE back - I was wrong, it's still used in one last place.
Submitted by:	ollivier
1995-01-14 02:39:22 +00:00
Justin T. Gibbs
451ab98ff3 Add in aic7770.c (EISA/VL Adaptors) and aic7870.c (PCI adaptor) dependancies
for the ahc driver.
1995-01-13 02:23:27 +00:00
Jordan K. Hubbard
09c42f85eb 1. Remove UCONSOLE. This appears to be well and truly dead (unless it's
hiding someplace in /sys I can't find).
2. Remove NCONS.  Soren's latest changes make it a no-op.
1995-01-12 15:37:16 +00:00
Jordan K. Hubbard
6722294de8 Change GENERIC to SWAP_GENERIC for now. I need the GENERIC kernel to
build by default again!  When the furor subsides, maybe something better
can be done, but..
1995-01-11 17:51:26 +00:00
David Greenman
0d94caffca These changes embody the support of the fully coherent merged VM buffer cache,
much higher filesystem I/O performance, and much better paging performance. It
represents the culmination of over 6 months of R&D.

The majority of the merged VM/cache work is by John Dyson.

The following highlights the most significant changes. Additionally, there are
(mostly minor) changes to the various filesystem modules (nfs, msdosfs, etc) to
support the new VM/buffer scheme.

vfs_bio.c:
Significant rewrite of most of vfs_bio to support the merged VM buffer cache
scheme.  The scheme is almost fully compatible with the old filesystem
interface.  Significant improvement in the number of opportunities for write
clustering.

vfs_cluster.c, vfs_subr.c
Upgrade and performance enhancements in vfs layer code to support merged
VM/buffer cache.  Fixup of vfs_cluster to eliminate the bogus pagemove stuff.

vm_object.c:
Yet more improvements in the collapse code.  Elimination of some windows that
can cause list corruption.

vm_pageout.c:
Fixed it, it really works better now.  Somehow in 2.0, some "enhancements"
broke the code.  This code has been reworked from the ground-up.

vm_fault.c, vm_page.c, pmap.c, vm_object.c
Support for small-block filesystems with merged VM/buffer cache scheme.

pmap.c vm_map.c
Dynamic kernel VM size, now we dont have to pre-allocate excessive numbers of
kernel PTs.

vm_glue.c
Much simpler and more effective swapping code.  No more gratuitous swapping.

proc.h
Fixed the problem that the p_lock flag was not being cleared on a fork.

swap_pager.c, vnode_pager.c
Removal of old vfs_bio cruft to support the past pseudo-coherency.  Now the
code doesn't need it anymore.

machdep.c
Changes to better support the parameter values for the merged VM/buffer cache
scheme.

machdep.c, kern_exec.c, vm_glue.c
Implemented a seperate submap for temporary exec string space and another one
to contain process upages. This eliminates all map fragmentation problems
that previously existed.

ffs_inode.c, ufs_inode.c, ufs_readwrite.c
Changes for merged VM/buffer cache.  Add "bypass" support for sneaking in on
busy buffers.

Submitted by:	John Dyson and David Greenman
1995-01-09 16:06:02 +00:00
Andreas Schulz
a9700525d8 Work around a compiler bug in gcc2.6.3 in handling (long long) variables and
shifting. Also correct the original code as Garrett noticed it in mail.
Leave the mishandled code in to use it later if future versions of gcc
are correct. The code was part of the calibrate_cyclecounter routine to
get the speed of the pentium chip.
1995-01-07 17:26:35 +00:00
Jordan K. Hubbard
2f6df2645b Gunther Schadow <gusw@fub46.zedat.fu-berlin.de>'s
driver for the Genius GS-4500 hand scanner.
Submitted by:	gusw@fub46.zedat.fu-berlin.de
1995-01-07 14:52:08 +00:00
Stefan Eßer
623976474c Submitted by: Wolfgang Stanglmeier <wolf@dentaro.GUN.de>
Reviewed by: <wollman>
First hooks and defines for the ISDN driver,
that soon will see the light ...
1995-01-05 19:51:51 +00:00
David Greenman
b5ba45f6f3 Corrected the list of volatile registers for outsb, outsw, and outsl.
This bug caused my ethernet driver to break, among other things no doubt.
1995-01-04 20:42:25 +00:00
Bruce Evans
37e52b59cc Use sufficient parentheses in macros.
Remove bogus input operands for fnsave(), fnstcw() and fnstsw().

Change all fwait's to fnop's.  This might help avoid hardware bugs.
Wait after fninit with an fnop.  This should be safer now.

Fix some spelling and formatting errors.

Use natural sizes for control and status words (u_short, promotes to int).

Don't clobber the SWI_CLOCK_MASK bits in npx0_imask when using IRQ13.

Set the devconf state correctly (always busy, if configured).  Improve
code for npx_registerdev() a little (gcc can't keep id->id_unit in a
register for some reason).  Don't register a nonexistent npx device.

Print a useful message in npxattach() again (delete references to errors
and not the whole message).  Don't print "387 emulator" if there is no
emulator in the kernel.

Use %p for pointers in error messages.

Don't clobber the FPU state when there is an FPU exception.  Just clear
the exception flags (after saving the flags as before).  This allows
debuggers and SIGFPE handlers to look at the full exception state.
SIGFPE handlers should normally return via longjmp(), which restores a
good FPU state (as before).  Returning from a SIGFPE handler may leave
the FPU in the wrong state (as before).

Clear the busy latch _after_ clearing the exception flags so that there
is less chance of getting a bogus h/w interrupt for a control operation.

Clear the saved exception status word when the next FPU instruction is
excuted so that it doesn't stick around until the next exception.

Clear the busy latch after fnsave() in npxsave() in case it was set when
npxsave() was called.
1995-01-03 04:00:06 +00:00
Bruce Evans
d5ebbddc5e Replace sv_ex_tw by padding (it is no longer used; the tag word in sv_env
is valid).

Expand comment about bogus padding for emulators.

Update prototpe for npxinit().
1995-01-03 03:57:46 +00:00
Jordan K. Hubbard
dd4a485085 From Bill Paul:
- /sys/i386/i386/swapgeneric.c is just plain broke. But fear not, for I
  have unbroken it. One thing that swapgeneric.c does is walk through the
  list of configured devices searching for a boot device. The only easy
  way to accomplish this in 2.0 is to use Garret Wollman's kern_devconf
  stuff. *BUT*, the head of the kern_devconf linked list (dc_list) is declared
  static in /sys/kern/kern_devconf.c. This means that swapgeneric.c can't
  see it at link time. I had to remove the 'static' keyword to get around
  this little problem. I hope this doesn't break anything anywhere.

  *Furthermore,* there's a small matter of making the call to setconf()
  in swapgeneric.c disappear when 'config kernel swap generic' isn't used.
  You could change /sbin/config to create a dummy setconf() function in
  swapkernel.c, but that seems messy somehow. (It's also someting of an
  'it isn't broken, why are you fixing it' situation.) My solution was to
  do what the NetBSD people did and put an #ifdef GENERIC around the call
  to setconf(). If your kernel is called GENERIC or you define 'options
  GENERIC,' then you can use 'config kernel swap generic' and it'll work.

  That aside, the upshot is that: a) swapgeneric.c actually works, and
  and b) the -a boot flag now works as well. If you boot with -a, as in
  "Boot: wd(0,a)/kernel -a" you will be presented with a 'root device?'
  prompt after the autoconfig phase, at which point you can specify what
  device you want mounted as root. Regrettably, you can't specify an NFS
  filesystem. Yet. Three files are affected: /sys/i386/i386/swapgeneric.c,
  /sys/i386/i386/autoconf.c and /sys/kern/kern_devconf.c.

Submitted by:	wpaul
1994-12-31 17:11:59 +00:00
Bruce Evans
43469be308 icu.s:
Move definition of `stat_imask' to clock.c.

clock.c:
Rename `rtcmask' to `stat_imask' and export it.  Rename `clkmask' to
`clk_imask' for consistency.

Only calculate TIMER_DIV(hz) once.

Merge debugging and "garbage" code to produce debugging code and format the
output better.

Make writertc() static inline and use it everywhere.  Now all accesses to
the clock registers go through rtcin() and writertc().

Move rtc initialization to cpu_initclocks().

Merge enablertclock() with cpu_initclocks() and remove enablertclock().
The extra entry point was just a leftover from 1.1.5.
1994-12-30 12:43:35 +00:00
Bruce Evans
13d7c724ca Obtained from: 1.1.5
Fix single-stepping of emulated FPU instructions.

Don't panic if an FPU instruction is attempted but there is no FPU
and no FPU emulator is configured.
1994-12-24 07:22:58 +00:00
David Greenman
94101b5208 Move page_unhold's in pmap_object_init_pt down one line to gard against
a potential race condition.
1994-12-18 14:16:22 +00:00
Jordan K. Hubbard
76fe9b2793 Add a 'vn' to GENERIC 1994-12-18 12:01:40 +00:00
David Greenman
931bde7f72 Check for PG_FAKE too in pmap_object_init_pt. 1994-12-18 03:36:27 +00:00
David Greenman
d9b026fcbd Add two more page table pages to keep 64MB machines happy. 1994-12-18 03:11:46 +00:00
Poul-Henning Kamp
784cf072d8 Remove sd1-sd3 & st1, now that we can autoallocate them.
fix the vn driver in LINT.  It autoallocates too.

Reviewed by:	phk
Submitted by:	rgrimes
1994-12-16 06:04:16 +00:00
David Greenman
c8a62b4bc5 Removed inappropriate comment. 1994-12-11 03:33:58 +00:00
David Greenman
d83ea8bcbd Add additional comment. 1994-12-11 03:11:23 +00:00
David Greenman
32b88083a9 Fix bogus comment. 1994-12-11 02:28:36 +00:00
Bruce Evans
91290462f6 Disable CLKF_BASEPRI() again. I forgot to edit an unwanted change out of
the diffs for the previous commit.
1994-12-03 10:18:24 +00:00
Bruce Evans
b39b673d37 i386/exception.s,
Keep track of interrupt nesting level.  It is normally 0
	for syscalls and traps, but is fudged to 1 for their exit
	processing in case they metamorphose into an interrupt
	handler.

i386/genassym.c;
	Remove support for the obsolete pcb_iml and pcb_cmap2.

	Add support for pcb_inl.

i386/swtch.s:
	Fudge the interrupt nesting level across context switches and in
	the idle loop so that the work for preemptive context switches
	gets counted as interrupt time, the work for voluntary context
	switches gets counted mostly as system time (the part when
	curproc == 0 gets counted as interrupt time), and only truly idle
	time gets counted as idle time.

	Remove obsolete support (commented out and otherwise) for pcb_iml.

	Load curpcb just before curproc instead of just after so that
	curpcb is always valid if curproc is.  A few more changes like
	this may fix tracing through context switches.

	Remove obsolete function swtch_to_inactive().

include/cpu.h:
	Use the new interrupt nesting level variable to implement a
	non-fake CLF_INTR() so that accounting for the interrupt state
	works.

	You can use top, iostat or (best) an up to date systat to see
	interrupt overheads.  I see the expected huge interrupt overheads
	for ISA devices (on a 486DX/33, about 55% for an IDE drive
	transferring 1250K/sec and the same for a WD8013EBT network card
	transferring 1100K/sec).  The huge interrupt overheads for serial
	devices are unfortunately normally invisible.

include/pcb.h:
	Remove the obsolete pcb_iml and pcb_cmap2.  Replace them by
	padding to preserve binary compatibility.

	Use part of the new padding for pcb_inl.

isa/icu.s:
isa/vector.s:
	Keep track of interrupt nesting level.
1994-12-03 10:03:19 +00:00
Poul-Henning Kamp
6128633879 I made a syntax error yesterday.
Submitted by:	John Capo
1994-11-27 01:49:39 +00:00
Poul-Henning Kamp
4ca88be6e9 Set the bootverbose if so desired.
if (bootverbose)
    Print the geometries the bios passes to us (through the bootblocks).
1994-11-26 09:37:57 +00:00
Poul-Henning Kamp
0a6a925d04 Declare "extern int bootverbose", so that device-drivers and others
easily can find it.
1994-11-26 09:27:58 +00:00
Poul-Henning Kamp
f143db1a98 I just learned that isa.h is included in assembler files too... 1994-11-19 18:59:04 +00:00
Poul-Henning Kamp
f194376568 add
extern u_int atdevbase;       /* offset in virtual memory of ISA io mem */
here for a moment, to get it into BETA
1994-11-19 18:47:57 +00:00
Jordan K. Hubbard
26b39132e4 Put ie0 above ep0. Otherwise, the ie0 probe clobbers it.
Submitted by:	gibbs
1994-11-18 19:10:25 +00:00
Justin T. Gibbs
8c1294dcf2 IO_EISASIZE should be 1 slot, not 2. 1994-11-18 19:01:25 +00:00
Jordan K. Hubbard
d6e867f326 Get IO_EISASIZE properly defined now.
Reviewed by:
Submitted by:
Obtained from:
1994-11-18 08:22:04 +00:00
Poul-Henning Kamp
048773d8d9 Grap the bootinfo structure the bootblock passes us. 1994-11-18 05:27:34 +00:00
Justin T. Gibbs
cbb8b164f0 New device-driver entries for the aic7770 driver. These use new features
of config so YOU MUST RECOMPILE CONFIG.  Modifying config was the cleanest
solution to integrating this driver into the tree which will become more
obvious in the next commit.
1994-11-17 20:20:54 +00:00