Commit graph

726 commits

Author SHA1 Message Date
Jake Burkholder d0ce9a7e07 Remove abuse of intr_disable/restore in MI code by moving the loop in ast()
back into the calling MD code.  The MD code must ensure no races between
checking the astpening flag and returning to usermode.

Submitted by:	peter (ia64 bits)
Tested on:	alpha (peter, jeff), i386, ia64 (peter), sparc64
2002-03-29 16:35:26 +00:00
David E. O'Brien ae7c70d595 style(9)
Approved by:	jake
2002-03-28 02:54:44 +00:00
Jeff Roberson f22a4b62f5 Add a new mtx_init option "MTX_DUPOK" which allows duplicate acquires of locks
with this flag.  Remove the dup_list and dup_ok code from subr_witness.  Now
we just check for the flag instead of doing string compares.

Also, switch the process lock, process group lock, and uma per cpu locks over
to this interface.  The original mechanism did not work well for uma because
per cpu lock names are unique to each zone.

Approved by:	jhb
2002-03-27 09:23:41 +00:00
Matthew Dillon d74ac6819b Compromise for critical*()/cpu_critical*() recommit. Cleanup the interrupt
disablement assumptions in kern_fork.c by adding another API call,
cpu_critical_fork_exit().  Cleanup the td_savecrit field by moving it
from MI to MD.  Temporarily move cpu_critical*() from <arch>/include/cpufunc.h
to <arch>/<arch>/critical.c (stage-2 will clean this up).

Implement interrupt deferral for i386 that allows interrupts to remain
enabled inside critical sections.  This also fixes an IPI interlock bug,
and requires uses of icu_lock to be enclosed in a true interrupt disablement.

This is the stage-1 commit.  Stage-2 will occur after stage-1 has stabilized,
and will move cpu_critical*() into its own header file(s) + other things.
This commit may break non-i386 architectures in trivial ways.  This should
be temporary.

Reviewed by:	core
Approved by:	core
2002-03-27 05:39:23 +00:00
Marcel Moolenaar d8869cc205 o Revert previous commit in asm.h. There's no need to undefine
__FBSDID first, because it should not be defined at all,
o  Remove inclusion of cdefs.h in locore.s.

Pointed out by: peter
2002-03-27 02:20:09 +00:00
David E. O'Brien 1640869c31 Get the guarding right. The IA-64 has a different organization for this
than our other platforms.
2002-03-26 02:59:00 +00:00
David E. O'Brien c543d983fa Guard against redefining __gnuc_va_list. 2002-03-24 11:25:46 +00:00
Marcel Moolenaar 9156494211 Undefine __FBSDID before defining it as it's already defined at
that point.
2002-03-24 10:28:04 +00:00
David E. O'Brien 439a4003ab ASM versions of __FBSDID. 2002-03-23 02:01:27 +00:00
Doug Rabson 6720311838 Change critical_t to register_t for intr_disable/restore. 2002-03-21 09:50:11 +00:00
Doug Rabson 77b51ddfcd Change cpu_critical_enter/exit to intr_disable/restore. 2002-03-21 09:35:18 +00:00
Peter Wemm c302e53c27 In UP mode, the primary cpu's per-cpu current_pmap was not initialized -
this was only done as a side effect of calling cpu_mp_start().  I haven't
actually tested that this fixes UP kernels, but it feels about right.
2002-03-21 07:41:02 +00:00
Jeff Roberson eca80f82ea Remove references to vm_zone.h and switch over to the new uma API.
Approved by:	peter
2002-03-21 02:46:56 +00:00
Alfred Perlstein e41ed5da90 Remove __P.
Reviewd by: peter
2002-03-20 23:30:31 +00:00
John Baldwin f25fcd64b8 Change the way we ensure td_ucred is NULL if DIAGNOSTIC is defined.
Instead of caching the ucred reference, just go ahead and eat the
decerement and increment of the refcount.  Now that Giant is pushed down
into crfree(), we no longer have to get Giant in the common case.  In the
case when we are actually free'ing the ucred, we would normally free it on
the next kernel entry, so the cost there is not new, just in a different
place.  This also removse td_cache_ucred from struct thread.  This is
still only done #ifdef DIAGNOSTIC.

