summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/mem.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Strip out the machine-independant parts of the memory device.markm2000-06-251-255/+50
| | | | | | /dev/(u)random, /dev/null, /dev/zero are all moving to machine-independant drivers. Reviewed by: dfr
* pmap_enter() masked off the page offset bits, pmap_kenter() did not.peter2000-05-241-0/+1
| | | | | | | This (I believe) is the cause of the XFree86 startup and/or mptable(8) panics when programs were reading from /dev/mem at non-page-aligned offsets. The offsets were being converted into random page flags in the page tables. :-( (including PG_PS = 4MB page size)
* Sort the sys includes.obrien2000-05-221-3/+3
|
* Implement an optimization of the VM<->pmap API. Pass vm_page_t's directlypeter2000-05-211-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to various pmap_*() functions instead of looking up the physical address and passing that. In many cases, the first thing the pmap code was doing was going to a lot of trouble to get back the original vm_page_t, or it's shadow pv_table entry. Inspired by: John Dyson's 1998 patches. Also: Eliminate pv_table as a seperate thing and build it into a machine dependent part of vm_page_t. This eliminates having a seperate set of structions that shadow each other in a 1:1 fashion that we often went to a lot of trouble to translate from one to the other. (see above) This happens to save 4 bytes of physical memory for each page in the system. (8 bytes on the Alpha). Eliminate the use of the phys_avail[] array to determine if a page is managed (ie: it has pv_entries etc). Store this information in a flag. Things like device_pager set it because they create vm_page_t's on the fly that do not have pv_entries. This makes it easier to "unmanage" a page of physical memory (this will be taken advantage of in subsequent commits). Add a function to add a new page to the freelist. This could be used for reclaiming the previously wasted pages left over from preloaded loader(8) files. Reviewed by: dillon
* * Use sys/sys/random.h rather than a i386 specific one.obrien2000-04-241-1/+1
| | | | | * There was nothing that should be machine dependant about i386/isa/random_machdep.c, so it is now sys/kern/kern_random.c.
* Remove unneeded <sys/buf.h> includes.phk2000-04-181-1/+0
| | | | | Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks by 924 bytes.
* Fixed breakage of read-only opening of /dev/*mem at securelevel > 0 inbde1999-12-261-3/+4
| | | | | | | | previous pair of commits. Spell the "securelevel > 0" check consistently. Use the proc arg instead of curproc in mmopen() and mmclose().
* Patch got this one wrong, we want to check securelevel in open()phk1999-11-071-5/+5
|
* Remove the iskmemdev() function. Make it the responsibility of the mem.cphk1999-11-071-14/+5
| | | | drivers to enforce the securelevel checks.
* Change useracc() and kernacc() to use VM_PROT_{READ|WRITE|EXECUTE} for thephk1999-10-301-1/+2
| | | | | | | | | "rw" argument, rather than hijacking B_{READ|WRITE}. Fix two bugs (physio & cam) resulting by the confusion caused by this. Submitted by: Tor.Egge@fast.no Reviewed by: alc, ken (partly)
* 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.
* Remove #ifdef notyet code for doing I/O in a way we never will do it.phk1999-10-291-47/+0
|
* Zap unneeded #includespeter1999-10-111-1/+0
| | | | Submitted by: phk
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | have been there in the first place. A GENERIC kernel shrinks almost 1k. Add a slightly different safetybelt under nostop for tty drivers. Add some missing FreeBSD tags
* Correction: mem.c devices are "D_MEM" (and D_MEM is added.)green1999-09-121-1/+1
| | | | Taken issue with by: phk
* Mainly stylistic fixes:green1999-09-121-18/+13
| | | | | | 1. return( -> return ( 2. inappropriate ENODEV -> ENOTTY 3. some unreachable cases removed
* Make the d_flags of mem devices D_DISK to signify that they are disk-likegreen1999-09-121-1/+1
| | | | | | random-seekable devices. This lets dd(1) know it can seek on them. It also affects spec_vnopen() (IIRC), but only makes the path of execution smaller, and does not change its behavior. This is when securelevel >= 2.
* Make the error return from mem_range_attr_get actually do something usefulmsmith1999-08-311-3/+5
| | | | (return an error to the caller)
* Check that there is memory range support before attempting to perform suchmsmith1999-08-301-2/+14
| | | | | | | | | | an operation, as a kernel client may not have previously checked the CPU type (it may not be able to). Also correct the function declaration style for the mem_range functions to match the rest of this file (oops). Submitted by: gibbs
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Now that we can bind cdevsw to the individual dev_t, divorce the PERFMONphk1999-08-231-23/+1
| | | | | | | stuff from mem.c. If PERFMON is there, it will "steal" a minor from mem.c, but mem.c doesn't need to know about this. Fixed type of cmd argument in perfmon_ioctl().
* Convert DEVFS hooks in (most) drivers to make_dev().phk1999-08-231-62/+11
| | | | | | | | | | | | | | | | Diskslice/label code not yet handled. Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers) Add the correct hook for devfs to kern_conf.c The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases. A few drivers had minor additional cleanups performed relating to cdevsw registration. A few drivers don't register a cdevsw{} anymore, but only use make_dev().
* Simplify cdevsw registration.phk1999-05-311-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-5/+22
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* Divorce "dev_t" from the "major|minor" bitmap, which is now calledphk1999-05-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the <sys/*.h> files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl).
* Make sure the mem_range_AP_init() prototype is seen where it's needed, andpeter1999-05-081-1/+3
| | | | #ifdef SMP around it for fun.
* Don't deref a NULL mem_range_softc.mr_op pointer on non-MTRR systems whenpeter1999-05-031-2/+2
| | | | starting the AP.
* Whoops, not all SMP systems have memory range attribute support. Don'tmsmith1999-05-021-2/+3
| | | | | | try to set it up on an AP unless we do. Submitted by: dave adkins <adkin003@tc.umn.edu>
* Add a hook that can be called to initialise a slave processor's memorymsmith1999-04-301-1/+7
| | | | | | | | | | range attributes after they have been extracted from the master. Hook up the i686 MP code to do this for each AP. Be more careful about printing the default memory type for the i686. Suggestions from: luoqi
* Suser() simplification:phk1999-04-271-3/+3
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* mem.cmsmith1999-04-071-8/+119
| | | | | | | | | | | | | Split out ioctl handler a little more cleanly, add memory range attribute handling for both kernel and user-space consumers. pmap.c Remove obsolete P6 MTRR-related code. i686_mem.c Map generic memory-range attribute interface to the P6 MTRR model.
* Check for signals while reading /dev/urandom. Reading 10MB frombde1999-02-021-1/+12
| | | | | | | /dev/urandom takes about 38 seconds on a P5/133. It is useful to be able to kill such reads almost immediately. Processes doing such reads are now scheduled so their denial of service is no worse than that of processes looping in user mode.
* * Fix a couple of places in the device pager where an address wasdfr1998-11-081-2/+2
| | | | | | | | | | | truncated to 32 bits. * Change the calling convention of the device mmap entry point to pass a vm_offset_t instead of an int for the offset allowing devices with a larger memory map than (1<<32) to be supported on the alpha (/dev/mem is one such). These changes are required to allow the X server to mmap the various I/O regions used for device port and memory access on the alpha.
* Converted add_interrupt_randomness() to take a `void *' arg. Rewrotebde1998-06-211-56/+59
| | | | | | | mmioctl() to fix hundreds of style bugs and a few error handling bugs (don't check for superuser privilege for inappropriate ioctls, don't check the input arg for the output-only MEM_RETURNIRQ ioctl, and don't return EPERM for null changes).
* This commit fixes various 64bit portability problems required fordfr1998-06-071-2/+2
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Don't depend on "implicit int" or bloat the data section in thebde1998-03-121-3/+3
| | | | | | declaration of mem_devsw_installed. Reduced include nesting.
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.eivind1998-01-241-1/+2
| | | | | | | | This introduce an xxxFS_BOOT for each of the rootable filesystems. (Presently not required, but encouraged to allow a smooth move of option *FS to opt_dontuse.h later.) LFS is temporarily disabled, and will be re-enabled tomorrow.
* Moved some extern declarations to header files (unused ones to /dev/null).bde1997-11-201-3/+1
|
* Update select -> poll in drivers.peter1997-09-141-7/+7
|
* Removed unused #includes.bde1997-07-201-3/+1
|
* Move interrupt handling code from isa.c to a new file. This should makedfr1997-06-021-1/+2
| | | | | | | isa.c (slightly) more portable and will make my life developing the really portable version much easier. Reviewed by: peter, fsmp
* Don't allow access to illegal addresses in /dev/kmem to panic kernelpeter1997-05-071-2/+7
| | | | | | | (eg: above 0xffc00000). Programs using /dev/kmem are implicitly racing the kernel, and can get right up high in memory. I've been running these for some time now, but with printfs. It's saved two panics at least that I can remember.
* simplify IOPL gain/remove privs code. It's easier with md_regspeter1997-05-071-8/+3
| | | | being a trapframe.
* Use the same IOPL check as in syscons.bde1997-04-141-1/+7
| | | | Reviewed by: pst, joerg
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* This is the kernel Lite/2 commit. There are some requisite userlanddyson1997-02-101-1/+1
| | | | | | | | | | | | | | | changes, so don't expect to be able to run the kernel as-is (very well) without the appropriate Lite/2 userland changes. The system boots and can mount UFS filesystems. Untested: ext2fs, msdosfs, NFS Known problems: Incorrect Berkeley ID strings in some files. Mount_std mounts will not work until the getfsent library routine is changed. Reviewed by: various people Submitted by: Jeffery Hsu <hsu@freebsd.org>
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* I've been meaning to commit this for months. Implement select()peter1996-09-271-2/+18
| | | | | | for /dev/random and /dev/urandom. Both are always writable, urandom is always readable, and /dev/random is readable when >= 8 bits are in the pool.
* Moved declaration of zbuf outside of #ifdef DEVFS code.nate1996-07-151-3/+3
|
* Quick fix for previous commit: don't free zbuf on close since it may bebde1996-07-151-9/+2
| | | | in use in another process that blocked in uiomove().
OpenPOWER on IntegriCloud