Commit Graph

571 Commits

Author SHA1 Message Date
Peter Wemm
b248bfe48d Turn off the single-user override. We've been running multi-user
for some time.  Having a machine boot unattended is useful. :-)
2001-10-23 11:04:43 +00:00
Doug Rabson
378749743c Add data serialisations after ptc and mov to rr[] instructions. 2001-10-23 10:20:04 +00:00
Mike Barcroft
3a72286480 Remove funky right justification.
Pointed out by:	bde
2001-10-23 00:42:15 +00:00
Doug Rabson
ab47b84778 In the signal trampoline, flush the register stack before calling
sigreturn. This appears to fix the last set of problems with csh.
2001-10-22 19:43:05 +00:00
David E. O'Brien
283da80631 Setup for a 200MB FS -- 209715200/512= 409600 sectors.
(DFR's latest ia64-root-*.tar.gz leaves only 7.7M avail when created by
dd if=/dev/zero of=ia64-root.fs bs=1024k count=200)
2001-10-22 07:33:38 +00:00
Dag-Erling Smørgrav
7c62990641 Move procfs_* from procfs_machdep.c into sys_process.c, and rename them to
proc_* in the process; procfs_machdep.c is no longer needed.

Run-tested on i386, build-tested on Alpha, untested on other platforms.
2001-10-21 23:57:24 +00:00
Dag-Erling Smørgrav
1f04261973 [partially forced commit due to pilot error in earlier commit attempt]
{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
one yet.

Run-tested on i386, build-tested on Alpha, untested on other platforms.
2001-10-21 22:16:48 +00:00
Dag-Erling Smørgrav
ef394d81ad {set,fill}_{,fp,db}regs() fixup:
- Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
{set,fill}_{,fp,db}regs() fixup:

 - Add dummy {set,fill}_dbregs() on architectures that don't have them.

 - KSEfy the powerpc versions (struct proc -> struct thread).

 - Some architectures had the prototypes in md_var.h, some in reg.h, and
   some in both; for consistency, move them to reg.h on all platforms.

These functions aren't really MD (the implementation is MD, but the interface
is MI), so they should move to an MI header, but I haven't figured out which
one yet.

Run-tested on i386, build-tested on Alpha, untested on other platforms.
2001-10-21 22:14:00 +00:00
Doug Rabson
eedecb60e8 Add some more names for bits of trapframe. 2001-10-21 14:03:58 +00:00
Doug Rabson
c623bf3471 We need to save a bit more information in the partial syscall trapframe
in case we need to take a signal.
2001-10-21 14:03:25 +00:00
Doug Rabson
3b51c8566c Set ar.fpsr to something sane before trying to handle a trap - the user
might have trashed it.
2001-10-21 14:02:27 +00:00
Doug Rabson
54e594762b Use ia64_set_fpsr() instead of __asm to set ar.fpsr. 2001-10-21 14:01:48 +00:00
Doug Rabson
f85321667c Add ia64_set_fpsr(). 2001-10-21 14:00:59 +00:00
Marcel Moolenaar
cf1a20ea71 Implement the IPI send functions. No mapping between IPI message
Id and interrupt vector has been made yet.
2001-10-21 08:57:02 +00:00
Marcel Moolenaar
2791ddeb6c Add define for the PIB default address and include a reference to
the SDM.
2001-10-21 05:52:54 +00:00
Matt Jacob
8c7c272c5a Remove wx. 2001-10-20 18:50:31 +00:00
Doug Rabson
2baea57020 Reserve space for signal state. 2001-10-20 15:19:43 +00:00
Marcel Moolenaar
3824d75af1 Save the AP wake-up vector from the SAL descriptor under SMP.
Note that the descriptor is optional. Add a comment to indicate
that we want to register the OS_BOOT_RENDEZ here as well.
2001-10-20 03:39:55 +00:00
Marcel Moolenaar
5b8c64dd2c Make this compile under option SMP. 2001-10-20 03:33:07 +00:00
Doug Rabson
76f7435e6e Make a start at an unaligned trap handler. Only integer loads and stores
are handled so far.
2001-10-19 22:23:51 +00:00
Doug Rabson
c33287f969 Translate various userland traps into SIGBUS (instead of just panicing). 2001-10-19 20:46:12 +00:00
Ruslan Ermilov
8c93e71e33 Try two on the preprocessing logic.
Reviewed by:	obrien
2001-10-19 20:06:23 +00:00
John Baldwin
e37d2a8c82 Remove unneeded sys/mutex.h includes. 2001-10-19 19:23:32 +00:00
David E. O'Brien
4b16cf4f8a Blah, fix braino where ru had to remind me of proper preprocessor syntax.
Bad fingers, no cookie.
2001-10-19 19:17:11 +00:00
Doug Rabson
5577bd2bca Rework pmap so that it separates the PTE structure from the pv_entry
structure. This makes it possible to pre-allocate PTEs for the kernel,
which is necessary for a reliable implementation of pmap_kenter(). This
also avoids wasting space (about 48 bytes per page) for kernel mappings
and user mappings of memory-mapped devices.

This also fixes a bug with the previous version where the implementation
required the pv_entry structure to be physically contiguous but did not
enforce this (the structure size was not a power of two). This meant
that the pv_entry free list was quickly corrupted as soon as the system
was even mildly loaded.
2001-10-19 09:47:02 +00:00
Doug Rabson
ef826b3ca8 Shift the code which packs and unpacks instruction bundles out of DDB
since it is useful for various emulations duties (e.g. unaligned trap
handling).
2001-10-18 16:20:04 +00:00
Marcel Moolenaar
acddfcf3a2 Fix typos in previous commit:
o  s/sys_narg/sy_narg/
o  s/SYS_MPSAFE/SYF_MPSAFE/
2001-10-18 05:21:52 +00:00
David E. O'Brien
4a3391b5a1 Add support for "__gnuc_va_list". Some overly "smart" libraries assume
the existence of the __gnuc_va_list type[*] because our compiler is GCC.

[*] __gnuc_va_list is defined in the GCC ginclude/stdarg.h replacement
headerwhich we don't use.
2001-10-18 00:27:39 +00:00
John Baldwin
05724cdd08 - Small cleanups to the Giant handling in trap().
- Only release Giant in trap() if we locked it, otherwise we could release
  Giant in a kernel trap if we didn't get it for a page fault and the
  previous frame had grabbed the lock.
- Only get Giant for !MP safe syscalls.
2001-10-17 22:04:45 +00:00
Matt Jacob
aaeac4f6c3 Make SCSI changer and SES devices standard in generic kernels.
Reviewed by:	ken@kdm.org
2001-10-16 22:22:58 +00:00
Doug Rabson
ebc26de418 Size the number of pv_entries we use to bootstrap the pv_entry allocator
based on the size of physical memory. This should eliminate the tweaking
needed for larger memory configurations.
2001-10-16 08:03:16 +00:00
Marcel Moolenaar
dea969f79f When compiling with SKI support, create the fake memory regions
when either the memory descriptor in the bootinfo is NULL or
the descriptor count is 0.
2001-10-15 07:58:27 +00:00
Doug Rabson
3b7ddc3170 Only the first eight arguments can possibly be in stacked registers. 2001-10-13 08:06:20 +00:00
Doug Rabson
cc6fae1156 Pass the correct trapframe pointer to fork_exit - sp is trapframe-16. 2001-10-12 11:50:09 +00:00
Doug Rabson
5b341f5baf If the faulting instruction is a cmpxchg, then isr.w and isr.r will both
be set. We need to check isr.w before isr.r so that we can correctly
handle a cmpxchg to a copy-on-write page.