Tested on:	i386, alpha
2002-03-20 21:09:09 +00:00
Doug Rabson a2763677ec Change intr_enable to intr_restore for consistency with sparc64. 2002-03-20 17:28:40 +00:00
Doug Rabson c526161420 Replace calls to cpu_critical_enter/exit with appropriate calls to
either explicitly disable interrupts or use a real critical section,
as appropriate.
2002-03-20 10:04:08 +00:00
Doug Rabson 95f7adfa1a Recreate intr_disable/intr_enable and implement cpu_critical_enter/exit
in terms of that (for now).
2002-03-20 10:00:05 +00:00
Peter Wemm 3acb2ae91f #if 0 some unused variables (only in #if 0 code) 2002-03-19 12:15:29 +00:00
Peter Wemm bfed03d6df Enabling the SKI option is a guaranteed breakage for me. Interrupts no
longer work.
I can only get a box to boot with 'options SMP'.
2002-03-19 11:21:12 +00:00
Peter Wemm 5044ed104d My ia64 box for some reason likes to fragment the beginning/end of memory
a bit before handing it over to the OS.  I occasionally have 11
segments with several 8K or so fragments depending on nvram settings and
what I have done under loader(8) before booting.  This needs to be
revisited.
2002-03-19 11:18:47 +00:00
Peter Wemm 3b406873c7 Fix some unused variables. 2002-03-19 11:15:26 +00:00
Peter Wemm 12adcbdf35 Move a couple of prototypes together instead of being incompletely
scattered around.
2002-03-19 11:14:52 +00:00
Peter Wemm 6d4a5aee06 __func__ is a const char *, not a "string" that can be concatenated. 2002-03-19 11:11:37 +00:00
Peter Wemm 90f9252584 Fix a pointer/int warning 2002-03-19 11:10:30 +00:00
Peter Wemm 21eec46f33 #ifdef SMP some variables that are only used elsewhere under #ifdef SMP
also.
2002-03-19 11:10:03 +00:00
Peter Wemm 34adf9e4f1 Work around an apparent compiler bug with gcc-3.1, although it might be
a language feature that I do not know about.  gcc is complaining about
a left shift >= sizeof type, even when shifting a (cast) 64 bit type left
by 43 bits.
2002-03-19 11:09:24 +00:00
Peter Wemm 51ea8b33df Believe it or not, I ran into the 32MB stack size limit using a natively
hosted gcc.
2002-03-19 11:07:09 +00:00
Peter Wemm e42d7cebec #if 0 out some unused code. 2002-03-19 11:06:01 +00:00
Peter Wemm 675ceea82b Add some #includes after things got broken with the last round of
MI include file (<sys/smp.h> I think) tweaks.
2002-03-19 11:05:07 +00:00
Peter Wemm 4ff9e8d5e5 Turn off the ia64 ITC timecounter when SMP is present since it has the
same problem as the TSC on the x86 - ie: it is not synchronized.
#if 0 out some unused functions, ia64 doesn't calibrate clocks yet.
2002-03-19 11:03:48 +00:00
Jeff Roberson 8355f576a9 This is the first part of the new kernel memory allocator. This replaces
malloc(9) and vm_zone with a slab like allocator.

Reviewed by:	arch@
2002-03-19 09:11:49 +00:00
Doug Rabson 568a940b99 Fix spelling. 2002-03-18 09:29:16 +00:00
Dag-Erling Smørgrav a2e0658045 Move the definition of PT_[GS]ET{,DB,FP}REGS from the MD ptrace.h to the
MI ptrace.h, since all platforms define them.  Keep the MD ptrace.h around
for FIX_SSTEP (which is currently only needed on Alpha).
2002-03-16 00:25:53 +00:00
Doug Rabson 0ab3e3b15a * Stop other cpus when one cpu enters DDB and restart them after it
leaves.
* Add a sync.i instruction to the code which writes out breakpoints to
  ensure that the breakpoint is seem by all cpus in the coherence domain.
