dragonfly.git
17 years agoMerge from vendor branch GCC:
Simon Schubert [Sat, 13 Jan 2007 16:32:16 +0000 (16:32 +0000)]
Merge from vendor branch GCC:
Update to gcc-3.4.6

17 years agoUpdate to gcc-3.4.6
Simon Schubert [Sat, 13 Jan 2007 16:32:16 +0000 (16:32 +0000)]
Update to gcc-3.4.6

17 years agoForgotten in previous commit: add 'verbose' bit definitions for the VMX and
Thomas E. Spanjaard [Fri, 12 Jan 2007 23:12:59 +0000 (23:12 +0000)]
Forgotten in previous commit: add 'verbose' bit definitions for the VMX and
SSSE3 bits in cpu_features2.

17 years agoPrint names for two more bits in cpu_features2: Supplemental SSE3, and I
Thomas E. Spanjaard [Fri, 12 Jan 2007 22:59:16 +0000 (22:59 +0000)]
Print names for two more bits in cpu_features2: Supplemental SSE3, and I
encountered a set bit 15 in the wild. Treat it the same as bit 2.

17 years agoFix the recently committed (and described) page writability nerf. The real
Matthew Dillon [Fri, 12 Jan 2007 22:12:53 +0000 (22:12 +0000)]
Fix the recently committed (and described) page writability nerf.  The real
kernel was unconditionally mapping writable pages read-only on read faults
in order to be able to take another fault on a write attempt.  This was needed
for early virtual kernel support in order to set the Modify bit in the
virtualized page table, but was being applied to ALL mappings rather then
just those installed by the virtual kernel.

Now the real kernel only does this for virtual kernel mappings.  Additionally,
the real kernel no longer makes the page read-only when clearing the Modify
bit in the real page table (in order to rearm the write fault).  When this
case occurs VPTE_M has already been set in the virtual page table and no
re-fault is required.

The virtual kernel now only needs to invalidate the real kernel's page
mapping when clearing the virtualized Modify bit in the virtual page table
(VPTE_M), in order to rearm the real kernel's write fault so it can detect
future modifications via the virtualized Modify bit.  Also, the virtual kernel
no longer needs to install read-only pages to detect the write fault.  This
allows the real kernel to do ALL the work required to handle VPTE_M and
make the actual page writable.  This greatly reduces the number of real
page faults that occur and greatly reduces the number of page faults which
have to be passed through to the virtual kernel.

This fix reduces fork() overhead for processes running under a virtual
kernel by 70%, from around 2100uS to around 650uS.

17 years agoAdd single-user mode boot option (-s).
Matthew Dillon [Fri, 12 Jan 2007 18:31:18 +0000 (18:31 +0000)]
Add single-user mode boot option (-s).

Submitted-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
17 years agoAdd missing bzero() during low boot after malloc().
Matthew Dillon [Fri, 12 Jan 2007 18:27:09 +0000 (18:27 +0000)]
Add missing bzero() during low boot after malloc().

Reported-by: YONETANI Tomokazu <qhwt+dfly@les.ath.cx>
17 years agoSet kernel_vm_end to virtual_start instead of virtual_end so it can be used
Matthew Dillon [Fri, 12 Jan 2007 18:03:48 +0000 (18:03 +0000)]
Set kernel_vm_end to virtual_start instead of virtual_end so it can be used
to detemine how much KVM has been reserved so far (so vm.kvm_free works).

As part of the same deal, redo pmap_growkernel() to just increase
kernel_vm_end up to its limit, instead of just panicing.

Remove in incorrect NULLing out of pmap->pm_pdir.  This was causing the
kernel_map to grow forever until it ran out of space and the system paniced.

17 years agoAdjust the gdb patch to account for the new register structure.
Matthew Dillon [Fri, 12 Jan 2007 07:17:56 +0000 (07:17 +0000)]
Adjust the gdb patch to account for the new register structure.

17 years agoDisable sshd on the Live CD. This just takes time generating the
Simon Schubert [Fri, 12 Jan 2007 06:56:24 +0000 (06:56 +0000)]
Disable sshd on the Live CD.  This just takes time generating the
keys, and doesn't provide any benefit.  If you want to log in from
remote, you still have to allow root logins for sshd.

17 years agoMisc cleanups.
Matthew Dillon [Fri, 12 Jan 2007 06:07:29 +0000 (06:07 +0000)]
Misc cleanups.

17 years agoFix a number of places where the kernel assumed it could directly access
Matthew Dillon [Fri, 12 Jan 2007 06:06:58 +0000 (06:06 +0000)]
Fix a number of places where the kernel assumed it could directly access
user memory.  Primarily the core dump code.

17 years agoAdd missing link options to export global symbols to the _DYNAMIC section,
Matthew Dillon [Fri, 12 Jan 2007 03:05:49 +0000 (03:05 +0000)]
Add missing link options to export global symbols to the _DYNAMIC section,
allowing the kernel namelist functions to operate.  For now just make
certain static variables global instead of using linker magic to export
static variables.

Add infrastructure to allow out of band kernel memory to be accessed.  The
virtual kernel's memory map does not include the virtual kernel executable
or data areas.

vmstat, systat, pstat, and netstat now work with virtual kernels.