This fixes the hang-after-fork problem for dynamically linked programs.
2001-10-12 11:49:11 +00:00
Doug Rabson
47806f084a Implement MCOUNT hook for assembler. Probably doesn't work right. 2001-10-11 13:35:31 +00:00
Doug Rabson
b4cc6db2df Implement mcount trampoline (untested). 2001-10-11 13:31:55 +00:00
Doug Rabson
f334c8bff7 * Change the calling convention for execve so that it conforms to normal
C calling conventions. This allows crt1.c to be written nearly without
  any inline assembler.
* Initialise cpu_model[] so that the hw.model sysctl works properly.
2001-10-11 12:31:50 +00:00
Paul Saab
cbc89bfbfe Make MAXTSIZ, DFLDSIZ, MAXDSIZ, DFLSSIZ, MAXSSIZ, SGROWSIZ loader
tunable.

Reviewed by:	peter
MFC after:	2 weeks
2001-10-10 23:06:54 +00:00
Doug Rabson
d91b6696b7 Add a definition for the ia64's special PLT_RESERVE entry in the _DYNAMIC
section.
2001-10-10 09:00:27 +00:00
Doug Rabson
7e3e8e556f Clarify a comment.
Requested by: jhb
2001-10-09 19:50:29 +00:00
Doug Rabson
f53482978c Don't include isavar.h - we don't need it. 2001-10-09 10:24:37 +00:00
Doug Rabson
ac0a5b09e0 Add a minimalist kernel config which can run inside SKI. 2001-10-09 10:14:06 +00:00
Doug Rabson
a3490d55d1 Make printtrap() more informative. 2001-10-08 20:21:04 +00:00
Doug Rabson
e4ef1eb797 Implement inline versions of ntohl etc. 2001-10-07 21:09:35 +00:00
Dag-Erling Smørgrav
3da3249106 Dissociate ptrace from procfs.
Until now, the ptrace syscall was implemented as a wrapper that called
various functions in procfs depending on which ptrace operation was
requested.  Most of these functions were themselves wrappers around
procfs_{read,write}_{,db,fp}regs(), with only some extra error checks,
which weren't necessary in the ptrace case anyway.

This commit moves procfs_rwmem() from procfs_mem.c into sys_process.c
(renaming it to proc_rwmem() in the process), and implements ptrace()
directly in terms of procfs_{read,write}_{,db,fp}regs() instead of
having it fake up a struct uio and then call procfs_do{,db,fp}regs().

It also moves the prototypes for procfs_{read,write}_{,db,fp}regs()
and proc_rwmem() from proc.h to ptrace.h, and marks all procfs files
except procfs_machdep.c as "optional procfs" instead of "standard".
2001-10-07 20:08:42 +00:00
Doug Rabson
e0e2fed358 * Use srlz.i to serialise changes to psr.ic
* Don't enable psr.i at the same time as psr.dt and psr.ic

These changes improve stability considerably.
2001-10-07 18:40:01 +00:00
Doug Rabson
ca11f4e176 Remove bogus include. 2001-10-07 14:20:01 +00:00
Doug Rabson
e2676403d8 Move console probes until after we set boothowto so that 'boot -h' works. 2001-10-06 16:06:48 +00:00
Doug Rabson
d0ad824d68 Assume round-to-nearest mode for floating point. 2001-10-06 15:57:22 +00:00
Doug Rabson
300634ffe0 Delete legacy pcib code - we can't possibly work without acpi on ia64. 2001-10-06 10:09:57 +00:00
Marcel Moolenaar
18819cbb5c o Change ia64_memory_address to explicitly take a u_int64_t
o  Add memcpy_fromio, memcpy_io, memcpy_toio, memset_io,
   memsetw and memsetw_io. I'm not sure this is the right
   place for it, though.
2001-10-06 09:31:43 +00:00
Doug Rabson
f1c1087a06 Add BOOTP support. 2001-10-05 19:03:01 +00:00
Doug Rabson
734047dd77 Fix some dependency violations (don't know why gas didn't catch this). 2001-10-05 19:02:21 +00:00
Doug Rabson
bff497f753 Use physical addresses, not virtual addresses when calling PHYS_TO_VM_PAGE. 2001-10-05 19:00:03 +00:00
Doug Rabson
8540504bac Eliminate some alpha craziness. 2001-10-05 18:59:02 +00:00
Doug Rabson
9e9ce1b861 In in_cksumdata, len must be a signed type. 2001-10-05 18:58:22 +00:00
Doug Rabson
34c5f03685 Low-level code for programming the I/O SAPIC. 2001-10-05 10:35:42 +00:00
Doug Rabson
7a7029581c Wire up most of the interrupt handling infrastructure. Not sure it works
right yet but its enough for the ATA probe to work. The SCSI probes which
follow are broken though.
2001-10-05 10:30:09 +00:00
Doug Rabson
ae0d75fe5f Fix typo which meant that we never actually found the ACPI 2.0 table. 2001-10-05 10:29:03 +00:00
Doug Rabson
c3a9c0057f Disable interrupts when we are in DDB. 2001-10-05 08:23:08 +00:00
Doug Rabson
c7521efc59 Add ia64_get_lid(). 2001-10-05 08:20:41 +00:00
Doug Rabson
02c76ceb97 Don't pretend the argument to clockattach is a device - it isn't. 2001-10-04 15:28:27 +00:00
Doug Rabson
a14927b550 * Don't pretend the object passed to clockattach is a device - it isn't.
* Declare itc_frequency properly.
2001-10-04 15:27:35 +00:00
Doug Rabson
377fa66e5e Use EFI (or some reasonable simulation) to read the RTC. 2001-10-04 15:26:05 +00:00
Doug Rabson
94d5f4bfd2 Fake the EFI runtime call GetTime. 2001-10-04 15:24:52 +00:00
Doug Rabson
1676303c5c Add low-level ACPI support code and make a start on parsing the ACPI
interrupt information.
2001-10-04 08:45:19 +00:00
Doug Rabson
712bc4a99a The encoding for the bus being passed to SAL was completely wrong. 2001-10-03 08:25:58 +00:00
Matt Jacob
22883e3c68 Fix problem where a user buffer outside of the area being tested
will be corrupted.