2002-03-15 11:12:08 +00:00
Doug Rabson fa45345e6e * Remove a breakpoint() I accidentally left in for debugging :-(.
* Make cpu_mp_probe() work before the VM system is available and
  initialise mp_maxid accordingly.
2002-03-15 09:47:16 +00:00
Doug Rabson 0f638cfaeb Tweak the AP startup code somewhat. With all the other recent changes,
this now works pretty well for two processors at least.

Submitted by: marcel, mostly.
2002-03-14 19:37:36 +00:00
Doug Rabson 34da0be411 * Initialise pcb_pmap for new threads.
* Add support for forking new threads from &thread0 as well as curthread.
2002-03-14 19:34:50 +00:00
Doug Rabson 92e814dcb6 * Save and restore PCPU_GET(current_pmap) in pcb_pmap so that we don't
lose if a process is preempted while pmap is temporarily switched to
  another pmap.
* For SMP, drop the high-fp state when a thread is switched away from
  so that if another cpu resumes that thread, it doesn't have to play
  games with IPI to get ahold of the correct register values.
2002-03-14 19:33:03 +00:00
Doug Rabson 48f7cc3fed Add pcpu.pc_current_pmap and pcb.pcb_pmap. 2002-03-14 19:20:24 +00:00
Doug Rabson a9521dec8b Add a field to hold the current pmap of a thread. 2002-03-14 19:19:49 +00:00
Doug Rabson 17ea508863 Add ia64_sync_i(), ia64_get_tpr() and ia64_set_tpr(). 2002-03-14 12:29:55 +00:00
Doug Rabson 0323b941f0 * Add some KTR messages for IPIs.
* Don't call ast() from interrupt() - if we switch, then we will miss
  writing cr.eoi which will prevent the current cpu from receiving
  interrupts until the current thread is resumed. The call to ast()
  happens magically in exception_restore where it is safe.
* Add DDB 'show irq' command to examine interrupt hardware state.
2002-03-14 10:24:00 +00:00
Doug Rabson 838ba419e9 Add debug code to print SAPIC registers. 2002-03-14 10:17:08 +00:00
Doug Rabson 2750f739f9 * Use a mutex to protect the RID allocator.
* Use ptc.g instead of ptc.l so that TLB shootdowns are broadcast to the
  coherence domain.
* Use smp_rendezvous for pmap_invalidate_all to ensure it happens on all
  cpus.
* Dike out a DIAGNOSTIC printf which didn't compile.
* Protect the internals of pmap_install with cpu_critical_enter/exit.
2002-03-14 09:28:05 +00:00
Doug Rabson 26c01501cd Move the call to pmap_bootstrap to after the initialisation of thread0.
This allows us to use mutexes in pmap safely. Also initialise fpcurthread
for cpu0 so that ia64_fpstate_check doesn't barf during boot.
2002-03-14 09:20:07 +00:00
Doug Rabson b81b083819 Don't restore r13 when returning to kernel mode. We may have migrated to
a different cpu since the exception_save and r13 needs to point at the
current cpu's pcpu structure.
2002-03-14 00:28:10 +00:00
Peter Wemm 841390683c Fix some -Wunused warnings by "using" a macro argument 2002-03-12 00:19:14 +00:00
Peter Wemm a84c6cd303 Fix a warning (make ucontext_t *ucp a const) 2002-03-12 00:18:20 +00:00
Peter Wemm db593b65d2 Stop concatenating __func__ with strings 2002-03-12 00:17:45 +00:00
Peter Wemm e64c73a9f0 Deal with a structure member rename in a recent acpica import 2002-03-12 00:15:57 +00:00
John Baldwin bb7d54e8c7 Fix a misspelling of mine: s/optomization/optimization/.
Noticed by:	bmilekic
2002-03-11 19:58:53 +00:00
Doug Rabson a914a17e1d Add an implementation of cpu_throw() and make restorectx() simply branch
to the tail of cpu_switch.
2002-03-10 20:20:31 +00:00
Doug Rabson f0ec35cae4 Don't try to print the arguments if the value of bsp is outside the
kernel - its asking for trouble.
2002-03-10 20:19:32 +00:00
Doug Rabson a7f314ea94 Use the right value for the region length in parse_spill_mask. 2002-03-10 17:03:45 +00:00
Mike Barcroft d846855da8 o Don't require long long support in bswap64() functions.
o In i386's <machine/endian.h>, macros have some advantages over
  inlines, so change some inlines to macros.
o In i386's <machine/endian.h>, ungarbage collect word_swap_int()
  (previously __uint16_swap_uint32), it has some uses on i386's with
  PDP endianness.

Submitted by:	bde

o Move a comment up in <machine/endian.h> that was accidentially moved
  down a few revisions ago.
o Reenable userland's use of optimized inline-asm versions of
  byteorder(3) functions.
o Fix ordering of prototypes vs. redefinition of byteorder(3)
  functions, so that the non-GCC (libc asm) case has proper
  prototypes.
o Add proper prototypes for byteorder(3) functions in <sys/param.h>.
o Prevent redundant duplicate prototypes by making use of the
  _BYTEORDER_PROTOTYPED define.
o Move the bswap16(), bswap32(), bswap64() C functions into MD space
  for platforms in which asm versions don't exist.  This significantly
  reduces the complexity of some things at the cost of duplicate code.

Reviewed by:	bde
2002-03-09 21:02:16 +00:00
Jake Burkholder 74acd9bb58 Include machine/smp.h. 2002-03-07 04:48:17 +00:00
Marcel Moolenaar 2242af42cf Call ast() only when we're handling a user trap. 2002-03-05 06:13:22 +00:00
Doug Rabson 2d0639e55d Add PSEUDOFS. 2002-03-04 18:01:56 +00:00
Doug Rabson 1fc142b38f Add emulation support for PAL_VM_SUMMARY. 2002-03-04 12:47:47 +00:00
Doug Rabson 08cece4091 * Include <sys/ucontext.h> so that this compiles again.
* Move the section which manipulates ia64_pal_base to after cninit() so
  that we don't risk printing anything before we have a console.
* Don't call ia64_probe_sapics() for a SKI build. This should really
  be dependant on ACPICA being present or something.
2002-03-03 19:23:15 +00:00
Andrew R. Reiter 66c862bc1b - Move a comment from being on the same line as a #ifdef to the line
following it.  This should have gone in the previous commit, but
  misviewed Bruce's patch.

Requested by: bde
2002-02-28 21:52:08 +00:00
Andrew R. Reiter 216ae18217 - Fix panic() message and a couple style nits that snuck in from the
recent diagnostics commit (rev. 1.84).
2002-02-28 08:28:14 +00:00
John Baldwin a854ed9893 Simple p_ucred -> td_ucred changes to start using the per-thread ucred
reference.
2002-02-27 18:32:23 +00:00
Mike Silbersack 7f3a40933b Fix a horribly suboptimal algorithm in the vm_daemon.
In order to determine what to page out, the vm_daemon checks
reference bits on all pages belonging to all processes.  Unfortunately,
the algorithm used reacted badly with shared pages; each shared page
would be checked once per process sharing it; this caused an O(N^2)
growth of tlb invalidations.  The algorithm has been changed so that
each page will be checked only 16 times.

Prior to this change, a fork/sleepbomb of 1300 processes could cause
the vm_daemon to take over 60 seconds to complete, effectively
freezing the system for that time period.  With this change
in place, the vm_daemon completes in less than a second.  Any system
with hundreds of processes sharing pages should benefit from this change.

Note that the vm_daemon is only run when the system is under extreme
memory pressure.  It is likely that many people with loaded systems saw
no symptoms of this problem until they reached the point where swapping
began.

Special thanks go to dillon, peter, and Chuck Cranor, who helped me
get up to speed with vm internals.

PR:		33542, 20393
Reviewed by:	dillon
MFC after:	1 week
2002-02-27 18:03:02 +00:00
Thomas Moestl 90ce56c287 Add the following functions/macros to support byte order conversions and
device drivers for bus system with other endinesses than the CPU (using
interfaces compatible to NetBSD):

- bwap16() and bswap32(). These have optimized implementations on some
  architectures; for those that don't, there exist generic implementations.
- macros to convert from a certain byte order to host byte order and vice
  versa, using a naming scheme like le16toh(), htole16().
  These are implemented using the bswap functions.
- stream bus space access functions, which do not perform a byte order
  conversion (while the normal access functions would if the bus endianess
  differs from the CPU endianess).

htons(), htonl(), ntohs() and ntohl() are implemented using the new
functions above for kernel usage. None of the above interfaces is currently
exported to user land.

Make use of the new functions in a few places where local implementations
of the same functionality existed.

Reviewed by:	mike, bde
Tested on alpha by:	mike
2002-02-27 17:16:18 +00:00
Julian Elischer 77c4066424 Add some DIAGNOSTIC code.
While in userland, keep the thread's ucred reference in a shadow
field so that the usual place to store it is NULL.
If DIAGNOSTIC is not set, the thread ucred is kept valid until the next
kernel entry, at which time it is checked against the process cred
and possibly corrected. Produces a BIG speedup in
kernels with INVARIANTS set. (A previous commit corrected it
for the non INVARIANTS case already)

Reviewed by:	dillon@freebsd.org
2002-02-22 23:58:22 +00:00
Poul-Henning Kamp 1cbb9c3b03 Convert p->p_runtime and PCPU(switchtime) to bintime format. 2002-02-22 13:32:01 +00:00
Julian Elischer db170a83d5 Duplicate the changes to i386 to keep creds over the user boundary. 2002-02-19 03:16:50 +00:00
Mike Barcroft d1f7a1b79c Add C++ support. 2002-02-19 02:17:16 +00:00
Mike Barcroft fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Garrett Wollman 3b7a4c4b1d Resurrect one of the easiest changes from my big include files roll-up
patch from a year ago: give file flags their own type.  This does not
(yet) change the type used by system calls or library functions.
The underlying type was chosen to match what is returned by stat().
2002-02-15 22:15:39 +00:00
Robert Watson 92b98fdabe Remove WITNESS from GENERIC by default: as we grow more locks, this gets
slower, and may be impeding adoption of -CURRENT by developers.  We
recommend turning on WITNESS by default on crash boxes, and when doing
locking development.  It will probably get turned on by default for a week
or two following any major locking commits, also.

Approved by:	all and sundry (jhb, phk, ...)
2002-02-13 07:44:59 +00:00
Julian Elischer 079b7badea Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
2002-02-07 20:58:47 +00:00
Poul-Henning Kamp e0ee6f5629 GC the PC_SWITCH* symbols which are not used in assembly anymore. 2002-02-07 10:27:58 +00:00
Bruce Evans 55a9536b65 Compile osigreturn() unconditionally since it will always be needed on
some arches and the syscall table is machine-independent.  It was
(bogusly) conditional on COMPAT_43, so this usually makes no difference.

ia64: in addition:
- replace the bogus cloned comment before osigreturn() by a correct one.
  osigreturn() is just a stub fo ia64's.
- fix the formatting of cloned comment before sigreturn().
- fix the return code.  use nosys() instead of returning ENOSYS to get
  the same semantics as if the syscall is not in the syscall table.
  Generating SIGSYS is actually correct here.
- fix style bugs.

powerpc: copy the cleaned up ia64 stub.  This mainly fixes a bogus comment.

sparc64: copy the cleaned up the ia64 stub, since there was no stub before.
2002-02-01 15:44:03 +00:00
Marcel Moolenaar 57aace23d5 Add a definition of ddb_regs. ddb_regs is declared as extern in
db_machdep.h to fix the link failure (multiple definitions)
caused by disabling the emission of common symbols. As a result,
there were no definitions at all. While here, remove useless
declarations.
2002-01-18 07:55:23 +00:00
Marcel Moolenaar 7fdc2e1a11 Remove the definition of bootverbose. This fixes the link failure
caused by disabling the emission of common symbols.
2002-01-18 07:49:37 +00:00
Marcel Moolenaar 48ceef34eb Declare ddb_regs as extern to avoid creating a tentative definition.
This fixes the link failure caused by disabling the emission of
common symbols.
2002-01-18 07:47:38 +00:00
Peter Wemm ead8168ac0 Convert a bunch of 1 << PCPU_GET(cpuid) to PCPU_GET(cpumask). 2002-01-05 09:41:37 +00:00
John Baldwin c86b6ff551 Change the preemption code for software interrupt thread schedules and
mutex releases to not require flags for the cases when preemption is
not allowed:

The purpose of the MTX_NOSWITCH and SWI_NOSWITCH flags is to prevent
switching to a higher priority thread on mutex releease and swi schedule,
respectively when that switch is not safe.  Now that the critical section
API maintains a per-thread nesting count, the kernel can easily check
whether or not it should switch without relying on flags from the
programmer.  This fixes a few bugs in that all current callers of
swi_sched() used SWI_NOSWITCH, when in fact, only the ones called from
fast interrupt handlers and the swi_sched of softclock needed this flag.
Note that to ensure that swi_sched()'s in clock and fast interrupt
handlers do not switch, these handlers have to be explicitly wrapped
in critical_enter/exit pairs.  Presently, just wrapping the handlers is
sufficient, but in the future with the fully preemptive kernel, the
interrupt must be EOI'd before critical_exit() is called.  (critical_exit()
can switch due to a deferred preemption in a fully preemptive kernel.)