17 years agoRemove unused SWI's.
Matthew Dillon [Thu, 11 Jan 2007 23:23:57 +0000 (23:23 +0000)]
Remove unused SWI's.

17 years agoReplace remaining uses of vm_fault_quick() with vm_fault_page_quick().
Matthew Dillon [Thu, 11 Jan 2007 20:53:42 +0000 (20:53 +0000)]
Replace remaining uses of vm_fault_quick() with vm_fault_page_quick().
Do not directly access userland virtual addresses in the kernel UMTX code.

17 years agoRemove DEBUG_VFS_LOCKS which is not used anymore.
Sascha Wildner [Thu, 11 Jan 2007 17:16:02 +0000 (17:16 +0000)]
Remove DEBUG_VFS_LOCKS which is not used anymore.

17 years agoMajor pmap update. Note also that this commit temporarily nerfs performance
Matthew Dillon [Thu, 11 Jan 2007 10:39:41 +0000 (10:39 +0000)]
Major pmap update.  Note also that this commit temporarily nerfs performance
because the virtual kernel support is being applied globally instead of just
to virtual page tables.  This will be fixed in a followup commit.

17 years agoWhen removing a page directory, tell the real kernel to invalidate the
Matthew Dillon [Thu, 11 Jan 2007 10:25:52 +0000 (10:25 +0000)]
When removing a page directory, tell the real kernel to invalidate the
related segment.  This may not be necessary and can be removed later after
testing.

The virtual kernel's pmap_track_modified() is dealing with independant
address spaces, don't return false hits on non-kernel pmaps.

When clearing the Modify bit, also clear the write bit to force a fault.
We have no other means of detecting when a page is modified.  Note that
this may not be necessary in the vkernel implementation once the real
kernel implementation is fixed to properly set the Modify bit (by doing the
same thing).

Invalidate the real kernel's pmap when clearing either the Write bit or
the Modify bit, instead of just the write bit, and clear both bits when
clearing either, again in order to force a page fault to detect page
modifications.

Code cleanup - remove degenerate cases.  e.g. pmap_changebit() was only
ever used to clear bits, rip out the set/clear functionality and just
make it pmap_clearbit().

17 years agoFix a bug vm_fault_page(). PG_MAPPED was not getting set, causing the
Matthew Dillon [Thu, 11 Jan 2007 10:15:21 +0000 (10:15 +0000)]
Fix a bug vm_fault_page().  PG_MAPPED was not getting set, causing the
system to fail to remove pmap entries related to a VM page when reusing
the VM page.

General cleaning of vm_fault*() routines.  These routines now expect all
appropriate VM_PROT_* flags to be specified instead of just one.  Also
clean up the VM_FAULT_* flags.

Remove VM_FAULT_HOLD - it is no longer used.  vm_fault_page() handles the
functionality in a far cleaner fashion then vm_fault().

17 years agoProperly block SIGALARM and disable interrupts (i.e. signals) in init
Matthew Dillon [Thu, 11 Jan 2007 10:08:25 +0000 (10:08 +0000)]
Properly block SIGALARM and disable interrupts (i.e. signals) in init
so clock reloads occuring prior to the installation of the clock interrupt
(i.e. itimer) do not cause the program to abort.

17 years agoUnbreak build by moving the include up.
Simon Schubert [Thu, 11 Jan 2007 02:49:56 +0000 (02:49 +0000)]
Unbreak build by moving the include up.
Make is a horrible tool.

Noticed-by: y0netan1@, snapshot building, et al.
17 years agoOpen the root disk with O_DIRECT. We do not want both the real kernel and
Matthew Dillon [Thu, 11 Jan 2007 02:46:48 +0000 (02:46 +0000)]
Open the root disk with O_DIRECT.  We do not want both the real kernel and
the virtual kernel caching the 'disk' data.  We just want the virtual kernel
to cache the data so memory resource use is limited to the 'physical' memory
specified when starting up the virtual kernel.

17 years agoSubstitute a phony target with a cookie, thus not requiring the
Simon Schubert [Wed, 10 Jan 2007 16:41:37 +0000 (16:41 +0000)]
Substitute a phony target with a cookie, thus not requiring the
assembler symbols to be generated on every kernel rebuild.

17 years agoRemove old zoneinfo files.
Sascha Wildner [Wed, 10 Jan 2007 15:55:44 +0000 (15:55 +0000)]
Remove old zoneinfo files.

17 years ago[committed on behalf of sephe]
Sascha Wildner [Wed, 10 Jan 2007 13:33:23 +0000 (13:33 +0000)]
[committed on behalf of sephe]

- 'Correctly' fake an ethernet address for tap(4).
- Add vke(4) for virtual kernel.  It uses tap(4) as backend.  The RX
  interrupt is currently faked with callout.
  Idea-from: TGEN@ and corecode@

17 years agoAdd support for parsing MCFG tables.
Jeffrey Hsu [Wed, 10 Jan 2007 12:23:23 +0000 (12:23 +0000)]
Add support for parsing MCFG tables.

Obtained from: FreeBSD (scottl)

17 years agoSync up to FreeBSD rev 1.23:
Jeffrey Hsu [Wed, 10 Jan 2007 11:54:45 +0000 (11:54 +0000)]
Sync up to FreeBSD rev 1.23:

 date: 2005-02-14 08:32:32 -0800;  author: njl;  state: Exp;  lines: +2 -1;
 Note addition of MCFG support.