PR:		29194
Obtained from:	Tor.Egge@fast.no
MFC after:	2 weeks
2001-10-02 18:34:20 +00:00
Marcel Moolenaar
6b207c0e90 Remove redundant and misplaced "options DDB" line. 2001-10-02 06:18:23 +00:00
Doug Rabson
89dbc365be Support for SKI is now an option. 2001-09-29 11:45:33 +00:00
Doug Rabson
47d032e595 Make sio0 a console device. 2001-09-29 11:45:07 +00:00
Doug Rabson
f17bd83f5f Add a couple of arguments to ia64_init. I'll use them later to improve
the method of passing bootinfo from the loader.
2001-09-29 11:44:35 +00:00
Doug Rabson
cf1a145b08 Various changes to use the firmware on a real machine. 2001-09-29 11:43:37 +00:00
Doug Rabson
940bcd77bd * Read parameters for ptc.e instruction from PAL Code.
* Add pmap_unmapdev().
2001-09-29 11:41:23 +00:00
Doug Rabson
3ebae4bf00 Fake PAL Code for SKI. 2001-09-29 11:40:32 +00:00
Doug Rabson
625768e4a0 Start hooking up devices. 2001-09-29 11:11:18 +00:00
Doug Rabson
9a6f25fd59 Add pmap_unmapdev(). 2001-09-29 11:02:06 +00:00
Doug Rabson
ddead4655a Fill out the firmware interfaces somewhat. 2001-09-29 11:01:24 +00:00
Doug Rabson
63e057656e Add code to initialise firmware resources (and to fake them if we are
running in simulation).
2001-09-29 11:00:24 +00:00
Doug Rabson
965c805d64 Add shims for calling PAL Code in physical mode. 2001-09-29 10:59:07 +00:00
Doug Rabson
a3c9f0dc11 Add some move definitions. 2001-09-29 10:24:09 +00:00
Doug Rabson
ee82e0d5f8 Call cpu_boot from cpu_reset. 2001-09-29 10:23:21 +00:00
Doug Rabson
f184b2654b Give up on the backtrace if the calculated pc isn't in region 7. 2001-09-29 10:22:57 +00:00
Doug Rabson
3cf08d5025 Use PAGE_SHIFT instead of a hardcoded constant for log2(PAGE_SIZE). 2001-09-29 09:55:30 +00:00
Doug Rabson
27272270e8 * Preserve ar.rsc in ia64_change_mode.
* Convert sp to/from physical in ia64_change_mode.
* Add a shim for calling EFI procedures in virtual mode.
2001-09-29 09:54:42 +00:00
Doug Rabson
0e671be22e Change END(locorestart) to END(__start). 2001-09-29 09:53:38 +00:00
Robert Watson
b9c6f21493 o Modify the access control checks for the ia64 /dev/mem (and friends)
to use securelevel_gt() instead of direct variable checks.