I've tested the changes to the interrupt code on i386 and alpha.  I have
not tested ia64, but the interrupt code is almost identical to the alpha
code, so I expect it will work fine.  PowerPC and ARM do not yet have
interrupt code in the tree so they shouldn't be broken.  Sparc64 is
broken, but that's been ok'd by jake and tmm who will be fixing the
interrupt code for sparc64 shortly.

Reviewed by:	peter
Tested on:	i386, alpha
2002-01-05 08:47:13 +00:00
Marcel Moolenaar 200281abc1 Revert previous definition of cpu_throw(). Non-MP configurations
were broken as well.
2001-12-30 23:39:15 +00:00
Marcel Moolenaar f3366cc25b Better implement SMP support:
o  Do not use a special struct to keep track of CPUs we found;
   instead, use struct pcpu. This handles all the magic WRT
   thread creation (yay!).
o  Respect MAXCPU.
o  Use the vhpt_base and vhpt_size values to initialize the AP.
o  Style fixes.

Note that this commit temporarily breaks SMP configurations.
Previously APs didn't do anything, but they now enter the
scheduler. They hold sched_lock for more than 5 secs though
and cause a panic. That's what I call progress :-)
2001-12-30 09:59:02 +00:00
Marcel Moolenaar 0f0658df4c o Reimplement map_pal_code to work with a global variable
ia64_pal_base instead of scanning the EFI tables. This way
   AP startup code can more easily use the function.