17 years agoMerge FreeBSD revs 1.20 through 1.21: update list of supported tables.
Jeffrey Hsu [Wed, 10 Jan 2007 11:50:33 +0000 (11:50 +0000)]
Merge FreeBSD revs 1.20 through 1.21:  update list of supported tables.

17 years agoMake the size of the pmap structure the same for both pc32 and vkernel
Matthew Dillon [Wed, 10 Jan 2007 09:37:52 +0000 (09:37 +0000)]
Make the size of the pmap structure the same for both pc32 and vkernel
builds, so utility binaries like 'ps' can be shared.

17 years agoJust bump version numbers due to null offsetting changes from FreeBSD:
Jeffrey Hsu [Wed, 10 Jan 2007 08:44:30 +0000 (08:44 +0000)]
Just bump version numbers due to null offsetting changes from FreeBSD:

 Add the -s flag to make dumping SSDTs optional (disabled by default).

 Back out the -s flag and go back to dumping the SSDTs by default.

17 years agoAdd some comments. Same as FreeBSD revs 1.28 through 1.30.
Jeffrey Hsu [Wed, 10 Jan 2007 08:41:18 +0000 (08:41 +0000)]
Add some comments.  Same as FreeBSD revs 1.28 through 1.30.

17 years agoTell the real kernel not to sync the file that backs a virtual kernel's
Matthew Dillon [Wed, 10 Jan 2007 08:08:17 +0000 (08:08 +0000)]
Tell the real kernel not to sync the file that backs a virtual kernel's
'physical' memory.

17 years agoHave vectorctl silently succeed to remove a run-time warning.
Matthew Dillon [Wed, 10 Jan 2007 08:07:17 +0000 (08:07 +0000)]
Have vectorctl silently succeed to remove a run-time warning.

17 years agoSame as FreeBSD rev 1.19:
Jeffrey Hsu [Wed, 10 Jan 2007 07:51:24 +0000 (07:51 +0000)]
Same as FreeBSD rev 1.19:

 date: 2004-08-17 22:50:32 -0700;  author: njl;  state: Exp;  lines: +2 -5;
 Update man page for supported table types.

17 years agoFix collision with variable named 'errno'.
Matthew Dillon [Wed, 10 Jan 2007 07:44:02 +0000 (07:44 +0000)]
Fix collision with variable named 'errno'.

17 years agoSame as FreeBSD rev 1.27:
Jeffrey Hsu [Wed, 10 Jan 2007 07:37:44 +0000 (07:37 +0000)]
Same as FreeBSD rev 1.27:

 date: 2004-08-17 22:56:07 -0700;  author: njl;  state: Exp;  lines: +5 -2;
 When one entry in the RSDT is corrupted, just skip it instead of bailing out.
 This gets us the info we need on systems which have proprietary tables that
 don't match the standard.  For instance, an AMI system has a table of type
 "OEMB" with an invalid checksum.

 Tested by:      Maxim Maximov <mcsi_at_mcsi.pp.ru>

17 years agoAdd support for SSDT tables.
Jeffrey Hsu [Wed, 10 Jan 2007 07:23:49 +0000 (07:23 +0000)]
Add support for SSDT tables.

Same as FreeBSD

 acpi.c
 revision 1.26
 date: 2004-08-13 15:59:09 -0700;  author: marcel;  state: Exp;  lines: +44 -10;
 branches:  1.26.2;
 Add support for SSDT tables. Dumping or disassembling the DSDT will
 now include the contents if any SSDT table as well. This makes use
 of the property that one can concatenate the body of SSDT tables to
 the DSDT, updating the DSDT header (length and checksum) and end up
 with a larger and valid DSDT table. Hence, this also works with -f.

 Reviewed by: njl@

 acpidump.8
 revision 1.18
 date: 2004-08-16 13:33:20 -0700;  author: marcel;  state: Exp;  lines: +4 -2;
 branches:  1.18.2;
 We now handle SSDT tables. Remove a reference from the BUGS section
 and explicitly mention SSDT when we talk about the DSDT so that people
 don't have to guess whether it includes the SSDT.
 While here, touch date.

 Pointed out by: le@

 acpidump.c
 revision 1.9
 date: 2004-08-13 15:59:09 -0700;  author: marcel;  state: Exp;  lines: +10 -7;
 branches:  1.9.2;
 Add support for SSDT tables. Dumping or disassembling the DSDT will
 now include the contents if any SSDT table as well. This makes use
 of the property that one can concatenate the body of SSDT tables to
 the DSDT, updating the DSDT header (length and checksum) and end up
 with a larger and valid DSDT table. Hence, this also works with -f.

 Reviewed by: njl@

 acpidump.h
 revision 1.17
 date: 2004-08-13 15:59:09 -0700;  author: marcel;  state: Exp;  lines: +4 -3;
 Add support for SSDT tables. Dumping or disassembling the DSDT will
 now include the contents if any SSDT table as well. This makes use
 of the property that one can concatenate the body of SSDT tables to
 the DSDT, updating the DSDT header (length and checksum) and end up
 with a larger and valid DSDT table. Hence, this also works with -f.

 Reviewed by: njl@