Obtained from:	TrustedBSD Project
2001-09-26 20:24:23 +00:00
Doug Rabson
fa129a40db Tidy up and fix a runtime warning. 2001-09-26 16:15:20 +00:00
Brooks Davis
2f65332817 The faith(4) device is no longer a count device so don't specify a count. 2001-09-25 18:56:40 +00:00
Doug Rabson
3dc2c2d530 Use b6 instead of b1 - b1 is supposed to be preserved and b6 is scratch. 2001-09-24 22:50:20 +00:00
Doug Rabson
f8c1540f3d Make the Alternate {I,D} TLB vector code actually work for virtual
addresses greater than 256M (the page size for region 6 and 7).
2001-09-24 22:49:20 +00:00
Doug Rabson
588154e27b Don't try to access external files from SKI unless we are actually running
in SKI.
2001-09-24 20:01:29 +00:00
Doug Rabson
40aef04652 Increase the number of bootstrap PVs. 2001-09-24 20:00:20 +00:00
Doug Rabson
9324a7e743 Include <machine/pte.h> instead of <machine/pmap.h> 2001-09-24 19:58:15 +00:00
Doug Rabson
32956c3d49 We need different call stubs for static and stacked calling conventions. 2001-09-24 19:41:16 +00:00
Doug Rabson
378482865e Factor out PTE and related definitions from pmap.h - they are useful in
the loader.
2001-09-24 19:27:38 +00:00
Doug Rabson
cdb0e1b453 Fix a few comment typos from the last commit. 2001-09-24 17:38:58 +00:00
Doug Rabson
a7f1f8b902 Add some code which can be used to change to/from physical mode when
calling various firmware functions.
2001-09-24 17:07:23 +00:00
David E. O'Brien
090905a55c + Fix misplacement of `txp'
+ Document our -CURRENT debugging bits
2001-09-24 03:23:48 +00:00
Doug Rabson
3995e0ebca Add definitions of SAL System Table. 2001-09-23 10:26:20 +00:00
Doug Rabson
568c95f6ca Don't activate the ssc console unless we are running in SKI. 2001-09-22 19:52:02 +00:00
Doug Rabson
23a7118905 Add implementations of readx() and writex(). 2001-09-22 19:51:18 +00:00
Doug Rabson
137fd2af89 Add declaration of ia64_running_in_simulator(). 2001-09-22 19:50:54 +00:00
Doug Rabson
b73ef645ae * Turn off memory descriptor debugging - its served its purpose.
* Don't get confused when memory regions don't lie on page boundaries -
  remember our page size is typically larger than the firmware's page size.
* Add a function ia64_running_in_simulator() which is intended to detect
  whether the kernel is running in SKI or on real hardware.
2001-09-22 19:50:12 +00:00
Doug Rabson
0d1943c9e3 Remove a redundant stop. 2001-09-22 19:46:41 +00:00
Doug Rabson
2290da8ce5 Fix a warning and make sure we flush the cache after writing an
instruction bundle otherwise the CPU won't see the changed bundle.
2001-09-21 10:10:15 +00:00
Doug Rabson
85d6f9f7d3 Add ia64_fc(). 2001-09-21 10:09:27 +00:00
Doug Rabson
4ef1beb1ea If two @fptr relocations refer to the same symbol, use the same fptr
structure to resolve them. This is necessary to allow code to compare
function pointers.
2001-09-20 16:32:54 +00:00
Doug Rabson
0fda7b2b10 Don't clear the single-step bit after a trap - leave it up to the
debugger. The code was broken anyway - it clear every bit *except* the
single-step bit (oops).
2001-09-20 16:30:48 +00:00
Doug Rabson
1e59a2270d The second instruction in an MLX bundle is slot one, not slot two, even
though the actual opcode is stored in the value in slot two.
2001-09-20 16:29:30 +00:00
Doug Rabson
fea451577e Tidy. 2001-09-20 15:03:28 +00:00
Doug Rabson
3890444abd Don't include NFS headers. I have no idea why they were here in the first
place - NFS has no assembler in it.
2001-09-20 11:02:18 +00:00
Peter Wemm
55f25b39e9 Replicate a change from alpha/genassym.c to other arches. This should
fix nfs-related build breakage.
2001-09-20 02:49:59 +00:00
Peter Wemm
eb25edbda3 Cleanup and split of nfs client and server code.
This builds on the top of several repo-copies.
2001-09-18 23:32:09 +00:00
John Baldwin
fdca1cb1ef Whitespace fixes. 2001-09-18 21:52:15 +00:00
John Baldwin
fd54558a83 - If we ever do the per-cpu KTR stuff, the index won't be volatile as it
will be private to each CPU.
- Re-style(9) the globaldata structures.  There really needs to be a MI
  struct pcpu that has a MD struct mdpcpu member at some point.
2001-09-18 21:46:26 +00:00
Doug Rabson
a5e2a508c7 Add ia64_get_cpuid(). 2001-09-18 15:21:18 +00:00
Doug Rabson
f0e4f240e7 Flesh out identifycpu(). 2001-09-18 13:26:30 +00:00
Doug Rabson
a1fdf50c01 Rearrange so we search for I/O port space as early as possible (i.e.
before console probing). Also fix a confusion between EFI's page size
which is fixed at 4096 and our own page size which is variable at compile
time.
2001-09-15 18:31:49 +00:00
Doug Rabson
56f6eed759 Avoid the region used for thread0's trapframe when setting up the stack
for ia64_init. If we use this area for ia64_init's stack, it ends up
containing garbage which causes cpu_fork to die horribly later.
2001-09-15 18:23:51 +00:00
Doug Rabson
f544a5b837 Use the MI console code to initialise the console. 2001-09-15 15:31:59 +00:00
Doug Rabson
91a8883e5b Implement inx() and outx() functions for accessing I/O ports. 2001-09-15 12:30:56 +00:00
Doug Rabson
749520911b Add ia64_mf_a() which executes an mf.a instruction. 2001-09-15 12:30:19 +00:00
Doug Rabson
3e59bb90d6 * Use Intel's EFI headers instead of home-grown ones.
* Use the bootinfo's memory map if present instead of hard-coding SKI's
  memory map.
* Record the location of the I/O Port Space if present in the memory map.
2001-09-15 12:29:46 +00:00
Doug Rabson
3a0b4f259c Fill out some gaps in ia64 DDB support. This involves generalising DDB's
breakpoint handling slightly to cope with the fact that ia64 instructions
are not located on byte boundaries.
2001-09-15 11:06:07 +00:00
Doug Rabson
3a1c20e821 Sync the PCI NIC sections with i386. 2001-09-15 09:09:13 +00:00
Doug Rabson
0b02d706db * Enable dynamically linked kernel. This involves adding a self-relocator
to locore to process the @fptr relocations in the dynamic executable.
* Don't initialise the timer until *after* we install the timecounter to
  avoid a race between timecounter initialisation and hardclock.
* Tidy up bootinfo somewhat including adding sanity checks for when the
  kernel is loaded without a recognisable bootinfo.
2001-09-13 12:39:15 +00:00
Julian Elischer
b40ce4165d KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after:    ha ha ha ha
2001-09-12 08:38:13 +00:00
Marcel Moolenaar
68a7335b3f o Fix struct ssc_time and enable the SSC call to get the RTC.
o  Print a message that the TODR is not set in sscclock_set.
2001-09-12 03:31:26 +00:00
Doug Rabson
e763b778c8 * Make a start on a realistic definition for bootinfo.
* Switch to proc0's stack and backing store before calling ia64_init
  so that we don't rely on the loader's stack at all.
* Change kernel entry point name from locorestart to __start.
2001-09-10 13:40:00 +00:00
Peter Wemm
eb30c1c0b9 Rip some well duplicated code out of cpu_wait() and cpu_exit() and move
it to the MI area.  KSE touched cpu_wait() which had the same change
replicated five ways for each platform.  Now it can just do it once.
The only MD parts seemed to be dealing with fpu state cleanup and things
like vm86 cleanup on x86.  The rest was identical.

XXX: ia64 and powerpc did not have cpu_throw(), so I've put a functional
stub in place.

Reviewed by:	jake, tmm, dillon
2001-09-10 04:28:58 +00:00
Peter Wemm
660c5377fd Missing part of dillon's coredump commit. cpu_coredump() was still
passing IO_NODELOCKED to vn_rdwr(), this would cause operations on the
unlocked core vnode and softupdates nastiness if an a.out binary cored.
2001-09-08 22:18:58 +00:00
Doug Rabson
d452f533f7 Add options to select between 4k, 8k and 16k page sizes on ia64. The
default is now 8k.
2001-09-07 11:03:39 +00:00
Doug Rabson
b68657dd33 Typo in comment. 2001-09-07 11:01:39 +00:00
Doug Rabson
4411cf6e7d * Track ref/mod information properly when a mapping changes.
* Fix a panic in pmap_remove() for a non-current pmap.
2001-09-07 11:00:21 +00:00
Doug Rabson
9735f1281a Remove old setjmp/longjmp stubs. 2001-09-07 10:59:05 +00:00
John Baldwin
df53e91c18 Call sendsig() with the proc lock held and return with it held. 2001-09-06 22:20:41 +00:00
Doug Rabson
4ce0b9f86d Add struct tags to avoid warnings in kernel code. 2001-09-06 18:11:16 +00:00
David E. O'Brien
1792335469 style(9) the structure definitions. 2001-09-05 01:36:46 +00:00
Peter Wemm
b53f9c45f9 Nuke #if 0'ed "setredzone()" stub. We never used it, and probably
never will.  I've implemented an optional redzone as part of the KSE
upage breakup.
2001-09-04 08:36:46 +00:00
Doug Rabson
093a61588e Add a working version of setjmp/longjmp.
Obtained from: Intel's EFI toolkit.
2001-09-03 13:54:50 +00:00
Peter Wemm
05a806502b Since we're cross compiling from x86, ignore the x86 CPUTYPE by default. 2001-09-03 07:58:32 +00:00
Peter Wemm
d73178aea8 Dont conflict with sysctl debug.mddebug 2001-09-03 04:49:19 +00:00
Peter Wemm
02de199140 Sync with i386 / alpha. Whitespace unindent / style prep for kse. 2001-09-02 10:07:09 +00:00
Peter Wemm
494e7e3923 Merge from i386: various cleanups including moving the map calculations
to MI code.  This gets ia64 to compile again.
2001-09-02 07:47:47 +00:00
Peter Wemm
5a4b540da0 Same as i386/i386/pmap.c: clean up some style. This is irrelevant since
it is inside #if 0'ed code, but it would be a shame if this stuff got
cut/pasted elsewhere.
2001-08-31 06:25:28 +00:00
Mike Barcroft
03516cfeb0 o Remove some GCCisms in src/powerpc/include/endian.h.
o Unify <machine/endian.h>'s across all architectures.
o Make bswapXX() functions use a different spelling of u_int16_t and
  friends to reduce namespace pollution.  The bswapXX() functions
  don't actually exist, but we'll probably import these at some
  point.  Atleast one driver (if_de) depends on bswapXX() for big
  endian cases.
o Deprecate byteorder(3) prototypes from <sys/types.h>, these are
  now prototyped indirectly in <arpa/inet.h>.
o Deprecate in_addr_t and in_port_t typedefs in <sys/types.h>, these
  are now typedef'd in <arpa/inet.h>.
o Change byteorder(3) prototypes to use standards compliant uint32_t
  (spelled __uint32_t to reduce namespace pollution).
o Document new preferred headers and standards compliance.

Discussed with:	bde
PR:		29946
Reviewed by:	bmilekic
2001-08-30 00:04:19 +00:00
Peter Wemm
76cb0cadf1 Enable hardwiring of things like tunables from embedded enironments
that do not start from loader(8).
2001-08-27 05:11:53 +00:00
Peter Wemm
547a9e66fd vm_page_zero_idle() is no longer MD. 2001-08-25 04:54:25 +00:00
Peter Wemm
95a6562598 Strip out some #if's for old implementations of global data pointers. 2001-08-21 22:14:13 +00:00
Peter Wemm
e8ebc08f80 Make COMPAT_43 optional again. XXX we need COMPAT_FBSD3 etc for this
stuff.
2001-08-21 02:32:59 +00:00
David E. O'Brien
589278dbae style(9) and make consistent across platforms 2001-08-16 09:29:35 +00:00
Andrey A. Chernov
2a54e09dff OFF_T -> OFF (more standard style) 2001-08-15 19:50:59 +00:00
Andrey A. Chernov
a6314641a4 Add OFF_T_MAX/OFF_T_MIN 2001-08-15 19:25:08 +00:00
David E. O'Brien
059d1e91d8 Style changes to commonize the various platforms. 2001-08-15 04:02:41 +00:00
John Baldwin
688ebe120c - Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel.  The ast() function now loops as long
  as the PS_ASTPENDING or PS_NEEDRESCHED flags are set.  It returns with
  preemption disabled so that any further AST's that arrive via an
  interrupt will be delayed until the low-level MD code returns to user
  mode.
- Use u_int's to store the tick counts for profiling purposes so that we
  do not need sched_lock just to read p_sticks.  This also closes a
  problem where the call to addupc_task() could screw up the arithmetic
  due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
  clear_resched(), and resched_wanted() in favor of direct bit operations
  on p_sflag.
- Fix up locking with sched_lock some.  In addupc_intr(), use sched_lock
  to ensure pr_addr and pr_ticks are updated atomically with setting
  PS_OWEUPC.  In ast() we clear pr_ticks atomically with clearing
  PS_OWEUPC.  We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.

Reviewed by:	bde (mostly)
2001-08-10 22:53:32 +00:00
Peter Wemm
2aca0c28d3 Zap 'ptrace(PT_READ_U, ...)' and 'ptrace(PT_WRITE_U, ...)' since they
are a really nasty interface that should have been killed long ago
when 'ptrace(PT_[SG]ETREGS' etc came along.  The entity that they
operate on (struct user) will not be around much longer since it
is part-per-process and part-per-thread in a post-KSE world.

gdb does not actually use this except for the obscure 'info udot'
command which does a hexdump of as much of the child's 'struct user'
as it can get.  It carries its own #defines so it doesn't break
compiles.
2001-08-08 05:25:15 +00:00
John Baldwin
5ebe32c611 Grab Giant arond page faults. ia64 boots again in the simulator now. 2001-08-07 17:31:42 +00:00
Doug Rabson
2f6fec30cf Make this compile again. 2001-08-06 12:52:55 +00:00
Doug Rabson
da572e14d4 Remove usage of nonexistent vm_mtx. 2001-08-06 12:52:17 +00:00
John Baldwin
4ce050bf39 GC some obsolete alpha code. 2001-07-31 14:35:36 +00:00
Jake Burkholder
7e5102989e Use a machine dependent type, Elf_Hashelt, for the elements of the elf
dynamic symbol table buckets and chains.  The sparc64 toolchain uses 32
bit .hash entries, unlike other 64 bits architectures (alpha), which use
64 bit entries.

Discussed with: dfr, jdp
2001-07-31 03:46:39 +00:00
Peter Wemm
0b27d7104f Make PMAP_SHPGPERPROC tunable. One shouldn't need to recompile a kernel
for this, since it is easy to run into with large systems with lots of
shared mmap space.

Obtained from:	yahoo
2001-07-27 01:08:59 +00:00
Peter Wemm
bd40659f85 Call the early tunable setup functions as soon as kern_envp is available.
Some things depend on hz being set not long after this.
2001-07-26 23:06:44 +00:00
Bosko Milekic
49f854f926 - Do not handle the per-CPU containers in mbuf code as though the cpuids
were indices in a dense array. The cpuids are a sparse set and treat
  them as such, setting up containers only for CPUs activated during
  mb_init().

- Fix netstat(1) and systat(1) to treat the per-CPU stats area as a sparse
  map, in accordance with the above.

This allows us to properly boot with certain CPUs disactivated. However, if
we later decide to re-activate said CPUs, we will barf until we decide to
implement CPU spinon/spinoff callback hooks to allow for said CPUs' per-CPU
containers to get configured on their activation.

Reported by: mjacob
Partially (sys/ diffs) Submitted by: mjacob
2001-07-26 18:47:46 +00:00
Brian S. Dean
17bbfb5897 Add 'hwatch' and 'dhwatch' ddb commands analogous to 'watch' and
'dwatch'.  The new commands install hardware watchpoints if supported
by the architecture and if there are enough registers to cover the
desired memory area.

No objection by: audit@, hackers@

MFC after: 2 weeks
2001-07-11 03:15:25 +00:00
Julian Elischer
0b1ae8097d A set of changes to reduce the number of include files the kernel
takes from /usr/include. I cannot check them on alpha.. (will try beast)

Briefly looked at by: Warner Losh <imp@harmony.village.org>
2001-07-08 04:56:07 +00:00
Matthew Dillon
7197571105 Move vm_page_zero_idle() from machine-dependant sections to a
machine-independant source file, vm/vm_zeroidle.c.  It was exactly the
same for all platforms and updating them all was getting annoying.
2001-07-05 01:32:42 +00:00
Matthew Dillon
6d03d577a5 Reorg vm_page.c into vm_page.c, vm_pageq.c, and vm_contig.c (for contigmalloc).
Also removed some spl's and added some VM mutexes, but they are not actually
used yet, so this commit does not really make any operational changes
to the system.

vm_page.c relates to vm_page_t manipulation, including high level deactivation,
activation, etc...  vm_pageq.c relates to finding free pages and aquiring
exclusive access to a page queue (exclusivity part not yet implemented).
And the world still builds... :-)
2001-07-04 23:27:09 +00:00
Matthew Dillon
0cddd8f023 With Alfred's permission, remove vm_mtx in favor of a fine-grained approach
(this commit is just the first stage).  Also add various GIANT_ macros to
formalize the removal of Giant, making it easy to test in a more piecemeal
fashion. These macros will allow us to test fine-grained locks to a degree
before removing Giant, and also after, and to remove Giant in a piecemeal
fashion via sysctl's on those subsystems which the authors believe can
operate without Giant.
2001-07-04 16:20:28 +00:00
John Baldwin
d2a5bcc3d3 Allow Giant to be recursed when a process terminates. 2001-07-03 05:09:48 +00:00
Brooks Davis
53dab5fe7b gif(4) and stf(4) modernization:
- Remove gif dependencies from stf.
 - Make gif and stf into modules
 - Make gif cloneable.

PR:		kern/27983
Reviewed by:	ru, ume
Obtained from:	NetBSD
MFC after:	1 week
2001-07-02 21:02:09 +00:00
Warner Losh
1f94b9005c Don't need the .keep_me files. Obrien and I committed past each other.
Add 0-9 to the list of possible kernel names at matsushita-san's
suggestion.

Submitted by: Makoto MATSUSHITA-san <matusita@jp.FreeBSD.org>
2001-07-01 23:35:44 +00:00
David E. O'Brien
5e6ded4212 Ensure sys/${MACHINE}/compile/FOO exists
Reviewed by: arch, imp, peter, and the USENIX terminal room secret kernel cabal
2001-06-30 15:16:29 +00:00
Warner Losh
e1d0d8a941 Really do proper keepme files in the compile directories. Use
.cvsignore file for [A-Za-z]* to keep these directories around rather
than waste a file on .keepme.  This should also make people's built
trees place nice with CVS.

Idea for .cvsignore: peter (although I suggested the regexp)
Pointed out by: Makoto MATSUSHITA-san <matusita@jp.FreeBSD.org>
Llama's costuming by: Fernamdo Llamas
2001-06-30 14:38:32 +00:00
David E. O'Brien
791eca5f7b Ensure sys/${MACHINE}/compile/FOO exists
Reviewed by: arch, imp, peter and
  the USENIX terminal room secret kernel cabal
2001-06-30 07:12:34 +00:00
Warner Losh
1b0a8621e6 Repo copy i8237.h to dev/ic so we can get rid of some of the final vestiges
of includes of i386 files from non-i386 ports.
2001-06-30 05:29:11 +00:00
John Baldwin
7aa7260e4a Move ast() and userret() to sys/kern/subr_trap.c now that they are MI. 2001-06-29 19:51:37 +00:00
John Baldwin
6be523bca7 Add a new MI pointer to the process' trapframe p_frame instead of using
various differently named pointers buried under p_md.

Reviewed by:	jake (in principle)
2001-06-29 11:10:41 +00:00
John Baldwin
8b2cea330f Catch up to mbuf allocator changes from last September so this compiles
again.
2001-06-27 14:57:17 +00:00
John Baldwin
b49a082a33 Make this compile again. Broken since June 1. 2001-06-27 14:46:44 +00:00
John Baldwin
5ae10ded6e Fix cut-n-paste brain-o.
Pointy-hat to:	me
2001-06-25 16:38:09 +00:00
John Baldwin
06c836bbca - Grab the proc lock around CURSIG and postsig(). Don't release the proc
lock until after grabbing the sched_lock to avoid CURSIG racing with
  psignal.
- Don't grab Giant for addupc_task() as it isn't needed.

Reported by:	tegge (signal race), bde (addupc_task a while back)
2001-06-22 23:05:11 +00:00
Peter Wemm
e634a8c804 oops. prepare_usermode() died in August 2000 in the MI and x86 code.
Issue raised by:	scottl
2001-06-15 09:59:27 +00:00
David E. O'Brien
f9b58b41a3 Fix style of defines. 2001-06-09 05:21:17 +00:00
Joerg Wunsch
e774b25111 Nuke the various poorly maintained copies of ioctl_fd.h. The file is
not machine-dependant, thus it has been moved out (repo-copied) into
<sys/fdcio.h>.
2001-06-06 06:15:03 +00:00
John Baldwin
262c9f8a3b Don't hold sched_lock across addupc_task().
Reported by:	David Taylor <davidt@yadt.co.uk>
Submitted by:	bde
2001-06-06 00:57:24 +00:00
Poul-Henning Kamp
0d31cbfab7 Properly wrap mtx_intr_enable() macro in "do $bla while (0)" 2001-06-02 08:17:42 +00:00
Thomas Moestl
d279178df7 Clean up the code exporting interrupt statistics via sysctl a bit:
- move the sysctl code to kern_intr.c
- do not use INTRCNT_COUNT, but rather eintrcnt - intrcnt to determine
  the length of the intrcnt array
- move the declarations of intrnames, eintrnames, intrcnt and eintrcnt
  from machine-dependent include files to sys/interrupt.h
- remove the hw.nintr sysctl, it is not needed.
- fix various style bugs

Requested by:	bde
Reviewed by:	bde (some time ago)
2001-06-01 13:23:28 +00:00
John Baldwin
f8584ee1e1 Catch up to the axeing of MFS and fix the ia64 build.
Forgotten by:	a Danish axe-wielder
2001-05-30 23:06:14 +00:00
John Baldwin
c9dc25fa44 - Catch up to the VM mutex changes.
- Sort includes in a few places.
2001-05-30 00:03:13 +00:00
Poul-Henning Kamp
888a8e3567 Remove MFS options from all example kernel configs. 2001-05-29 18:49:06 +00:00
Ruslan Ermilov
99d300a1ec - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION file
systems were repo-copied from sys/miscfs to sys/fs.

- Renamed the following file systems and their modules:
  fdesc -> fdescfs, portal -> portalfs, union -> unionfs.

- Renamed corresponding kernel options:
  FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS.

- Install header files for the above file systems.

- Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland
  Makefiles.
2001-05-23 09:42:29 +00:00
David E. O'Brien
ef76752043 Style changes -- revert ordering to mostly two revs ago.
Embellish some comments, fix tab'ing.

Requested by:	bde
2001-05-18 01:40:40 +00:00
John Baldwin
7a08bae6ec - Move the setting of bootverbose to a MI SI_SUB_TUNABLES SYSINIT.
- Attach a writable sysctl to bootverbose (debug.bootverbose) so it can be
  toggled after boot.
- Move the printf of the version string to a SI_SUB_COPYRIGHT SYSINIT just
  afer the display of the copyright message instead of doing it by hand in
  three MD places.
2001-05-17 22:28:46 +00:00
David E. O'Brien
0dfc89c188 Consistently define the rune types.
Follow NetBSD's lead and add a _BSD_MBSTATE_T_ type.
2001-05-16 22:32:44 +00:00
David E. O'Brien
1123bf8862 Move the int typedefs to the top so they can be used in defining other types.
Ensure every platform has __offsetof.
Make multiple inclusion detection consistent with other
  <platform>/include/*.h files.
2001-05-16 22:21:43 +00:00
John Baldwin
f0ba29575d Lock the procfs functions for doing a single step and reading/writing
registers better.  Hold sched_lock not only for checking the flag but
also while performing the actual operation to ensure the process doesn't
get swapped out by another CPU while we the operation is being performed.
2001-05-16 00:47:27 +00:00
John Baldwin
dec54ac5b5 "Sir, the deorbit burn completed succesfully."
RIP {sys/machine}/ipl.h.
2001-05-15 23:30:37 +00:00
John Baldwin
8bd57f8fc2 Remove unneeded includes of sys/ipl.h and machine/ipl.h. 2001-05-15 23:22:29 +00:00
Poul-Henning Kamp
ab9f3b292e Convert DEVFS from an "opt-in" to an "opt-out" option.
If for some reason DEVFS is undesired, the "NODEVFS" option is
needed now.

Pending any significant issues, DEVFS will be made mandatory in
-current on july 1st so that we can start reaping the full
benefits of having it.
2001-05-13 20:52:40 +00:00
John Baldwin
1efb92b7ca Simplify the vm fault trap handling code a bit by using if-else instead of
duplicating code in the then case and then using a goto to jump around
the else case.
2001-05-11 23:50:08 +00:00
John Baldwin
ba228f6d96 - Split out the support for per-CPU data from the SMP code. UP kernels
have per-CPU data and gdb on the i386 at least needs access to it.
- Clean up includes in kern_idle.c and subr_smp.c.

Reviewed by:	jake
2001-05-10 17:45:49 +00:00
John Baldwin
28a24ae515 Add include of sys/mutex.h and resort include of sys/lock.h. 2001-05-09 16:56:48 +00:00
John Baldwin
d90b453427 Add needed sys/lock.h include. 2001-05-09 16:55:59 +00:00
Poul-Henning Kamp
a468031ce8 Actually biofinish(struct bio *, struct devstat *, int error) is more general
than the bioerror().

Most of this patch is generated by scripts.
2001-05-06 20:00:03 +00:00
John Baldwin
6caa8a1501 Overhaul of the SMP code. Several portions of the SMP kernel support have
been made machine independent and various other adjustments have been made
to support Alpha SMP.

- It splits the per-process portions of hardclock() and statclock() off
  into hardclock_process() and statclock_process() respectively.  hardclock()
  and statclock() call the *_process() functions for the current process so
  that UP systems will run as before.  For SMP systems, it is simply necessary
  to ensure that all other processors execute the *_process() functions when the
  main clock functions are triggered on one CPU by an interrupt.  For the alpha
  4100, clock interrupts are delievered in a staggered broadcast fashion, so
  we simply call hardclock/statclock on the boot CPU and call the *_process()
  functions on the secondaries.  For x86, we call statclock and hardclock as
  usual and then call forward_hardclock/statclock in the MD code to send an IPI
  to cause the AP's to execute forwared_hardclock/statclock which then call the
  *_process() functions.
- forward_signal() and forward_roundrobin() have been reworked to be MI and to
  involve less hackery.  Now the cpu doing the forward sets any flags, etc. and
  sends a very simple IPI_AST to the other cpu(s).  AST IPIs now just basically
  return so that they can execute ast() and don't bother with setting the
  astpending or needresched flags themselves.  This also removes the loop in
  forward_signal() as sched_lock closes the race condition that the loop worked
  around.
- need_resched(), resched_wanted() and clear_resched() have been changed to take
  a process to act on rather than assuming curproc so that they can be used to
  implement forward_roundrobin() as described above.
- Various other SMP variables have been moved to a MI subr_smp.c and a new
  header sys/smp.h declares MI SMP variables and API's.   The IPI API's from
  machine/ipl.h have moved to machine/smp.h which is included by sys/smp.h.
- The globaldata_register() and globaldata_find() functions as well as the
  SLIST of globaldata structures has become MI and moved into subr_smp.c.
  Also, the globaldata list is only available if SMP support is compiled in.

Reviewed by:	jake, peter
Looked over by:	eivind
2001-04-27 19:28:25 +00:00
Doug Rabson
a78af1ccdb When switching backing store during signal delivery, do the switch before
creating the register frame for calling the handler. Also discard that
frame before switching back to the old backing store after the handler
returns.
2001-04-24 15:57:16 +00:00
Doug Rabson
2c7122ff0f Align stack pointer and backing store pointer to 16 byte boundary when
delivering signals.
2001-04-24 15:55:47 +00:00
Doug Rabson
1eaf877f2e Don't trash the user's pr on syscalls. 2001-04-24 15:54:23 +00:00
Doug Rabson
2322ee63c2 Don't unwrap the function descriptor used as the callout argument to
fork_exit(). The MI version of fork_exit() needs a real function
descriptor, not a simple function pointer.
2001-04-19 12:35:47 +00:00
Doug Rabson
eed829bca9 Don't take the Giant mutex for clock interrupts. 2001-04-19 12:34:23 +00:00
Doug Rabson
ff37c2003c Don't panic when we try to modify the kernel pmap. 2001-04-18 15:08:37 +00:00
Doug Rabson
169915f56d Print an approximation of the function arguments in the stack trace. 2001-04-18 15:07:56 +00:00
Doug Rabson
072c3a5395 Implement a simple stack trace for DDB. This will have to be redone
if/when we change to a more modern toolchain.
2001-04-18 14:15:45 +00:00
Doug Rabson
dd85faa611 Record the right value for tf_ndirty for kernel interruptions so that
we can examine the interrupted register stack frame in DDB.
2001-04-18 14:10:43 +00:00
David E. O'Brien
c5e70d92ce Turn on kernel debugging support (DDB, INVARIANTS, INVARIANT_SUPPORT, WITNESS)
by default while SMPng is still being developed.

Submitted by:	jhb
2001-04-15 19:37:28 +00:00
John Baldwin
2fea957dc5 Rename the IPI API from smp_ipi_* to ipi_* since the smp_ prefix is just
"redundant noise" and to match the IPI constant namespace (IPI_*).

Requested by:	bde
2001-04-11 17:06:02 +00:00
David E. O'Brien
563dd74008 Reduce the emasculation of bounds_check_with_label() by one line, so we
propagate a bio error condition to the caller and above.
2001-03-29 20:26:12 +00:00
John Baldwin
1005a129e5 Convert the allproc and proctree locks from lockmgr locks to sx locks. 2001-03-28 11:52:56 +00:00
John Baldwin
192846463a Rework the witness code to work with sx locks as well as mutexes.
- Introduce lock classes and lock objects.  Each lock class specifies a
  name and set of flags (or properties) shared by all locks of a given
  type.  Currently there are three lock classes: spin mutexes, sleep
  mutexes, and sx locks.  A lock object specifies properties of an
  additional lock along with a lock name and all of the extra stuff needed
  to make witness work with a given lock.  This abstract lock stuff is
  defined in sys/lock.h.  The lockmgr constants, types, and prototypes have
  been moved to sys/lockmgr.h.  For temporary backwards compatability,
  sys/lock.h includes sys/lockmgr.h.
- Replace proc->p_spinlocks with a per-CPU list, PCPU(spinlocks), of spin
  locks held.  By making this per-cpu, we do not have to jump through
  magic hoops to deal with sched_lock changing ownership during context
  switches.
- Replace proc->p_heldmtx, formerly a list of held sleep mutexes, with
  proc->p_sleeplocks, which is a list of held sleep locks including sleep
  mutexes and sx locks.
- Add helper macros for logging lock events via the KTR_LOCK KTR logging
  level so that the log messages are consistent.
- Add some new flags that can be passed to mtx_init():
  - MTX_NOWITNESS - specifies that this lock should be ignored by witness.
    This is used for the mutex that blocks a sx lock for example.
  - MTX_QUIET - this is not new, but you can pass this to mtx_init() now
    and no events will be logged for this lock, so that one doesn't have
    to change all the individual mtx_lock/unlock() operations.
- All lock objects maintain an initialized flag.  Use this flag to export
  a mtx_initialized() macro that can be safely called from drivers.  Also,
  we on longer walk the all_mtx list if MUTEX_DEBUG is defined as witness
  performs the corresponding checks using the initialized flag.
- The lock order reversal messages have been improved to output slightly
  more accurate file and line numbers.
2001-03-28 09:03:24 +00:00
John Baldwin
0006681fe6 Switch from save/disable/restore_intr() to critical_enter/exit(). 2001-03-28 03:06:10 +00:00
John Baldwin
b944b9033a Catch up to the mtx_saveintr -> mtx_savecrit change. 2001-03-28 02:46:21 +00:00
John Baldwin
6283b7d01b - Switch from using save/disable/restore_intr to using critical_enter/exit
and change the u_int mtx_saveintr member of struct mtx to a critical_t
  mtx_savecrit.
- On the alpha we no longer need a custom _get_spin_lock() macro to avoid
  an extra PAL call, so remove it.
- Partially fix using mutexes with WITNESS in modules.  Change all the
  _mtx_{un,}lock_{spin,}_flags() macros to accept explicit file and line
  parameters and rename them to use a prefix of two underscores.  Inside
  of kern_mutex.c, generate wrapper functions for
  _mtx_{un,}lock_{spin,}_flags() (only using a prefix of one underscore)
  that are called from modules.  The macros mtx_{un,}lock_{spin,}_flags()
  are mapped to the __mtx_* macros inside of the kernel to inline the
  usual case of mutex operations and map to the internal _mtx_* functions
  in the module case so that modules will use WITNESS and KTR logging if
  the kernel is compiled with support for it.
2001-03-28 02:40:47 +00:00
John Baldwin
034dc442ad - Add the new critical_t type used to save state inside of critical
sections.
- Add implementations of the critical_enter() and critical_exit() functions
  and remove restore_intr() and save_intr().
- Remove the somewhat bogus disable_intr() and enable_intr() functions on
  the alpha as the alpha actually uses a priority level and not simple bit
  flag on the CPU.
2001-03-28 02:31:54 +00:00
Poul-Henning Kamp
f83880518b Send the remains (such as I have located) of "block major numbers" to
the bit-bucket.
2001-03-26 12:41:29 +00:00
Hajimu UMEMOTO
8b625cb701 Unbreak build on alpha.
- Move in_port_t to sys/types.h.
  - Nuke in_addr_t from each endian.h.

Reported by:	jhb
2001-03-24 15:17:27 +00:00
John Baldwin
5e115a7e04 - Define and use MAXCPU like the alpha and i386 instead of NCPUS.
- Sort the sys/mutex.h include in mp_machdep.c into a closer to correct
  location.
2001-03-24 06:22:57 +00:00
John Baldwin
197855a3ea Stick a prototype for handleclock() in machine/clock.h and include it
interrupt.c to quiet a warning.
2001-03-24 06:20:48 +00:00
Thomas Moestl
368d2edce4 Export intrnames and intrcnt as sysctls (hw.nintr, hw.intrnames and
hw.intrcnt).

Approved by:	rwatson
2001-03-23 03:45:17 +00:00
Peter Wemm
6eb39ac8fc Use a generic implementation of the Fowler/Noll/Vo hash (FNV hash).
Make the name cache hash as well as the nfsnode hash use it.

As a special tweak, create an unsigned version of register_t.  This allows
us to use a special tweak for the 64 bit versions that significantly
speeds up the i386 version (ie: int64 XOR int64 is slower than int64
XOR int32).

The code layout is a little strange for the string function, but I was
able to get between 5 to 10% improvement over the original version I
started with. The layout affects gcc code generation choices and this way
was fastest on x86 and alpha.

Note that 'CPUTYPE=p3' etc makes a fair difference to this.  It is
around 45% faster with -march=pentiumpro on a p6 cpu.
2001-03-17 09:31:06 +00:00
Doug Rabson
7ea98b2be3 Allow the config file to specify a root filesystem filename. 2001-03-09 13:45:31 +00:00
Doug Rabson
60fe99457c Adjust a comment slightly. 2001-03-09 13:44:53 +00:00
John Baldwin
5db078a9be Fix mtx_legal2block. The only time that it is bad to block on a mutex is
if we hold a spin mutex, since we can trivially get into deadlocks if we
start switching out of processes that hold spinlocks.  Checking to see if
interrupts were disabled was a sort of cheap way of doing this since most
of the time interrupts were only disabled when holding a spin lock.  At
least on the i386.  To fix this properly, use a per-process counter
p_spinlocks that counts the number of spin locks currently held, and
instead of checking to see if interrupts are disabled in the witness code,
check to see if we hold any spin locks.  Since child processes always
start up with the sched lock magically held in fork_exit(), we initialize
p_spinlocks to 1 for child processes.  Note that proc0 doesn't go through
fork_exit(), so it starts with no spin locks held.

Consulting from:	cp
2001-03-09 07:24:17 +00:00
John Baldwin
136d8f42b9 Unrevert the pmap_map() changes. They weren't broken on x86.
Sense beaten into me by:	peter
2001-03-07 05:29:21 +00:00
John Baldwin
f227364a17 - Release Giant a bit earlier on syscall exit.
- Don't try to grab Giant before postsig() in userret() as it is no longer
  needed.
- Don't grab Giant before psignal() in ast() but get the proc lock instead.
2001-03-07 03:53:39 +00:00
John Baldwin
19eb87d22a Grab the process lock while calling psignal and before calling psignal. 2001-03-07 03:37:06 +00:00
John Baldwin
ff655691d8 Use the proc lock to protect p_pptr when waking up our parent in cpu_exit()
and remove the mpfixme() message that is now fixed.
2001-03-07 03:20:15 +00:00
John Baldwin
4a01ebd482 Back out the pmap_map() change for now, it isn't completely stable on the
i386.
2001-03-07 01:04:17 +00:00
John Baldwin
f90f3aadba Don't psignal() a process from forward_hardclock() but set the appropriate
pending flag in p_sflag instead.
2001-03-06 07:40:51 +00:00
John Baldwin
968950e5d1 - Rework pmap_map() to take advantage of direct-mapped segments on
supported architectures such as the alpha.  This allows us to save
  on kernel virtual address space, TLB entries, and (on the ia64) VHPT
  entries.  pmap_map() now modifies the passed in virtual address on
  architectures that do not support direct-mapped segments to point to
  the next available virtual address.  It also returns the actual
  address that the request was mapped to.
- On the IA64 don't use a special zone of PV entries needed for early
  calls to pmap_kenter() during pmap_init().  This gets us in trouble
  because we end up trying to use the zone allocator before it is
  initialized.  Instead, with the pmap_map() change, the number of needed
  PV entries is small enough that we can get by with a static pool that is
  used until pmap_init() is complete.

Submitted by:		dfr
Debugging help:		peter
Tested by:		me
2001-03-06 06:06:42 +00:00
Doug Rabson
3af0f1028b Fix a couple of typos which became obvious when I started to actually use
this on real hardware.
2001-03-04 23:30:31 +00:00
John Baldwin
505b544d52 sched_swi -> swi_sched 2001-02-24 19:09:37 +00:00
John Baldwin
f58a8b1a54 Don't include machine/mutex.h and relocate sys/mutex.h's include to be
closer to alphabetical order and identical to that of the alpha.
2001-02-24 19:09:16 +00:00
John Baldwin
7b4a30b689 Clockframes have a trapframe stored in a cf_tf member, not ct_tf. 2001-02-24 18:57:34 +00:00
John Baldwin
7182d6578d Whitespace nits. 2001-02-24 18:41:38 +00:00
John Baldwin
ad0a541a9e Pass in process to mark ast on to aston(). 2001-02-24 18:41:17 +00:00
John Baldwin
2f01e2eaf2 Axe pcb_schednest as it is no longer used. 2001-02-22 17:09:50 +00:00
John Baldwin
938f15c7c4 Rename switch_trampoline() to fork_trampoline() on the alpha and ia64.
Suggested by:	dfr
2001-02-22 16:56:53 +00:00