o  Initialize ia64_pal_base in ia64_init(). When the PAL code
   doesn't need explicit mapping or no PAL code has been found,
   ia64_pal_base will be 0.
o  Remove some unused global variables.
o  Also in ia64_init(), allocate only 1 page for struct pcpu
   and remove some Alpha leftovers.
o  Initialize pc_pcb in cpu_pcpu_init().
2001-12-30 09:49:39 +00:00
Marcel Moolenaar 7251648208 Make vhpt_base and vhpt_size globals so that they can be used by
the AP startup code.
2001-12-30 09:42:43 +00:00
Marcel Moolenaar d9eba830b7 Cleanup the IPIs. 2001-12-30 09:41:29 +00:00
Marcel Moolenaar 9d31d833c2 Remove unused MD fields (pc_pending_ipis, pc_next_asn and
pc_current_asngen) and add SMP specific fields (pc_pcb,
pc_lid and pc_awake).
2001-12-30 09:39:41 +00:00
Marcel Moolenaar badb73a5ba o Remove temporary implementation of cpu_throw in vm_machdep.c
and instead make it an alternate entry-point of cpu_switch()
   in swtch.s
o  Add SMP support to cpu_switch().
2001-12-30 09:34:51 +00:00
Marcel Moolenaar 45cc363828 Draft implementation of IPI handling. 2001-12-30 09:24:29 +00:00
Marcel Moolenaar 6dc3bd7b4c Add PC_IDLETHREAD. We need it in cpu_switch. 2001-12-30 09:23:10 +00:00
Marcel Moolenaar 7e3adc7d11 Add missing predicate in interruption_Data_TLB. Without this
predicate we never used the VHPT entry we found.