17 years agoUse SEEK_SET instead of magic constant.
Simon Schubert [Wed, 10 Jan 2007 03:04:28 +0000 (03:04 +0000)]
Use SEEK_SET instead of magic constant.

17 years agoGet floating point working in virtual kernels. Add a feature that allows
Matthew Dillon [Tue, 9 Jan 2007 23:34:06 +0000 (23:34 +0000)]
Get floating point working in virtual kernels.  Add a feature that allows
the virtual kernel to request that the real kernel return a T_DNA fault
if an emulated user context attempts to use the FP unit.

17 years agoAdd 'cd9660:acd0' and 'cd9660:acd1' to cdrom_rootdevnames so a root mount
Thomas E. Spanjaard [Tue, 9 Jan 2007 22:36:00 +0000 (22:36 +0000)]
Add 'cd9660:acd0' and 'cd9660:acd1' to cdrom_rootdevnames so a root mount
of RB_CDROM can succeed on NATA.

17 years agoAdd a temporary fix to ata_interrupt() to ignore weird interrupts seen on
Thomas E. Spanjaard [Tue, 9 Jan 2007 21:17:00 +0000 (21:17 +0000)]
Add a temporary fix to ata_interrupt() to ignore weird interrupts seen on
SMP+ATAPI+DMA. For some reason, the ATAPI device asserts INTRQ while it's
otherwise completely ready to fulfill the request. DRQ is set in the status
register, and no matter how I read the specs, this just should never
happen. Is this actually a race condition? I have no idea :(. Ignoring the
interrupt, however, does not seem to produce adverse results (tested with
a DragonFlyBSD livecd with SMP kernel).

17 years agoBail out of acd_open() when we're called with a cdev_t that wasn't created
Thomas E. Spanjaard [Tue, 9 Jan 2007 20:56:16 +0000 (20:56 +0000)]
Bail out of acd_open() when we're called with a cdev_t that wasn't created
by us. This happened when e.g. booting from cd; 'acd0c' would then be
resolved to minor 2 instead of the minor 0 we create in acd_attach(). If
one, instead of booting the kernel through, exits to the loader prompt from
the bootloader, then issues `unload` and `load kernel`, then `boot`, this
problem wouldn't show up. My guess is, somewhere, somehow, the bootloader
is mucking about in our cdev storeroom. I haven't yet found where this
happens.

17 years agoName the virtual kernel disk device 'vkd' instead of 'vd'.
Matthew Dillon [Tue, 9 Jan 2007 18:26:59 +0000 (18:26 +0000)]
Name the virtual kernel disk device 'vkd' instead of 'vd'.

Suggested-by: Sascha Wildner <saw@online.de>
17 years agoFix 'make upgrade'.
Sascha Wildner [Tue, 9 Jan 2007 17:04:01 +0000 (17:04 +0000)]
Fix 'make upgrade'.

17 years agoInstall tap headers.
Simon Schubert [Tue, 9 Jan 2007 14:22:17 +0000 (14:22 +0000)]
Install tap headers.

Noticed-by: sephe@
17 years agoSync zoneinfo database with tzdata2007a from elsie.
Sascha Wildner [Tue, 9 Jan 2007 09:56:27 +0000 (09:56 +0000)]
Sync zoneinfo database with tzdata2007a from elsie.

africa:         8.5  -> 8.7
australasia:    8.4  -> 8.5
backward:       8.2  -> 8.3
europe:         8.6  -> 8.7
northamerica:   8.10 -> 8.11
southamerica:   8.6  -> 8.8
zone.tab:       8.6  -> 8.8

From Paul Eggert's comments:

* Changes affecting future time stamps.

  - The Bahamas also observe the new US DST rules this year.
    (Thanks to Sue Williams for this.)

* Changes affecting TZ names, to reflect typical English practice better.
  The old names are still supported, in the 'backward' file.

  - Rename Africa/Asmera to Africa/Asmara.

  - Rename Atlantic/Faeroe to Atlantic/Faroe.

* A new zone Australia/Eucla, covering the Eucla area.  (Thanks to
  Alex Livingston for this.)

* Changes affecting old time stamps.

  - The 1982 transition for Pacific/Easter occurred Mar 13, not Jan 18.
    Also, the pre-1932 time stamps are now labeled EMT, not MMT, since
    they are not Mataveri Mean Time.  (Thanks to Jesper Norgaard Welen
    for this.)

17 years agoRemove old MLINKS.
Sascha Wildner [Tue, 9 Jan 2007 08:28:10 +0000 (08:28 +0000)]
Remove old MLINKS.

17 years agoA virtual kernel running another virtual kernel running an emulated process
Matthew Dillon [Tue, 9 Jan 2007 07:23:03 +0000 (07:23 +0000)]
A virtual kernel running another virtual kernel running an emulated process
context must pop back into its virtual kernel context before posting
any signal.  Correct a number of cases that were not being handled.

Clear the signal mask before starting the emulated user process context
loop.

Fix a reinit bug in the console callout polling code that was causing
a lockup.

17 years agoA virtual kernel running an emulated process context must pop back into
Matthew Dillon [Tue, 9 Jan 2007 07:03:32 +0000 (07:03 +0000)]
A virtual kernel running an emulated process context must pop back into
its virtual kernel context before posting any signal.  Correct a number
of cases that were not being handled.

17 years agoFix two incorrect sigblock() calls.
Matthew Dillon [Tue, 9 Jan 2007 06:04:59 +0000 (06:04 +0000)]
Fix two incorrect sigblock() calls.

17 years agoUse our interrupt infrastructure to handle the clock interrupt, but
Matthew Dillon [Tue, 9 Jan 2007 00:49:03 +0000 (00:49 +0000)]
Use our interrupt infrastructure to handle the clock interrupt, but
for the moment we have no common 'hard interrupt' (i.e. signal) core
so do the critical section check manually.

17 years agoDisable terminal control characters while the virtual kernel is running,
Matthew Dillon [Tue, 9 Jan 2007 00:20:20 +0000 (00:20 +0000)]
Disable terminal control characters while the virtual kernel is running,
so typing ^C, ^Z, etc on the console gets fed through to the virtual
kernel.

Enable terminal control characters when the virtual kernel is in DDB,
so e.g. a ^C while it is in DDB will kill the virtual kernel.

The QUIT signal (^\) is left enabled throughout and will force the virtual
kernel into its DDB.

17 years agoAdd a missing pmap_enter() in vm_fault_page(). If a write fault does a COW
Matthew Dillon [Mon, 8 Jan 2007 23:41:31 +0000 (23:41 +0000)]
Add a missing pmap_enter() in vm_fault_page().  If a write fault does a COW
and must replace a read-only page, the pmap must be updated so the process
sees the new page.

17 years agoRename the following special extended I/O system calls. Only libc, libc_r,
Matthew Dillon [Mon, 8 Jan 2007 21:41:59 +0000 (21:41 +0000)]
Rename the following special extended I/O system calls.  Only libc, libc_r,
and VKERNEL are currently known to use these calls so the rename should have
no major effects.

Fix broken prototypes in unistd.h.

__accept    ->      extaccept
__connect   ->      extconnect
__pread     ->      extpread
__preadv    ->      extpreadv
__pwrite    ->      extpwrite
__pwritev   ->      extpwritev

Broken-Prototypes-Reported-by: Joe Talbott <josepht@cstone.net>
17 years agoFix the obscure at(1) permission problem.
Simon Schubert [Mon, 8 Jan 2007 21:32:57 +0000 (21:32 +0000)]
Fix the obscure at(1) permission problem.

change_[er]uid() both use cratom(), however their consumers happened to cache
the original cred in a variable.  If the cred happened to be shared before
(for example due to an open(2)), a conditional lateron would still reference
the old cred instead of the new one, which was instanciated in change_[er]uid.

Fix this by returning the new cred from change_[er]uid and using this in
subsequent conditionals.

DragonFly-bug: http://bugs.dragonflybsd.org/issue509

17 years agoInstall gdb docs.
Simon Schubert [Mon, 8 Jan 2007 20:05:42 +0000 (20:05 +0000)]
Install gdb docs.

17 years agoAdd the virtual kernel's virtual disk device to the fray (vd*).
Matthew Dillon [Mon, 8 Jan 2007 19:48:35 +0000 (19:48 +0000)]
Add the virtual kernel's virtual disk device to the fray (vd*).

17 years agoUse CBREAK mode for the console.
Matthew Dillon [Mon, 8 Jan 2007 19:45:39 +0000 (19:45 +0000)]
Use CBREAK mode for the console.

Adjust code for new vm_fault_page*() semantics (it now marks the page as
referenced and dirties it automatically so the caller doesn't have to).

Fix a VPTE_W or VPTE_WIRED snafu.
FIx a PG_MANAGED vs VPTE_MANAGED snafu.

Add additional VPTE_ bit definitions.

17 years agoRewrite vmapbuf() to use vm_fault_page_quick() instead of vm_fault_quick().
Matthew Dillon [Mon, 8 Jan 2007 19:42:24 +0000 (19:42 +0000)]
Rewrite vmapbuf() to use vm_fault_page_quick() instead of vm_fault_quick().
Overhead is slightly increased (until we can optimize vm_fault_page_quick()),
but the code is greatly simplified.

17 years agoImplement vm_fault_page_quick(), which will soon be replacing
Matthew Dillon [Mon, 8 Jan 2007 19:41:01 +0000 (19:41 +0000)]
Implement vm_fault_page_quick(), which will soon be replacing
vm_fault_quick().  vm_fault_quick() does not hold the underlying page
in any way and is not SMP friendly.  It also uses architecture-specific
tricks to force the page into a pmap which do not work with the VKERNEL.

17 years agoMake libc prototypes available to kernel builds
Matthew Dillon [Mon, 8 Jan 2007 19:29:23 +0000 (19:29 +0000)]
Make libc prototypes available to kernel builds

17 years agoMake more libc prototypes available to _KERNEL builds.
Matthew Dillon [Mon, 8 Jan 2007 17:19:26 +0000 (17:19 +0000)]
Make more libc prototypes available to _KERNEL builds.

17 years agoAdd missing header file.
Matthew Dillon [Mon, 8 Jan 2007 16:34:10 +0000 (16:34 +0000)]
Add missing header file.

Reported-by: Sascha Wildner <saw@online.de>
17 years agoWhen removing a page directory from a page map, the KVA representing
Matthew Dillon [Mon, 8 Jan 2007 16:03:25 +0000 (16:03 +0000)]
When removing a page directory from a page map, the KVA representing
the page table page in the self-mapping must also be invalidated.

17 years ago[committed on behalf of sephe]
Sascha Wildner [Mon, 8 Jan 2007 12:21:50 +0000 (12:21 +0000)]
[committed on behalf of sephe]

Don't call device_busy() when /dev/psmN is opened.  DS_BUSY is used to
prevent recursive bus scanning on DragonFly.  Strip the device_unbusy()
in psmclose().
This should make module loading after system startup work on some system.

Explained-by: dillon@
17 years ago[committed on behalf of sephe]
Sascha Wildner [Mon, 8 Jan 2007 12:15:27 +0000 (12:15 +0000)]
[committed on behalf of sephe]

- Add {TAILQ,STAILQ}_CONCAT() macros
- Add comment about *_FOREACH_MUTABLE()
- Sync ath(4) with FreeBSD (sam@freebsd.org):
  o  Add/Correct some debug information.
  o  Add more statistics.
  o  Receive control frames in monitor mode.
  o  Close race in handling mcast traffic when operating as an ap with
     stations in power save: add a new q where mcast frames are stashed
     and on beacon update (at DTIM) move frames from the mcast q to the
     cabq and start it.  This ensures the cabq is only manipulated in
     one place.
  o  Correct the type of ath_descdma.dd_desc_len
  o  Correct max segement size when creating DMA tag

17 years agoAdd a vkernel(7) manpage which I hacked together from Matt's comments.
Sascha Wildner [Mon, 8 Jan 2007 08:55:44 +0000 (08:55 +0000)]
Add a vkernel(7) manpage which I hacked together from Matt's comments.

17 years agoThe signal return code was trying to access user mode addresses
Matthew Dillon [Mon, 8 Jan 2007 08:17:17 +0000 (08:17 +0000)]
The signal return code was trying to access user mode addresses
directly, which doesn't work when the user process is in an entirely
different vmspace.  Use copyin() instead.

Assign SIGQUIT (^\) on the console to cause a virtual kernel to enter
its internal db> debugger.

Quickly hack a callout() based poller for console input so the console
works (sorta).

Allow a kernel environment to specified as an option in the form
-e name=value:name=value:...

NULL-out the pmap self-mapping cache when a pmap is destroyed.

17 years agoModify the trapframe sigcontext, ucontext, etc. Add %gs to the trapframe
Matthew Dillon [Mon, 8 Jan 2007 03:33:43 +0000 (03:33 +0000)]
Modify the trapframe sigcontext, ucontext, etc.  Add %gs to the trapframe
and xflags and an expanded floating point save area to sigcontext/ucontext
so traps can be fully specified.

Remove all the %gs hacks in the system code and signal trampoline and handle
%gs faults natively, like we do %fs faults.

Implement writebacks to the virtual page table to set VPTE_M and VPTE_A and
add checks for VPTE_R and VPTE_W.

Consolidate the TLS save area into a MD structure that can be accessed by MI
code.

Reformulate the vmspace_ctl() system call to allow an extended context to be
passed (for TLS info and soon the FP and eventually the LDT).

Adjust the GDB patches to recognize the new location of %gs.

Properly detect non-exception returns to the virtual kernel when the virtual
kernel is running an emulated user process and receives a signal.

And misc other work on the virtual kernel.

17 years ago* Remove some zoneinfo files from 'make upgrade' that were re-added to
Sascha Wildner [Mon, 8 Jan 2007 01:52:14 +0000 (01:52 +0000)]
* Remove some zoneinfo files from 'make upgrade' that were re-added to
  the distribution for compatibility reasons.

* Remove obsolete SystemV directory.

17 years ago* Sync with FreeBSD-RELENG_6.
Sascha Wildner [Mon, 8 Jan 2007 01:38:02 +0000 (01:38 +0000)]
* Sync with FreeBSD-RELENG_6.

* Add some devices to LINT.

* Do some cleanup in sys/conf/files.

OK-by: corecode
17 years agoUpdate the man page, now jail returns a non-negative integer if succesful
Victor Balada Diaz [Sun, 7 Jan 2007 18:33:38 +0000 (18:33 +0000)]
Update the man page, now jail returns a non-negative integer if succesful
or -1 on error.

Imported-From: FreeBSD

17 years agoAdd support for -l and -U. -l creates a jail in a clear environment and
Victor Balada Diaz [Sun, 7 Jan 2007 18:12:46 +0000 (18:12 +0000)]
Add support for -l and -U. -l creates a jail in a clear environment and
-U runs a program with the given username from the jail.

Imported-From: FreeBSD

17 years agoFix expanding of quoted positional parameters in case patterns.
Peter Avalos [Sun, 7 Jan 2007 16:58:30 +0000 (16:58 +0000)]
Fix expanding of quoted positional parameters in case patterns.

When parsing an invalid parameter expansion (eg. ${} or ${foo@bar}) do not
issue a syntax error immediately but save the information that it is erroneous
for later when the parameter expansion is actually done.  This means eg. "false
&& ${}" will not generate an error which seems to be required by POSIX.

Remove some white space at EOL.

The sub-expression "(nulonly || 1)" always evaluates to true and
according to CVS logs seems to be just a left-over from some
debugging and introduced by accident.

Remove collate_range_cmp() stabilization, it conflicts with ranges

Replace various spellings with FALLTHROUGH which is lint()able

Obtained-from:  FreeBSD

17 years ago/usr/include/machine/physio_proc.h is no longer there.
Sascha Wildner [Sun, 7 Jan 2007 15:36:54 +0000 (15:36 +0000)]
/usr/include/machine/physio_proc.h is no longer there.

17 years agoOops, wrong year.
Sascha Wildner [Sun, 7 Jan 2007 11:26:56 +0000 (11:26 +0000)]
Oops, wrong year.

17 years agoUpdate ktr.9 for Matt's rewrite.
Sascha Wildner [Sun, 7 Jan 2007 11:25:12 +0000 (11:25 +0000)]
Update ktr.9 for Matt's rewrite.

17 years agoImplement nearly all the remaining items required to allow the virtual kernel
Matthew Dillon [Sun, 7 Jan 2007 08:37:37 +0000 (08:37 +0000)]
Implement nearly all the remaining items required to allow the virtual kernel
to actually execute code on behalf of a virtualized user process.  The
virtual kernel is now able to execute the init binary through to the point
where it sets up a TLS segment.

* Create a pseudo tf_trapno called T_SYSCALL80 to indicate system call traps.

* Add MD shims when creating or destroying a struct vmspace, allowing the
  virtual kernel to create and destroy real-kernel vmspaces along with.

  Add appropriate calls to vmspace_mmap() and vmspace_mcontrol() to map
  memory inside the user process vmspace.  The memory is mapped VPAGETABLE
  and the page table directory is set to point to the pmap page directory.

* Clean up user_trap, handle T_PAGEFLT properly.

* Implement go_user().  It calls vmspace_ctl(... VMSPACE_CTL_RUN) and
  user_trap() in a loop, allowing the virtual kernel to 'run' a user
  mode context under its control.

* Reduce VM_MAX_USER_ADDRESS to 0xb8000000 for now, until I figure out the
  best way to have the virtual kernel query the actual max user address from
  the real kernel.

* Correct a pm_pdirpte assignment.  We can't look up the PTE until after
  we have entered it into the kernel pmap.

17 years agoAdd the "wordexp" shell built-in command.
Peter Avalos [Sun, 7 Jan 2007 08:26:55 +0000 (08:26 +0000)]
Add the "wordexp" shell built-in command.

Obtained-from:  FreeBSD

17 years agoMake the vmspace_*() system call prototypes available to (virtual) kernel
Matthew Dillon [Sun, 7 Jan 2007 05:54:01 +0000 (05:54 +0000)]
Make the vmspace_*() system call prototypes available to (virtual) kernel
builds.

17 years agoSet rootdevnames[0] to automatically boot from ufs:vd0a when a root disk
Matthew Dillon [Sun, 7 Jan 2007 05:52:53 +0000 (05:52 +0000)]
Set rootdevnames[0] to automatically boot from ufs:vd0a when a root disk
image is specified.

17 years agoHandle page faults within the virtual kernel process itself (what would be
Matthew Dillon [Sun, 7 Jan 2007 05:45:06 +0000 (05:45 +0000)]
Handle page faults within the virtual kernel process itself (what would be
called kernel mode page faults in a real kernel).  Fortunately the system
trapframe is a subset of the ucontext supplied to userland signal function.

Since user vs kernel addresses and trap types cannot be discerned by looking
at the frame (because they are in entirely different VM spaces), separate
trap() into user_trap() and kern_trap().

Implement a poor-man's (really kludgy) version of copyin, copyout, and related
functions.

Implement and process T_PAGEFLT virtual kernel traps.  They work about 85% of
the time.

UFS is now able to mount the root filesystem.

17 years agoThe stack frame available from a signal to user mode stores the fault address
Matthew Dillon [Sun, 7 Jan 2007 05:41:02 +0000 (05:41 +0000)]
The stack frame available from a signal to user mode stores the fault address
in tf_err.  The PGEX bits that used to be stored in tf_err are lost.

When a process a virtual kernel (p->p_vkernel != NULL), store the PGEX bits
in the high 16 bits of the tf_trapno field so the virtual kernel can
figure out whether the page fault was a read fault or a write fault.

17 years agoremove extra crit_exit()
YONETANI Tomokazu [Sun, 7 Jan 2007 04:06:51 +0000 (04:06 +0000)]
remove extra crit_exit()

17 years agoSort by bltincmd and remove lines that have been commented out for years.
Peter Avalos [Sun, 7 Jan 2007 02:52:07 +0000 (02:52 +0000)]
Sort by bltincmd and remove lines that have been commented out for years.

17 years agoAdd support for a root disk device file.
Matthew Dillon [Sun, 7 Jan 2007 02:42:24 +0000 (02:42 +0000)]
Add support for a root disk device file.

Initialize the time of day.

17 years agoAdd a virtual disk device for virtual kernels to boot from.
Matthew Dillon [Sun, 7 Jan 2007 02:41:20 +0000 (02:41 +0000)]
Add a virtual disk device for virtual kernels to boot from.

17 years ago* Add documentation for KERNCONF and KERNCONFDIR.
Sascha Wildner [Sun, 7 Jan 2007 01:28:51 +0000 (01:28 +0000)]
* Add documentation for KERNCONF and KERNCONFDIR.

* Use .Ev for environment variables.

* Fix wording a bit.

17 years agoUse -s to flag POSIX's "special built-in" utilities in builtins.def. Add a
Peter Avalos [Sun, 7 Jan 2007 01:14:53 +0000 (01:14 +0000)]
Use -s to flag POSIX's "special built-in" utilities in builtins.def.  Add a
new member to struct builtincmd and set it to 1 if -s was specified.  This
is done because there are cases where special builtins must be treated
differently from other builtins.

Implement some of the differences between special built-ins and other builtins
demanded by POSIX.
- A redirection error is only fatal (meaning the execution of a shell script is
  terminated) for special built-ins.  Previously it was fatal for all shell
  builtins, causing problems like the one reported in FreeBSD PR 88845.
- Variable assignments remain in effect for special built-ins.
- Option or operand errors are only fatal for special built-ins.

Add the times builtin.  It reports the user and system time for the shell
itself and its children.  Instead of calling times() (as implied by POSIX) this
implementation directly calls getrusage() to get the times because this is more
convenient.

Print pointers with %p rather than casting them to long.

Replace home-grown dup2() implementation with actual dup2() calls.  This
should slightly reduce the number of system calls in critical portions of
the shell, and select a more efficient path through the fdalloc code.

Implement the PS4 variable which is defined by the POSIX User Portability
Utilities option.  Its value is printed at the beginning of the line if tracing
(-x) is active.  PS4 defaults to the string "+ " which is compatible with the
old behaviour to always print "+ ".

Don't crash on "<cmd> | { }".

Remove some white space at EOL.

Add the POSIX options -v and -V to the 'command' builtin.  Both describe the
type of their argument, if it is a shell function, an alias, a builtin, etc.
-V is more verbose than -v.

Do not assume there is only a space between #define and the macro name
when grepping for JOBS in mkbuiltins

Obtained-from:  FreeBSD

17 years agoUse itimers to implement the virtual kernel's SYSTIMER backend.
Matthew Dillon [Sun, 7 Jan 2007 00:44:33 +0000 (00:44 +0000)]
Use itimers to implement the virtual kernel's SYSTIMER backend.

17 years agoAllow certain cpufunc.h inlines to be overridden by virtual kernel builds.
Matthew Dillon [Sun, 7 Jan 2007 00:43:22 +0000 (00:43 +0000)]
Allow certain cpufunc.h inlines to be overridden by virtual kernel builds.

17 years agoMake libc prototypes available for kernel builds.
Matthew Dillon [Sun, 7 Jan 2007 00:42:55 +0000 (00:42 +0000)]
Make libc prototypes available for kernel builds.

17 years agodefine _KERNEL_VIRTUAL if not defined to hack-fix conflicts with normal
Matthew Dillon [Sun, 7 Jan 2007 00:42:26 +0000 (00:42 +0000)]
define _KERNEL_VIRTUAL if not defined to hack-fix conflicts with normal
include files.

17 years agoFix symbol conflict with falloc()
Matthew Dillon [Sun, 7 Jan 2007 00:41:29 +0000 (00:41 +0000)]
Fix symbol conflict with falloc()

17 years agoSignal handlers usually inherit %gs. Make them inherit %fs as well. This
Matthew Dillon [Sun, 7 Jan 2007 00:39:15 +0000 (00:39 +0000)]
Signal handlers usually inherit %gs.  Make them inherit %fs as well.  This
may or may not be a good idea but I am hard pressed to find a reason why
it would hurt anything.

The virtual kernel uses %gs for the libc TLS support, and %fs for its
globaldata base.

17 years agoFix compiler warnings
Matthew Dillon [Sun, 7 Jan 2007 00:02:17 +0000 (00:02 +0000)]
Fix compiler warnings

17 years agoFix a conflict with libc's killpg().
Matthew Dillon [Sun, 7 Jan 2007 00:02:03 +0000 (00:02 +0000)]
Fix a conflict with libc's killpg().

17 years agoAssign proc0 a dummy frame to bootstrap vm_fork().
Matthew Dillon [Sat, 6 Jan 2007 22:43:20 +0000 (22:43 +0000)]
Assign proc0 a dummy frame to bootstrap vm_fork().

17 years agoAdd a new procedure, vm_fault_page(), which does all actions related to
Matthew Dillon [Sat, 6 Jan 2007 22:35:47 +0000 (22:35 +0000)]
Add a new procedure, vm_fault_page(), which does all actions related to
faulting in a VM page given a vm_map and virtual address, include any
necessary I/O, but returns the held page instead of entering it into a pmap.

Use the new function in procfs_rwmem, allowing gdb to 'see' memory that
is governed by a virtual page table.

17 years agoIf no memory image file is specified, locate or create one by running
Matthew Dillon [Sat, 6 Jan 2007 19:57:01 +0000 (19:57 +0000)]
If no memory image file is specified, locate or create one by running
through available indices instead of using the PID.

Make sure the kernel page table is properly cleared since the image file may
be reused.