While here, normalize the compares.
2001-12-30 09:22:08 +00:00
Doug Rabson e129a83e18 Fix CRITICAL_FORK so that it compiles. 2001-12-23 16:04:29 +00:00
Thomas Moestl 01f1aed259 Use the new resource_list_print_type() function.
Pass the bus device to isa_init() (this is needed for the sparc64
version).
2001-12-21 21:54:56 +00:00
Peter Wemm ff5a52e18e Replace a bunch of:
for (pv = TAILQ_FIRST(&m->md.pv_list);
               pv;
               pv = TAILQ_NEXT(pv, pv_list)) {
with:
      TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
2001-12-20 05:29:59 +00:00
John Baldwin 7e1f6dfe9d Modify the critical section API as follows:
- The MD functions critical_enter/exit are renamed to start with a cpu_
  prefix.
- MI wrapper functions critical_enter/exit maintain a per-thread nesting
  count and a per-thread critical section saved state set when entering
  a critical section while at nesting level 0 and restored when exiting
  to nesting level 0.  This moves the saved state out of spin mutexes so
  that interlocking spin mutexes works properly.
- Most low-level MD code that used critical_enter/exit now use
  cpu_critical_enter/exit.  MI code such as device drivers and spin
  mutexes use the MI wrappers.  Note that since the MI wrappers store
  the state in the current thread, they do not have any return values or
  arguments.
- mtx_intr_enable() is replaced with a constant CRITICAL_FORK which is
  assigned to curthread->td_savecrit during fork_exit().

Tested on:	i386, alpha
2001-12-18 00:27:18 +00:00
Ian Dowse 1cb4661d56 Enable UFS_DIRHASH in the GENERIC kernel.
Suggested by:	silby
Reviewed by:	dillon
MFC after:	5 days
2001-12-14 16:27:11 +00:00
John Baldwin 0bbc882680 Overhaul the per-CPU support a bit:
- The MI portions of struct globaldata have been consolidated into a MI
  struct pcpu.  The MD per-CPU data are specified via a macro defined in
  machine/pcpu.h.  A macro was chosen over a struct mdpcpu so that the
  interface would be cleaner (PCPU_GET(my_md_field) vs.
  PCPU_GET(md.md_my_md_field)).
- All references to globaldata are changed to pcpu instead.  In a UP kernel,
  this data was stored as global variables which is where the original name
  came from.  In an SMP world this data is per-CPU and ideally private to each
  CPU outside of the context of debuggers.  This also included combining
  machine/globaldata.h and machine/globals.h into machine/pcpu.h.
- The pointer to the thread using the FPU on i386 was renamed from
  npxthread to fpcurthread to be identical with other architectures.
- Make the show pcpu ddb command MI with a MD callout to display MD
  fields.
- The globaldata_register() function was renamed to pcpu_init() and now
  init's MI fields of a struct pcpu in addition to registering it with
  the internal array and list.
- A pcpu_destroy() function was added to remove a struct pcpu from the
  internal array and list.

Tested on:	alpha, i386
Reviewed by:	peter, jake
2001-12-11 23:33:44 +00:00
David E. O'Brien 6e551fb628 Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.
2001-12-10 08:09:49 +00:00
David E. O'Brien acdff873d8 style(9) 2001-12-09 19:12:07 +00:00
Matthew Dillon 66a11b9fb1 Allow maxusers to be specified as 0 in the kernel config, which will
cause the system to auto-size to between 32 and 512 depending on the
amount of memory.

MFC after:	1 week
2001-12-09 01:57:09 +00:00
John Baldwin aee9d2774f Add multiple inclusion protection. 2001-12-06 18:17:02 +00:00
Dag-Erling Smørgrav 3cdd7aa817 PROCFS requires PSEUDOFS. 2001-12-04 11:17:30 +00:00
Mike Barcroft de2656d0ed o Stop abusing MD headers with non-MD types.
o Hide nonstandard functions and types in <netinet/in.h> when
  _POSIX_SOURCE is defined.
o Add some missing types (required by POSIX.1-200x) to <netinet/in.h>.
o Restore vendor ID from Rev 1.1 in <netinet/in.h> and make use of new
  __FBSDID() macro.
o Fix some miscellaneous issues in <arpa/inet.h>.
o Correct final argument for the inet_ntop() function (POSIX.1-200x).
o Get rid of the namespace pollution from <sys/types.h> in
  <arpa/inet.h>.

Reviewed by:		fenner
Partially submitted by:	bde
2001-12-01 03:43:01 +00:00
Doug Rabson 6759374681 * Don't use critical_enter/critical_exit when accessing the VHPT - its
pointless and would be inadequate for SMP systems. We will rely on the
  VM system's locks to serialise this for now.
* Change pmap_remove() so that if the range being removed is larger than
  the number of pages mapped by the pmap, we iterate over the currently
  mapped pages instead of over the virtual address range. This should
  make a difference when removing large virtual address ranges from an
  address space.
2001-11-30 10:07:54 +00:00
Doug Rabson 473ec8790d Minor tweaks to the TLB handling code - avoid movl instructions and add
itc.x instructions to attempt to avoid the little flurry of TLB exceptions
for handling access, dirty etc.
2001-11-27 09:49:53 +00:00
Peter Wemm d65d6e5e21 s/code/ucode/ (last minute typo) 2001-11-19 08:06:56 +00:00
Peter Wemm bc11d59b2a Initial cut at calling the EFI-provided FPSWA (Floating Point Software
Assist) driver to handle the "messy" floating point cases which
cause traps to the kernel for handling.
2001-11-19 07:25:42 +00:00
Peter Wemm 1ccc5e6c4e Use some (now) spare space for passing through a pointer to the FPSWA
Interface provided by EFI (Floating Point SoftWare Assist).
2001-11-19 07:07:09 +00:00
Peter Wemm de76c8189e Remove bootinfo.bi_kernel. It isn't used by the kernel. struct bootinfo
should go away on ia64, we should be loader metadata based since that is
the only way we can boot (loader, skiload).
2001-11-19 07:05:10 +00:00
Peter Wemm ab29f8765d Oops, I accidently merged a whitespace error from the original commit.
(whitespace at end of line in rev 1.264 pmap.c).  Fix them all.
2001-11-16 02:31:20 +00:00
Peter Wemm 303f52d500 Merge rev 1.264 from i386/pmap.c (tegge via alfred):
Protect against an infinite loop when prefaulting pages.  This can
happen when the vm system maps past the end of an object or tries
to map a zero length object, the pmap layer misses the fact that
offsets wrap into negative numbers and we get stuck.
2001-11-16 02:28:33 +00:00
Peter Wemm 88b5258822 Merge rev 1.202 from i386/pmap.c (back in 1998 by John Dyson):
Make flushing dirty pages work correctly on filesystems that
unexpectedly do not complete writes even with sync I/O requests.
This should help the behavior of mmaped files when using
softupdates (and perhaps in other circumstances also.)
2001-11-16 02:25:29 +00:00
Peter Wemm 79eb7b284f Merge rev 1.293 of i386/pmap.c - skip PG_UNMANAGED in pmap_collect() 2001-11-16 02:20:40 +00:00
Peter Wemm 704be0159c Converge with i386/pmap.c - dont refer to curproc, use curthread. 2001-11-16 02:06:06 +00:00
Peter Wemm 024c3fd9d5 As part of a general cleanup and reconvergence of related pmap code,
start tidying up some loose ends.  The DEBUG_VA stuff has long since
passed its use-by date.  It wasn't used on ia64 but got cut/pasted there.
2001-11-16 01:56:34 +00:00
Peter Wemm 5207c02e45 Implement eficlock_set() to set hardware clock. 2001-11-12 09:29:05 +00:00
Marcel Moolenaar c35a41320d o os_boot_rendez is responsible for clearing the IRR bit by
reading cr.ivr, as well as writing to cr.eoi.
o  use global variables to pass information to os_boot_rendez
   so that it doesn't have to jump through hoops to find it
   out. This avoids traps on the AP without it even being
   initialized. This fixes SMP configurations.
o  Move the probing of the MADT to the end of cpu_startup,
   instead of at the start of cpu_mp_probe. We need to probe
   the MADT for non-SMP configurations as well. This fixes
   uniprocessor configurations.
o  Serialize AP wake-up by waiting for the AP. We need to do
   this since we use global variables to for the AP to use.
   As a side-effect, we can use printf() more easily to see
   what's going on.
2001-11-12 07:18:16 +00:00
Marcel Moolenaar 3ea7ef6aa3 Invoke trap() for the alt. ITLB and alt. DTLB interrrupts when
the region is not 6 or 7. This changes the behaviour from
inserting a bogus region 6 mapping to a kernel panic.
2001-11-12 07:08:45 +00:00
Peter Wemm e16c208887 Remove #if 0'ed code that was replaced by vm_ksubmap_init() and GC'ed
on other platforms.
2001-11-12 04:14:04 +00:00
Marcel Moolenaar da995dc92b Avoid using the .align directive to skip to the next vector offset.
It doesn't help us catch overflowing vector entries at compile time.
Instead use the .org directive. The last entry in the IVT doesn't
strictly need to be limited to 256 bytes, but doing so allows the
the VHPT to be placed immediately following the IVT without wasting
any space due to alignment.
2001-11-10 07:24:09 +00:00
Doug Rabson 3fc4a53e7a * Make sure we increment pm_stats.resident_count in pmap_enter_quick
* Re-organise RID allocation so that we don't accidentally give a RID
  to two different processes. Also randomise the order to try to reduce
  collisions in VHPT and TLB. Don't allocate RIDs for regions which are
  unused.
* Allocate space for VHPT based on the size of physical memory. More
  tuning is needed here.
* Add sysctl instrumentation for VHPT - see sysctl vm.stats.vhpt
* Fix a bug in pmap_prefault() which prevented it from actually adding
  pages to the pmap.
* Remove ancient dead debugging code.
* Add DDB commands for examining translation registers and region
  registers.

The first change fixes the 'free/cache page %p was dirty' panic which I
have been seeing when the system is put under moderate load. It also
fixes the negative RSS values in ps which have been confusing me for a
while.

With this set of changes the ia64 port is reliable enough to build its
own kernels, even with a 20-way parallel build. Next stop buildworld.
2001-11-09 13:25:14 +00:00
Doug Rabson 412fcd9856 Raise SIGILL for General Exceptions - its closer to the correct meaning. 2001-11-09 13:11:17 +00:00
Doug Rabson 3930f05aca Reserve more space for phys_avail. Really need to be more careful about
overflowing phys_avail.
2001-11-09 13:09:57 +00:00
Doug Rabson 22cbbdd047 Teach DDB about branch registers. 2001-11-09 13:08:25 +00:00
Doug Rabson 06d0801163 Define PS and VE fields of region register correctly. 2001-11-09 13:07:44 +00:00
Marcel Moolenaar d761b0550a Implement os_boot_rendez. Application processors are initialized
and brought to a point where kernel specific initializations can
be done. That will be the next step...
2001-11-09 05:18:45 +00:00
Marcel Moolenaar 7ce535925c Don't pass os_boot_rendez directly to SAL_SET_VECTORS, because it's
actually the address of the function descriptor. The fdesc has both
the address of the function and it's corresponding gp value. Now
that we have a gp value, use it instead of passing 0.
2001-11-05 05:55:33 +00:00
Doug Rabson ad54a36999 Implement <machine/ieeefp.h> 2001-11-03 15:51:14 +00:00
Matthew Dillon 5d339e3d47 Implement i386/i386/pmap.c 1.292 for alpha, ia64 (avoid free
page exhaustion / kernel panic for certain madvise() scenarios)
2001-11-03 01:08:55 +00:00
Mike Barcroft 0ac2d551f2 o Add new header <sys/stdint.h>.
o Make <stdint.h> a symbolic link to <sys/stdint.h>.
o Move most of <sys/inttypes.h> into <sys/stdint.h>, as per C99.
o Remove <sys/inttypes.h>.
o Adjust includes in sys/types.h and boot/efi/include/ia64/efibind.h
  to reflect new location of integer types in <sys/stdint.h>.
o Remove previously symbolicly linked <inttypes.h>, instead create a
  new file.
o Add MD headers <machine/_inttypes.h> from NetBSD.
o Include <sys/stdint.h> in <inttypes.h>, as required by C99; and
  include <machine/_inttypes.h> in <inttypes.h>, to fill in the
  remaining requirements for <inttypes.h>.
o Add additional integer types in <machine/ansi.h> and
  <machine/limits.h> which are included via <sys/stdint.h>.

Partially obtain from:	NetBSD
Tested on:		alpha, i386
Discussed on:		freebsd-standards@bostonradio.org
Reviewed by:		bde, fenner, obrien, wollman
2001-11-02 18:05:43 +00:00
Doug Rabson 60e11469dd Call ast() from exception_restore when we are restoring to user mode. 2001-11-02 10:24:44 +00:00
Doug Rabson 721d1e2149 Use static storage for the unwind state so that we can still get backtraces
when the VM system is hosed.
2001-11-02 10:04:22 +00:00
Doug Rabson 27dfd0caa3 Remember to actually free the pv_entry in pmap_remove_entry(). 2001-11-02 08:56:58 +00:00
Peter Wemm 18081136cc argh! cut/paste typo. :-(
(committed on a different machine to what I was testing it on)
2001-11-02 01:45:11 +00:00
Peter Wemm 97c97bb16b "Fix" a problem that got copied from alpha to ia64 and broke there.
When we truncate the msgbuf size because the last chunk is too small,
correctly terminate the phys_avail[] array - the VM system tests
the *end* for zero, not the start.  This leads the VM startup to
attempt to recreate a duplicate set of pages for all physical memory.

XXX the msgbuf handling is suspiciously different on i386 vs
alpha/ia64...
2001-11-02 00:41:00 +00:00
Doug Rabson 57d9a492bb Experiment with rewriting the syscall() wrapper using explicit bundling
and trying to reduce stalls from reading certain high latency registers.
This should be faster than the old syscall code. Its certainly a lot
smaller.
2001-10-31 20:02:28 +00:00
Doug Rabson a3afc63358 Add TF_AR_FPSR, the offset of ar.fpsr in a trapframe. 2001-10-31 18:06:38 +00:00
Doug Rabson 033e93a942 Print the bundle template name on the first slot of the bundle. 2001-10-31 11:52:29 +00:00
Doug Rabson d57b94ba65 * Factor out common code for manipulating the RSE backing store.
* Implement a fairly simplistic parser for unwinding stack frames.
* Use unwind records for DDB's 'trace' command. Also add support for
  tracing past exceptions to the context which generated the exception.

The stack unwind code requires a toolchain based on binutils-2.11.2 or
later and gcc-3.0.1 or later.
2001-10-29 12:04:23 +00:00
Doug Rabson c3338474b9 Make the various bits of SMP code conditional on SMP so that I can still
build non-SMP kernels.
2001-10-29 11:57:12 +00:00
Doug Rabson c543113849 Various fixes to make stack traces using the unwind tables work properly. 2001-10-29 11:30:54 +00:00
Doug Rabson 15b209a6f5 Fix disassembly of 'add a=b,c,1' and make the disassembly of the various
break and nops consistent.
2001-10-29 11:26:10 +00:00
Peter Wemm 0050cf3e5d The size of the ELF hash table changed from 64 bits in the prototype
toolchains to 32 bits in 2.11.2.

Obtained from:	dfr
2001-10-29 10:20:19 +00:00
Marcel Moolenaar 256e103fcf o Send a test IPI from the BSP to itself at the same time APs
are woken up.
o  Make IPIs synchronuous by default. If we want asynchronuous
   IPIs, we may want to make the memory fence controllable.
2001-10-29 07:34:48 +00:00
Marcel Moolenaar b1ef773d12 Add an IPI used for testing proper operation of delivering IPIs. 2001-10-29 07:30:37 +00:00
Marcel Moolenaar b5f7b8be86 Make the clock vector 255 instead of 240. On Lion boxes, 240 is
the AP wake-up vector. We probably want a more dynamic approach
to assigning vectors in the future...
2001-10-29 05:17:36 +00:00
Marcel Moolenaar cd85e2620d Small correction in the LOCAL_SAPIC structure. The Flags field
starts at offset 8; not 6. Hence the structure is 12 bytes and
not 10 bytes. Adjust the definition so that the ProcessorEnabled
flag is moved from bit 15 to bit 31 in the Flags field.

The definition now matches ACPI 2.0 Errata 1.5.
2001-10-29 04:59:35 +00:00
Marcel Moolenaar 229778f87e o Do not parse the MADT as a side-effect in AcpiOsGetRootPointer,
do it as a side-effect of probing for MP hardware. This allows
   us to scan for local SAPICs early (especially before MBUF
   initialization).
o  Fix the Local SAPIC structure so that matches the Local SAPIC
   table entry. Now that the Local SAPIC info is the same as the
   Local APIC info, stop dumping the Local APIC entries.
o  For every Local SAPIC entry in the MADT that's not disabled,
   let the SMP code know about it. They represent actual CPUs.
o  Register the OS_BOOT_RENDEZ entry point and provide a (bogus)
   implementation for the entry point.
o  Provide a mapping for internal IPI numbers to ExtINT vectors.
o  In a MP system, announce the CPUs and start them by sending
   IPI_AP_WAKEUP to each of them. Not that it makes a difference
   at this time :-)
o  Miscellaneous style fixes and other adjustments.
2001-10-29 02:16:02 +00:00
Mitsuru IWASAKI f86214b6b8 Add APM compatibility feature to ACPI.
This emulates APM device node interface APIs (mainly ioctl) and
provides APM services for the applications.  The goal is to support
most of APM applications without any changes.
Implemented ioctls in this commit are:
 - APMIO_SUSPEND (mapped ACPI S3 as default but changable by sysctl)
 - APMIO_STANDBY (mapped ACPI S1 as default but changable by sysctl)
 - APMIO_GETINFO and APMIO_GETINFO_OLD
 - APMIO_GETPWSTATUS

With above, many APM applications which get batteries, ac-line
info. and transition the system into suspend/standby mode (such as
wmapm, xbatt) should work with ACPI enabled kernel (if ACPI works well :-)

Reviewed by:	arch@, audit@ and some guys
2001-10-26 17:43:05 +00:00
John Baldwin 8e2e767b1f Add a per-thread ucred reference for syscalls and synchronous traps from
userland.  The per thread ucred reference is immutable and thus needs no
locks to be read.  However, until all the proc locking associated with
writes to p_ucred are completed, it is still not safe to use the per-thread
reference.

Tested on:	x86 (SMP), alpha, sparc64
2001-10-26 08:12:54 +00:00
Doug Rabson 04c2a8f6be * Clear the TLB on boot.
* If a pte for a location given to pmap_enter_quick is valid, just give
  up - don't panic, even if the mapping is different.
2001-10-24 21:22:08 +00:00
Doug Rabson 45740e15b4 If we get an unhandled page fault in kernel mode, either panic (if
pcb_onfault is not set) or arrange to restart at the location in
pcb_onfault.

This ought to help the stability of a system under moderate load. It
certainly stops DDB from hanging the kernel when it tries to access a
non-present page.
2001-10-24 21:20:50 +00:00
Marcel Moolenaar 3a6ec54e58 Remove call to cninit_finish. This is part of the multiple
low-level console support.
2001-10-24 08:06:55 +00:00
Marcel Moolenaar 39a4abbe0c Add parse functions for local APIC and I/O APIC entries.
Also, show when a local APIC or SAPIC is disabled.
2001-10-24 04:48:05 +00:00
Peter Wemm 76792d87a8 Fix RAW dependency violation when compiled with gcc-3
Warning: Use of 'br.ret.sptk.many' violates RAW dependency 'PSR.tb' (data)
2001-10-23 22:23:22 +00:00
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