Commit Graph

3937 Commits

Author SHA1 Message Date
Peter Wemm
4af5a3de60 Add acpi to the build. Remove the hack from machdep.c that lies to the
loader to shut it up.
2003-05-31 07:00:08 +00:00
Peter Wemm
b043c80645 Have hammer_time() return the proc0 stack location, and have locore
switch to it before calling mi_startup().  The bootstack is WAY too small
for running acpica during probe/attach.  While here, pass modulep/physfree
to the startup routine, rather than writing to the global variables in
locore.S.

Approved by:  re (amd64/*)
2003-05-31 06:54:29 +00:00
Peter Wemm
5681a6f60d Regenerate. 2003-05-31 06:51:04 +00:00
Peter Wemm
1f5b79bc16 Make this compile with WITNESS enabled. It wants the syscall names. 2003-05-31 06:49:53 +00:00
Peter Wemm
ff7bf2f72e Port acpica to amd64.
Approved by:  re (amd64/* blanket)
2003-05-31 06:47:05 +00:00
Peter Wemm
cc71eb5e10 With the help of jhb, fix the ACPI_ACQUIRE_GLOBAL_LOCK() macros and
port to amd64 after repocopy.

Approved by: re (amd64/*)
2003-05-31 06:43:55 +00:00
Hiten Pandya
b77c32a07e Rename BUS_DMAMEM_NOSYNC to BUS_DMA_COHERENT.
The current name is confusing, because it indicates to
the client that a bus_dmamap_sync() operation is not
necessary when the flag is specified, which is wrong.

The main purpose of this flag is to hint the underlying
architecture that DMA memory should be mapped in a coherent
way, but the architecture can ignore it.  But if the
architecture does supports coherent mapping of memory, then
it makes bus_dmamap_sync() calls cheap.

This flag is the same as the one in NetBSD's Bus DMA.

Reviewed by: gibbs, scottl, des (implicitly)
Approved by: re@ (jhb)
2003-05-30 20:40:33 +00:00
Peter Wemm
5c980babcd Nasty 'make it compile' port to amd64. Note that it needs some other
wire protocol for the extra registers.  I should probably just remove it
from here for now since its quite useless.

Approved by:	re (amd64/* blanket)
2003-05-30 01:02:52 +00:00
Peter Wemm
5feb2148ba Initial port to amd64 after repocopy from i386. Note that the
disassembler has not been updated yet, and will do some very strange
things.  It does tracebacks (without function arguments due to regparm
calling conventions) if -fno-omit-frame-pointer is used (to come later).
This achieves basic functionality.

Approved by:	re (amd64/* blanket)
2003-05-30 01:01:07 +00:00
Peter Wemm
0afbc83dfd Add setjmp/longjmp for ddb 2003-05-30 00:58:48 +00:00
Peter Wemm
5e1b7df5cf Update AMD Features vector to include NX (page table entry no-execute bit)
and LM (long mode) etc.
2003-05-27 21:59:56 +00:00
Scott Long
7e71df9339 Bring back bus_dmasync_op_t. It is now a typedef to an int, though the
BUS_DMASYNC_ definitions remain as before.  The does not change the ABI,
and reverts the API to be a bit more compatible and flexible.  This has
survived a full 'make universe'.

Approved by:	re (bmah)
2003-05-27 04:59:59 +00:00
Scott Long
c87d464f28 De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways.
No need for it to pollute the 5.x API any further.

Approved by:	re (bmah)
2003-05-26 04:00:52 +00:00
Peter Wemm
3ebd9b48ce Stop profiled libc from exploding, matching gcc's generated code.
Approved by: re (amd64/* blanket)
2003-05-24 18:24:03 +00:00
Peter Wemm
d9cd1af4aa Typo fix. oops.
Submitted by:  jmallett
Approved by:   re (blanket amd64/*)
2003-05-23 06:36:46 +00:00
Peter Wemm
cbd667fa2f Update comments. Note that the kernel is at -1GB, not -2GB as erroniously
implied by the previous commit.  KVM is still only 1GB until
pmap_growkernel() learns about the extra page table level.

Approved by:  re (blanket)
2003-05-23 06:35:45 +00:00
Peter Wemm
f229f5cf85 As suggested by the gdb folks, pad the 'struct fpreg' to a full 512 bytes
to match the native fxsave/fxrstor object size since thats apparently what
the Linux/NetBSD folks do.
2003-05-23 06:31:56 +00:00
Peter Wemm
9f0c4ab393 Deal with the user VM space expanding. 32 bit applications do not like
having their stack at the 512GB mark.  Give 4GB of user VM space for 32
bit apps.  Note that this is significantly more than on i386 which gives
only about 2.9GB of user VM to a process (1GB for kernel, plus page
table pages which eat user VM space).

Approved by: re (blanket)
2003-05-23 05:07:33 +00:00
Peter Wemm
3c9a3c9ca3 Major pmap rework to take advantage of the larger address space on amd64
systems.  Of note:
- Implement a direct mapped region using 2MB pages.  This eliminates the
  need for temporary mappings when getting ptes.  This supports up to
  512GB of physical memory for now.  This should be enough for a while.
- Implement a 4-tier page table system.  Most of the infrastructure is
  there for 128TB of userland virtual address space, but only 512GB is
  presently enabled due to a mystery bug somewhere.  The design of this
  was heavily inspired by the alpha pmap.c.
- The kernel is moved into the negative address space(!).
- The kernel has 2GB of KVM available.
- Provide a uma memory allocator to use the direct map region to take
  advantage of the 2MB TLBs.
- Fixed some assumptions in the bus_space macros about the ability
  to fit virtual addresses in an 'int'.

Notable missing things:
- pmap_growkernel() should be able to grow to 512GB of KVM by expanding
  downwards below kernbase.  The kernel must be at the top 2GB of the
  negative address space because of gcc code generation strategies.
- need to fix the >512GB user vm code.

Approved by:	re (blanket)
2003-05-23 05:04:54 +00:00
Peter Wemm
997f3bfc2a Merge from i386/trap.c rev 1.252. Use td_critnest instead of the
spinlocks count for explicitly enabling interrupts.

Approved by:	re (blanket)
2003-05-22 20:09:50 +00:00
Alexander Kabaev
980ded9a7d sys/sys/limits.h:
- Fix visibilty test for LONG_BIT and WORD_BIT.  `#if defined(__FOO_VISIBLE)'
   is alays wrong because __FOO_VISIBLE is always defined (to 0 for
   invisibility).

sys/<arch>/include/limits.h
sys/<arch>/include/_limits.h:

 - Style fixes.

Submitted by:	bde
Reviewed by:	bsdmike
Approved by:	re (scottl)
2003-05-19 20:29:07 +00:00
Peter Wemm
5c0fe26236 Actually get all the bits for sd_hibase.. it was 16 bits short. oops.
Approved by:	re (amd64/* blanket)
2003-05-17 02:05:10 +00:00
Alan Cox
4a0d6dfd2c Initialize logical_cpus_mask when the logical CPUs are enumerated in
the mptable.  (Previously, logical_cpus_mask was only initialized if
the hyperthreading fixup was executed.)

Approved by:	re (jhb)
Reviewed by:	ps
2003-05-15 05:12:24 +00:00
Peter Wemm
c0a54ff621 Collect the nastiness for preserving the kernel MSR_GSBASE around the
load_gs() calls into a single place that is less likely to go wrong.

Eliminate the per-process context switching of MSR_GSBASE, because it
should be constant for a single cpu.  Instead, save/restore it during
the loading of the new %gs selector for the new process.

Approved by:	re (amd64/* blanket)
2003-05-15 00:23:40 +00:00
Peter Wemm
be52ef1399 Use compile time constants for things like PTmap[] etc because they're
about to move outside of the +/- 2GB range

Suggested by:	jake
Approved by:	re (amd64/* blanket)
2003-05-15 00:20:17 +00:00
Peter Wemm
e14528b349 Regen
Approved by: re (amd64 blanket)
2003-05-14 04:11:25 +00:00
Peter Wemm
d85631c4ac Add BASIC i386 binary support for the amd64 kernel. This is largely
stolen from the ia64/ia32 code (indeed there was a repocopy), but I've
redone the MD parts and added and fixed a few essential syscalls.  It
is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic)
and p4.  The ia64 code has not implemented signal delivery, so I had
to do that.

Before you say it, yes, this does need to go in a common place.  But
we're in a freeze at the moment and I didn't want to risk breaking ia64.
I will sort this out after the freeze so that the common code is in a
common place.

On the AMD64 side, this required adding segment selector context switch
support and some other support infrastructure.  The %fs/%gs etc code
is hairy because loading %gs will clobber the kernel's current MSR_GSBASE
setting.  The segment selectors are not used by the kernel, so they're only
changed at context switch time or when changing modes.  This still needs
to be optimized.

Approved by:	re (amd64/* blanket)
2003-05-14 04:10:49 +00:00
Peter Wemm
5d5ca6d75e Fix some misunderstandings about 64 bit extension.
Fix fuword/suword - they're supposed to be 'long' - ie: point them
at fuword64/suword64 instead of the incorrect 32 bit versions.
2003-05-14 03:38:13 +00:00
John Baldwin
90af4afacb - Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
  M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
  sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
  that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
  and thread_stopped() are now MP safe.

Reviewed by:	arch@
Approved by:	re (rwatson)
2003-05-13 20:36:02 +00:00
Peter Wemm
8a6d52c3f8 Really stop the loader from trying to load the acpi module by lying and
pretending that it is already here.

Approved by:	re (amd64/* stuff)
2003-05-12 18:37:56 +00:00
Peter Wemm
0fe93e7480 For the page fault handler, save %cr2 in the outer trap handler so that
we do not have to run so long with interrupts disabled.  This involved
creating tf_addr in the trapframe.  Reorganize the trap stubs so that
they consistently reserve the stack space and initialize any missing
bits.

Approved by:	re (amd64 stuff)
2003-05-12 18:33:19 +00:00
Peter Wemm
0f6241620b Sync ucontext with reality. The struct trapframe changes need to be
reflected here.

Approved by:	re (blanket amd64/*)
2003-05-12 18:23:04 +00:00
Peter Wemm
e9b193dc33 AMD64 physical space is much larger than i386, de-i386 the bus_space and
bus_dma MD code for AMD64.  (And a trivial ifdef update in dev/kbd because
of this).  More updates are needed here to take advantage of the 64 bit
instructions.

Approved by:	re (blanket amd64/*)
2003-05-12 02:44:37 +00:00
Peter Wemm
bf1e897425 Give a %fs and %gs to userland. Use swapgs to obtain the kernel %GS.base
value on entry and exit.  This isn't as easy as it sounds because when
we recursively trap or interrupt, we have to avoid duplicating the
swapgs instruction or we end up back with the userland %gs.  I implemented
this by testing TF_CS to see if we're coming from supervisor mode
already, and check for returning to supervisor. To avoid a race with
interrupts in the brief period after beginning executing the handler and
before the swapgs, convert all trap gates to interrupt gates, and reenable
interrupts immediately after the swapgs.  I am not happy with this.
There are other possible ways to do this that should be investigated.
(eg: storing the GS.base MSR value in the trapframe)

Add some sysarch functions to let the userland code get to this.

Approved by:	re (blanket amd64/*)
2003-05-12 02:37:29 +00:00
Peter Wemm
85983c59cd Call it an AMD64 Processor, not a Hammer. Also, it seems that the cpuid
model numbers are wider than I first thought.

Approved by: re (blanket amd64/*)
2003-05-11 23:01:04 +00:00
Peter Wemm
f75b005a99 I missed another printf format error while extracting the patch.
Approved by: re (blanket amd64/*)
2003-05-11 22:55:40 +00:00
Peter Wemm
eeee69d45c Make atdevbase long for the KERNBASE > 4GB case
Approved by: re (amd64/* blanket)
2003-05-11 22:53:43 +00:00
Peter Wemm
5a337b2589 Fix printf format errors that were undetected due to using the standard
FSF compiler during early development.
2003-05-11 22:40:25 +00:00
Peter Wemm
5048926df9 Export PML4SHIFT and PDPSHIFT
Approved by: re (blanket amd64/*)
2003-05-11 22:39:40 +00:00
Peter Wemm
4ce3e250ce Since compiling natively, the compile environment has been less forgiving
about silly typos.  Use the correct comment sequences.
2003-05-11 22:38:54 +00:00
Peter Wemm
0fe0f2515b Provide a fake varargs implementation for lint's benefit. This way
it can see the intent of the va_* macros, even though it cannot work.

Approved by:	re (blanket amd64/*)
2003-05-10 00:55:15 +00:00
Peter Wemm
e1ef71de2b Remove _ARCH_INDIRECT ifdefs. They existed for lib/msun/* on i386, which
could use different versions of the math code depending on whether there
was real floating point hardware or math emulation.  Since the fpu is
part of the core specification on amd64, there is no need for this here.

Approved by:	re (blanket amd64/*)
2003-05-10 00:53:34 +00:00
Peter Wemm
2e4f687a1d bcopyb() isn't used on amd64 kernel (it only exists for i386/pcvt)
Approved by:	re (blanket amd64/*)
2003-05-10 00:51:29 +00:00
Peter Wemm
5826a47e9b Finish translating i386/support.s into amd64 asm - replace bcopy etc with
asm versions.  This yields about a 5% kernel compile time speedup.
2003-05-10 00:49:56 +00:00
Peter Wemm
395e65aa29 Include the MXCSR initial values, based on the AMD docs. This file
should really be renamed to fpu.h and npx.c to fpu.c since its part of
the core architecture on amd64 systems, not an isa 'numeric processor
extension'.
2003-05-09 18:28:05 +00:00
Peter Wemm
14426b9c3b Turn syscons on now that it works, so that anybody trying to run this
can see something.  Probing for keyboard still works for auto serial
console mode.
2003-05-09 18:26:06 +00:00
Peter Wemm
b3f7680e49 Oops. Turn T_PAGEFLT back into an interrupt gate. It is *critical*
that interrupts be disabled and remain disabled until %cr2 is read.
Otherwise we can preempt and another process can fault, and by the
time we read %cr2, we see a different processes fault address.  This
Greatly Confuses vm_fault() (to say the least).  The i386 port has
got this marked as a bug workaround for a Cyrix CPU, which is what
lead me astray.  Its actually necessary for preemption, regardless
of whether Cyrix cpus had a bug or not.
2003-05-08 08:25:51 +00:00
Peter Wemm
2dbe628162 Leave space for the 128 byte red-zone on the stack. 2003-05-08 00:13:24 +00:00
Peter Wemm
f3b234157e #include <machine/metadata.h> was missing; add it 2003-05-08 00:12:37 +00:00
Peter Wemm
9c43b77ff5 Fix a preemption race. I was reenabling interrupts in the fast system
call handler before it was safe.  It was possible for to lose context
and for something else to clobber the PCPU scratch variable.  This
moves the interrupt enable *way* too late, but its better safe than
sorry for the moment.
2003-05-08 00:05:00 +00:00
John Baldwin
ace85d0a3c Style nits.
Approved by:	re (bmah)
2003-05-07 17:21:38 +00:00
Alexander Kabaev
0eda4c08a5 Style fixes.
Remove DBL_DIG, DBL_MIN, DBL_MAX and their FLT_ counterparts, they
were marked for deprecation ever since SUSv1 at least.
Only define ULLONG_MIN/MAX and LLONG_MAX if long long type is
supported.
Restore a lost comment in MI _limits.h file and remove it from
sys/limits.h where it does not belong.
2003-05-04 22:13:04 +00:00
Peter Wemm
5b27e93419 Repocopy *.s to *.S 2003-05-03 00:21:43 +00:00
Peter Wemm
abf50ec921 I changed the numbering of the MODINFOMD_SMAP during the commit, so
recognize the old number for my development boxes so I can use old
loader/pxeboot for a while if I need to.
2003-05-01 04:18:02 +00:00
Peter Wemm
7f47668191 Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values
that were added to sparc64 and later powerpc, really should have been in
the MI area.  But changing that now with insufficient preperation will
just cause too much pain.

Move MD_FETCH() to the MI sys/linker.h file to avoid another two copies
of it.
2003-05-01 03:31:18 +00:00
Peter Wemm
afa8862328 Commit MD parts of a loosely functional AMD64 port. This is based on
a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to
attempt to get a stable base to start from.  There is a lot missing still.
Worth noting:
- The kernel runs at 1GB in order to cheat with the pmap code.  pmap uses
  a variation of the PAE code in order to avoid having to worry about 4
  levels of page tables yet.
- It boots in 64 bit "long mode" with a tiny trampoline embedded in the
  i386 loader.  This simplifies locore.s greatly.
- There are still quite a few fragments of i386-specific code that have
  not been translated yet, and some that I cheated and wrote dumb C
  versions of (bcopy etc).
- It has both int 0x80 for syscalls (but using registers for argument
  passing, as is native on the amd64 ABI), and the 'syscall' instruction
  for syscalls.  int 0x80 preserves all registers, 'syscall' does not.
- I have tried to minimize looking at the NetBSD code, except in a couple
  of places (eg: to find which register they use to replace the trashed
  %rcx register in the syscall instruction).  As a result, there is not a
  lot of similarity.  I did look at NetBSD a few times while debugging to
  get some ideas about what I might have done wrong in my first attempt.
2003-05-01 01:05:25 +00:00
Peter Wemm
1e57e9eba3 Repocopy from x86_64/... to amd64/...
Rename visible x86_64 references to amd64.
Kill MID_MACHINE, its a.out specific, the only platform that supports it
is i386.  All of the other platforms should remove it too.
2003-04-30 22:51:59 +00:00
John Baldwin
d90e753aa8 Range check the syscall number before looking it up in the syscallnames[]
array.

Submitted by:	pho
2003-04-30 17:59:27 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Mark Murray
f17615daca Warns fixing. Protect against inappropriate linting, and mark
GCC-specific assemble code as such (in #ifdefs). Fix an easy
static variable warning while I'm here.
2003-04-30 12:23:58 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Jake Burkholder
14ce5bd49b Use inlines for loading and storing page table entries. Use cmpxchg8b for
the PAE case to ensure idempotent 64 bit loads and stores.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-28 20:35:36 +00:00
John Baldwin
7ff022c485 - Push down Giant into the sysarch() calls that still need Giant.
- Standardize on EINVAL rather than EOPNOTSUPP if the sysarch op value is
  invalid.
2003-04-25 20:04:02 +00:00
John Baldwin
d8ca78d02f Regen. 2003-04-25 15:59:44 +00:00
John Baldwin
9fb3809a3a Oops, the thr_* and jail_attach() syscall entries should be NOPROTO rather
than STD.
2003-04-25 15:59:18 +00:00
Jake Burkholder
ffad008fcd Remove harmless invalid cast.
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-25 15:07:58 +00:00
Daniel Eischen
1328e1c4be Add an argument to get_mcontext() which specified whether the
syscall return values should be cleared.  The system calls
getcontext() and swapcontext() want to return 0 on success
but these contexts can be switched to at a later time so
the return values need to be cleared in the saved register
sets.  Other callers of get_mcontext() would normally want
the context without clearing the return values.

Remove the i386-specific context saving from the KSE code.
get_mcontext() is not i386-specific any more.

Fix a bad pointer in the alpha get_mcontext() code.  The
context was being bcopy()'d from &td->tf_frame, but tf_frame
is itself a pointer, so the thread was being copied instead.
Spotted by jake.

Glanced at by:  jake
Reviewed by:    bde (months ago)
2003-04-25 01:50:30 +00:00
John Baldwin
9bc65d35f2 Regen. 2003-04-24 20:50:57 +00:00
John Baldwin
d46b3412dc Fix the thr_create() entry by adding a trailing \. Also, sync up the
MP safe flag for thr_* with the main table.
2003-04-24 20:49:46 +00:00
David Xu
e63c419732 Don't print anything for fault at cpu_switch_load_gs, just like other
code to recover fault in doreti because of invalid segment registers,
silently push error to userland.
2003-04-24 01:48:59 +00:00
Alexander Kabaev
6fd839f9c7 Add a new sys/limits.h file which in turn depends on machine/_limits.h
to get actual constant values. This is in preparation for machine/limits.h
retirement.

Discussed on:	standards@
Submitted by:	Craig Rodrigues <rodrigc@attbi.com>  (*)
Modified by:	kan
2003-04-23 21:41:59 +00:00
John Baldwin
fe8cdcae87 - Replace inline implementations of sigprocmask() with calls to
kern_sigprocmask() in the various binary compatibility emulators.
- Replace calls to sigsuspend(), sigaltstack(), sigaction(), and
  sigprocmask() that used the stackgap with calls to the corresponding
  kern_sig*() functions instead without using the stackgap.
2003-04-22 18:23:49 +00:00
David Xu
97637bcfb2 Move down intr level testing code a bit, cpu_switch_load_gs fault can be at
interrupt nested time.
2003-04-22 08:12:03 +00:00
David Xu
5515888875 Fix some problems for cpu_switch_load_gs. when fault address is at
cpu_switch_load_gs, cpu is in context switch, so don't enable interrupt.
because it is in context switch, it is expected sched_lock was held,
so don't PROC_LOCK(p) and psignal, it is LOR, probably we can
set a P_XSIGBUS like flag in p_sflags, and set TDF_ASTPENDING in
td_flags, in ast(), post a SIGBUS to process if P_XSIGBUS was set.
2003-04-22 07:45:47 +00:00
David Xu
5b70587b8a Remove single threading detecting code, these code really should be
replaced by thread_user_enter(), but current we don't want to enable
this in trap.
2003-04-22 03:17:41 +00:00
Hidetoshi Shimokawa
092cd06fcd Add FireWire drivers to GENERIC. 2003-04-21 16:44:05 +00:00
David Xu
6625036082 Reset pcb_gs and %gs before possibly invalidating it. 2003-04-21 15:05:05 +00:00
Bill Paul
87b4a25958 Add device driver support for the ASIX Electronics AX88172 USB 2.0
ethernet controller. The driver has been tested with the LinkSys
USB200M adapter. I know for a fact that there are other devices out
there with this chip but don't have all the USB vendor/device IDs.

Note: I'm not sure if this will force the driver to end up in the
install kernel image or not. Special magic needs to be done to exclude
it to keep the boot floppies from bloating again, someone please
advise.
2003-04-20 19:05:33 +00:00
David Xu
d1fc2022c3 Backout my last commit.
Requested by: bde
2003-04-20 01:35:21 +00:00
David Xu
2bdf11638e Don't return garbage in high 16 bits. 2003-04-19 02:40:39 +00:00
John Baldwin
889a6b5845 Use the proc lock to protect p_singlethread and a P_WEXIT test. This
fixes a couple of potential KSE panics on non-i386 arch's that weren't
holding the proc lock when calling thread_exit().
2003-04-18 20:20:00 +00:00
John Baldwin
ee6c1d2ed2 Hold the proc lock for curproc around sigonstack(). 2003-04-18 20:09:04 +00:00
John Baldwin
8365f5bf7c Remove a couple of unused symbols. 2003-04-17 22:17:28 +00:00
Maxime Henrion
0cb112309a style(9) 2003-04-15 03:11:03 +00:00
Hidetoshi Shimokawa
c8990f0d8e Restore delayed load support for the resource shortage case.
It was missed in the previous change.
Now, _bus_dmamap_load_buffer() accepts BUS_DMA_WAITOK/BUS_DMA_NOWAIT flags.

Original idea from: jake
2003-04-14 13:21:40 +00:00
Hidetoshi Shimokawa
f5270431be * Use _bus_dmamap_load_buffer() and respect maxsegsz in bus_dmamap_load().
Ignoring maxsegsz may lead to fatal data corruption for some devices.
ex. SBP-2/FireWire
We should apply this change to other platforms except for sparc64.

MFC after: 1 week
2003-04-14 04:19:42 +00:00
David Xu
2257a44ffd Copy %gs from current CPU not from a stale PCB backup. 2003-04-11 14:47:34 +00:00
David Xu
d8c586e73a set_user_ldt_rv() should check same proc not thread,
this commit fixes an user LDT smp rendezvous bug.
2003-04-11 14:45:07 +00:00
Dag-Erling Smørgrav
0da46d776b Convert the SMP_TSC kernel option into a loader tunable. Also enable
the TSC timecounter on single-CPU systems even when they are running
an SMP kernel.
2003-04-10 23:07:24 +00:00
Maxime Henrion
141bacb048 Change the operation parameter of bus_dmamap_sync() from an
enum to an int and redefine the BUS_DMASYNC_* constants as
flags.  This allows us to specify several operations in one
call to bus_dmamap_sync() as in NetBSD.
2003-04-10 23:03:33 +00:00
Julian Elischer
060563ec50 Move the _oncpu entry from the KSE to the thread.
The entry in the KSE still exists but it's purpose will change a bit
when we add the ability to lock a KSE to a cpu.
2003-04-10 17:35:44 +00:00
Wes Peters
c2ff1e1682 Add a sysctl that records and reports the CPU clock rate calculated
at boot.  Funny how often this trivial piece of information crops up
in embedded boxen.

Sponsored by:   St. Bernard Software
2003-04-10 07:05:24 +00:00
Mike Barcroft
fd7a8150fb o In struct prison, add an allprison linked list of prisons (protected
by allprison_mtx), a unique prison/jail identifier field, two path
  fields (pr_path for reporting and pr_root vnode instance) to store
  the chroot() point of each jail.
o Add jail_attach(2) to allow a process to bind to an existing jail.
o Add change_root() to perform the chroot operation on a specified
  vnode.
o Generalize change_dir() to accept a vnode, and move namei() calls
  to callers of change_dir().
o Add a new sysctl (security.jail.list) which is a group of
  struct xprison instances that represent a snapshot of active jails.

Reviewed by:	rwatson, tjr
2003-04-09 02:55:18 +00:00
Jake Burkholder
ac00210525 Remove invalid cast to vm_offset_t to avoid truncating a physical address
when doing pmap_kextract on a 2MB page.

Spotted by:	peter
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-08 18:22:41 +00:00
Jake Burkholder
fce2287796 Add support for bounce buffers to _bus_dmamap_load_buffer, which is the
backend for bus_dmamap_load_mbuf and bus_dmamap_load_uio.

- Increaes MAX_BPAGES to 512.  Less than this causes fxp to quickly runs out
  of bounce pages.
- Add an argument to reserve_bounce_pages indicating wether this operation
  should fail or be queued for later processing if we run out of memory.
  The EINPROGRESS return value is not handled properly by consumers of
  bus_dmamap_load_mbuf.
- If bounce buffers are required allocate minimum 1 bounce page at map
  creation time.  If maxsize was small previously this could get truncated
  to 0 and the drivers would quickly run out of bounce pages.
- Fix a bug handling the return value of alloc_bounce_pages at map creation
  time.  It returns the number of pages allocated, not 0 on success.
- Use bus_addr_t for physical addresses to avoid truncation.
- Assert that the map is non-null and not the no bounce map in
  add_bounce_pages.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 16:08:32 +00:00
Jake Burkholder
46ea68dd10 Better fix for previous previous which still allows the 4megs of kva at
the top of the address space to be reclaimed.  The problem is that with
the APTD gone the mapable kernel address space runs right to the end of
the 32 bit address space.  As a max this is 0x100000000, which can't be
represented in 32 bits, so we have to use ptd entry n-1 and pte offset
n-1, instead of ptd entry n and pte offset 0.  There's still 1 page we
can't use, but we gain just under 4 megs of kva (8 megs with PAE).

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 14:27:19 +00:00
Peter Wemm
c81e825f6c Unbreak the !LAZY_SWITCH case. I #ifdef'ed too much when I added
the ifdefs prior to commit and killed the same-address-space test.

Submitted by:	bde
2003-04-05 22:18:14 +00:00
Tor Egge
fd6d48b8e8 Add SMP_TSC option, which can be used on SMP systems where the TSCs
are synchronized to reduce context switch cost.
2003-04-04 23:54:46 +00:00
Dag-Erling Smørgrav
9f45b2da8f Define ovbcopy() as a macro which expands to the equivalent bcopy() call,
to take care of the KAME IPv6 code which needs ovbcopy() because NetBSD's
bcopy() doesn't handle overlap like ours.

Remove all implementations of ovbcopy().

Previously, bzero was a function pointer on i386, to save a jmp to
bzero_vector.  Get rid of this microoptimization as it only confuses
things, adds machine-dependent code to an MD header, and doesn't really
save all that much.

This commit does not add my pagezero() / pagecopy() code.
2003-04-04 17:29:55 +00:00
Jake Burkholder
d1d03c2b72 Bandaid fix for previous commit while I figure out why it broke. This
caused crashes early in boot on i386 UP machines.

Reported by:	phk
Pointy hat to:	jake
2003-04-04 10:09:44 +00:00
Jake Burkholder
163529c2b3 - Removed APTD and associated macros, it is no longer used.
BANG BANG BANG etc.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-03 23:44:35 +00:00
Peter Wemm
cc66ebe2a9 Commit a partial lazy thread switch mechanism for i386. it isn't as lazy
as it could be and can do with some more cleanup.  Currently its under
options LAZY_SWITCH.  What this does is avoid %cr3 reloads for short
context switches that do not involve another user process.  ie: we can
take an interrupt, switch to a kthread and return to the user without
explicitly flushing the tlb.  However, this isn't as exciting as it could
be, the interrupt overhead is still high and too much blocks on Giant
still.  There are some debug sysctls, for stats and for an on/off switch.

The main problem with doing this has been "what if the process that you're
running on exits while we're borrowing its address space?" - in this case
we use an IPI to give it a kick when we're about to reclaim the pmap.

Its not compiled in unless you add the LAZY_SWITCH option.  I want to fix a
few more things and get some more feedback before turning it on by default.

This is NOT a replacement for Bosko's lazy interrupt stuff.  This was more
meant for the kthread case, while his was for interrupts.  Mine helps a
little for interrupts, but his helps a lot more.

The stats are enabled with options SWTCH_OPTIM_STATS - this has been a
pseudo-option for years, I just added a bunch of stuff to it.

One non-trivial change was to select a new thread before calling
cpu_switch() in the first place.  This allows us to catch the silly
case of doing a cpu_switch() to the current process.  This happens
uncomfortably often.  This simplifies a bit of the asm code in cpu_switch
(no longer have to call choosethread() in the middle).  This has been
implemented on i386 and (thanks to jake) sparc64.  The others will come
soon.  This is actually seperate to the lazy switch stuff.

Glanced at by:  jake, jhb
2003-04-02 23:53:30 +00:00
Jake Burkholder
cef57e7624 - Make casuptr return the old value of the location we're trying to update,
and change the umtx code to expect this.

Reviewed by:	jeff
2003-04-02 08:02:27 +00:00
Jeff Roberson
a0704f9de9 - Add thr and umtx system calls. 2003-04-01 01:15:56 +00:00
Jeff Roberson
b8db34d280 - Define a new md function 'casuptr'. This atomically compares and sets
a pointer that is in user space.  It will be used as the basic primitive
   for a kernel supported user space lock implementation.
 - Implement this function in x86's support.s
 - Provide stubs that return -1 in all other architectures.  Implementations
   will follow along shortly.

Reviewed by:	jake
2003-04-01 00:18:55 +00:00
Jeff Roberson
fb8aaa76c7 - In npxgetregs() use the td argument to save the fpu state from and not
curthread.  Nothing currently depends on this behavior.
 - Clean up an extra newline.

Obtained from:	bde
2003-04-01 00:16:32 +00:00
Jeff Roberson
a9b34138dc - Add a placeholder for sigwait 2003-03-31 23:36:40 +00:00
Jeff Roberson
4093529dee - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread with
a follow on commit to kern_sig.c
 - signotify() now operates on a thread since unmasked pending signals are
   stored in the thread.
 - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
2003-03-31 22:49:17 +00:00
Jeff Roberson
a35394bd84 - Fix two calls to trapsignal() that were still passing in 'struct proc'.
These were missed in my last commit.
2003-03-31 22:41:32 +00:00
Jeff Roberson
1bf4700bff - Change trapsignal() to accept a thread and not a proc.
- Change all consumers to pass in a thread.

Right now this does not cause any functional changes but it will be important
later when signals can be delivered to specific threads.
2003-03-31 22:02:38 +00:00
Jeff Roberson
4c8a7679d0 - In npxsetregs don't set the floating point if td == fpcurthread not if
curthread == fpcurthread.  This is important when we're saving the fp
   state for a thread other than curthread as in from set_mcontext.
2003-03-31 00:32:43 +00:00
Jake Burkholder
7ab9b220d9 - Add support for PAE and more than 4 gigs of ram on x86, dependent on the
kernel opition 'options PAE'.  This will only work with device drivers which
  either use busdma, or are able to handle 64 bit physical addresses.

Thanks to Lanny Baron from FreeBSD Systems for the loan of a test machine
with 6 gigs of ram.

Sponsored by:	DARPA, Network Associates Laboratories, FreeBSD Systems
2003-03-30 05:24:52 +00:00
Jake Burkholder
de54353fb8 - Remove invalid casts.
Sponsored by:	DARPA, Network Associates Laboratories
2003-03-30 01:44:16 +00:00
Jake Burkholder
aea57872f0 - Convert all uses of pmap_pte and get_ptbase to pmap_pte_quick. When
accessing an alternate address space this causes 1 page table page at
  a time to be mapped in, rather than using the recursive mapping technique
  to map in an entire alternate address space.  The recursive mapping
  technique changes large portions of the address space and requires global
  tlb flushes, which seem to cause problems when PAE is enabled.  This will
  also allow IPIs to be avoided when mapping in new page table pages using
  the same technique as is used for pmap_copy_page and pmap_zero_page.

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-30 01:16:19 +00:00
Matthew N. Dodd
50e960d918 - Move driver to newbus.
- Provide identify methods for EtherExpress and 3c507 cards; this
  means these cards no longer need wired configs.
- Provide a detach method.
2003-03-29 13:36:41 +00:00
Paul Saab
90836fcf7d Nuke HTT from here too.
Spotted by:	jhb
2003-03-26 19:55:03 +00:00
Paul Saab
87437b0b89 Nuke options HTT infavor of machdep.hlt_logical_cpus tunable/sysctl.
This keeps the logical cpu's halted in the idle loop.  By default
the logical cpu's are halted at startup.  It is also possible to
halt any cpu in the idle loop now using machdep.hlt_cpus.

Examples of how to use this:
machdep.hlt_cpus=1	halt cpu0
machdep.hlt_cpus=2	halt cpu1
machdep.hlt_cpus=4	halt cpu2
machdep.hlt_cpus=3	halt cpu0,cpu1

Reviewed by:	jhb, peter
2003-03-26 19:49:34 +00:00
Peter Wemm
bb9cca1c2f Halt the cpus in the idle loop for SMP as well for several reasons:
1) Its critical for HTT.  There's less foot-shooting opportunity.
2) I've seen significant improvements in interactive response to commands
over ssh sessions.  I assume this is less lock contention.
3) As incentive to finish the idle cpu IPI wakeup stuff.
4) The machine on my desk was blowing hot air in my general direction
because somebody forgot to turn the hlt on, and it saves 50 watts per
cpu..

The machdep.cpu_idle_hlt sysctl is still available, but now the default
is the same as on UP kernels.
2003-03-26 19:40:29 +00:00
John Baldwin
84b7dcad85 Add an options entry for HTT in SMP and GENERIC similar to the SMP and
APIC_IO options.

Requested by:	John Cagle <john.cagle@hp.com>
2003-03-25 23:31:14 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Matthew N. Dodd
b7b5ae3edb Use repo-copied files in sys/i386/bios. 2003-03-24 19:14:46 +00:00
Bruce Evans
f261b1f35f Disable interrupts while in kdb_trap() to handle cases where the caller
doesn't do it.  This fixes all known causes of "Context switches not
allowed in the debugger" in mi_switch().  The main cause was trap_fatal()
calling kdb_trap() with interrupts enabled.  Switching to ithreads for
interrupt handling then made fatal traps more fatal and harder to debug.
The problem was limited in -current because most interrupt handlers are
blocked by Giant, but it occurred almost deterministically for me because
my clock interrupt handlers are non-fast and not blocked by Giant.
2003-03-24 10:17:14 +00:00
Ruslan Ermilov
ab0f83bd03 Remove bitrot associated with `maxusers'.
Submitted by:	bde
2003-03-22 14:18:23 +00:00
David Malone
0036341d93 Extend CPU_ATHLON_SSE_HACK to cover a few more revisions of Athlon CPUs.
Submitted by: Jon Kuster <kwsn@earthlink.net>
MFC after:    2 weeks
2003-03-20 20:50:22 +00:00
Maxime Henrion
fd1b2ab0c9 Use atomic operations to increment and decrement the refcount
in busdma tags.  There are currently no tags shared accross
different drivers so this isn't needed at the moment, but it
will be required when we'll have a proper newbus method to get
the parent busdma tag.
2003-03-20 19:45:26 +00:00
Poul-Henning Kamp
b4b138c27f Including <sys/stdint.h> is (almost?) universally only to be able to use
%j in printfs, so put a newsted include in <sys/systm.h> where the printf
prototype lives and save everybody else the trouble.
2003-03-18 08:45:25 +00:00
John Baldwin
a480c73063 Expand the APIC ID mask field of the ICR register to 8 bits intead of just
4 bits.  This reportedly fixes booting on the SW7500CW2.  Much thanks to
the submitter for tracking this down!

Submitted by:	Brian Buchanan <brian@ncircle.com>
Reviewed by:	peter
MFC after:	3 days
2003-03-17 19:14:13 +00:00
Maxime Henrion
cab2362883 - Lock down the bounce pages structures. We use the same locking scheme
as with the alpha backend because both implementations of bounce pages
  are identical.
- Remove useless splhigh()/splx() calls.
2003-03-17 18:34:34 +00:00
Jake Burkholder
5501d40bb9 Made the prototypes for pmap_kenter and pmap_kremove MD. These functions
are machine dependent because they are not required to update the tlb when
mappings are added or removed, and doing so is machine dependent.
In addition, an implementation may require that pages mapped with pmap_kenter
have a backing vm_page_t, which is not necessarily true of all physical
pages, and so may choose to pass the vm_page_t to pmap_kenter instead of the
physical address in order to make this requirement clear.
2003-03-16 04:16:03 +00:00
Maxime Henrion
c0796d1cb4 Grab Giant around calls to contigmalloc() and contigfree() so
that drivers converted to be MP safe don't have to deal with it.
2003-03-13 17:18:48 +00:00
Jake Burkholder
4d3f408cee - Added support for multiple page directory pages to pmap_pinit and
pmap_release.
- Merged pmap_release and pmap_release_free_page.  When pmap_release is
  called only the page directory page(s) can be left in the pmap pte object,
  since all page table pages will have been freed by pmap_remove_pages and
  pmap_remove.  In addition, there can only be one reference to the pmap and
  the page directory is wired, so the page(s) can never be busy.  So all there
  is to do is clear the magic mappings from the page directory and free the
  page(s).

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-12 07:38:37 +00:00
Jake Burkholder
2089c5c95e Use bus_space_handle_t to represent host port and virtual addresses;
bus_addr_t may not be appropriate.

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-11 19:43:38 +00:00
David Xu
1108975fe0 Initialize eflags in fake frame to default value rather than random one.
The random value sometimes causes macro CLKF_USERMODE to return true
because PSL_VM bit is set and really shoudn't be, this causes statclock()
to execute in wrong path, and further breaks KSE code and kernel crashes
when executing threaded program.
2003-03-08 03:58:50 +00:00
Robert Watson
9283578946 Instrument sysarch() MD privileged I/O access interfaces with a MAC
check, mac_check_sysarch_ioperm(), permitting MAC security policy
modules to control access to these interfaces.  Currently, they
protect access to IOPL on i386, and setting HAE on Alpha.
Additional checks might be required on other platforms to prevent
bypass of kernel security protections by unauthorized processes.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-03-06 04:47:47 +00:00
John Baldwin
263067951a Replace calls to WITNESS_SLEEP() and witness_list() with equivalent calls
to WITNESS_WARN().
2003-03-04 21:03:05 +00:00
John Baldwin
d7a715dc64 Wrap the hyperthreading support code with the HTT kernel option.
Hyperthreading support is now off unless the HTT option is added.

MFC-after:	3 days
2003-03-04 20:24:53 +00:00
Poul-Henning Kamp
7ac40f5f59 Gigacommit to improve device-driver source compatibility between
branches:

Initialize struct cdevsw using C99 sparse initializtion and remove
all initializations to default values.

This patch is automatically generated and has been tested by compiling
LINT with all the fields in struct cdevsw in reverse order on alpha,
sparc64 and i386.

Approved by:    re(scottl)
2003-03-03 12:15:54 +00:00
John Baldwin
295435632d Expand some #ifdef's to fix I386_CPU compile.
Reported by:	Andy Farkas <andyf@speednet.com.au>
2003-02-27 20:38:48 +00:00
Alan Cox
8480cd45a5 Remove some long unused declarations. (For example, the PV flags have not
been used since revision 1.8, roughly nine years ago.)
2003-02-27 20:13:20 +00:00
Julian Elischer
ac2e415327 Change the process flags P_KSES to be P_THREADED.
This is just a cosmetic change but I've been meaning to do it for about a year.
2003-02-27 02:05:19 +00:00
Ruslan Ermilov
824018495d Implemented "nooption" and "nomakeoption" config(8) tokens.
Fixed memory leak in the "nodevice" option implementation.

Use these instead of sed(1) in MD NOTES.

Use a single makefile (sys/conf/makeLINT.mk) to generate
LINT for all architectures.  (Previous versions missed
the LINT dependency on Makefile, and i386 version also
missed the dependency on ${NOTES}.)

Fixed bugs in the previous NOTES conversion using the
"nodevice" token and sed(1):

- i386 LINT lost "device pst".

- pc98 LINT lost SC_*, MAXCONS and KBD_DISABLE_KEYMAP_LOAD
  options, and got needless DPT_* options.

- Added nooptions PPC_DEBUG, PPC_PROBE_CHIPSET, KBD_INSTALL_CDEV
  to sparc64 LINT so that it has a chance to config(8).

This basically returns us to where we were before.
2003-02-26 23:36:59 +00:00
David Xu
f5044aeb45 Better to not know anything about KSE. 2003-02-26 05:47:25 +00:00
Maxime Henrion
f6c912dd0c Correctly set BUS_SPACE_MAXSIZE in all the busdma backends.
It was bogusly set to 64 * 1024 or 128 * 1024 because it was
bogusly reused in the BUS_DMAMAP_NSEGS definition.
2003-02-26 02:16:06 +00:00
David E. O'Brien
6e818956c5 Move most everything back to a MI NOTES, and use "nodevice" in MD NOTES
Where needed.  Use 'sed' for now in place of "nooptions".  Add a sparc64
MD NOTES.

Reviewed by:	arch@
2003-02-25 20:59:23 +00:00
Jake Burkholder
0f1a7e05a2 - Added inlines pmap_is_current, pmap_is_alternate and pmap_set_alternate
for testing and setting the current and alternate address spaces.
- Changed PTDpde and APTDpde to arrays to support multiple page directory
  pages.

ponsored by:	DARPA, Network Associates Laboratories
2003-02-25 19:40:21 +00:00
David Xu
d9b05fa0b0 Remove an unsafe KASSERT. 2003-02-25 11:23:17 +00:00
Maxime Henrion
07159f9c56 Cleanup of the d_mmap_t interface.
- Get rid of the useless atop() / pmap_phys_address() detour.  The
  device mmap handlers must now give back the physical address
  without atop()'ing it.
- Don't borrow the physical address of the mapping in the returned
  int.  Now we properly pass a vm_offset_t * and expect it to be
  filled by the mmap handler when the mapping was successful.  The
  mmap handler must now return 0 when successful, any other value
  is considered as an error.  Previously, returning -1 was the only
  way to fail.  This change thus accidentally fixes some devices
  which were bogusly returning errno constants which would have been
  considered as addresses by the device pager.
- Garbage collect the poorly named pmap_phys_address() now that it's
  no longer used.
- Convert all the d_mmap_t consumers to the new API.

I'm still not sure wheter we need a __FreeBSD_version bump for this,
since and we didn't guarantee API/ABI stability until 5.1-RELEASE.

Discussed with:		alc, phk, jake
Reviewed by:		peter
Compile-tested on:	LINT (i386), GENERIC (alpha and sparc64)
Runtime-tested on:	i386
2003-02-25 03:21:22 +00:00
Jake Burkholder
5cd612b27e - Removed UMAXPTDI and UMAXPTEOFF.
- Changed VM_MAXUSER_ADDRESS to be defined in terms of PTDPTDI.  In order for
  assumptions about the recursive page table map to work it must be the base
  of the recursive map.  Any pte offset that's not NPTEPG will break these
  assumptions.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-24 20:29:52 +00:00
Yoshihiro Takahashi
2302407b21 The mpbiosreason variable does not used for pc98. 2003-02-24 14:36:03 +00:00
Jake Burkholder
28c9e1aa5c Use the direct mapping of IdlePTD setup in locore for proc0's page directory,
instead of allocating another page of kva and mapping it in again.  This was
likely an oversight in revision 1.174 (cut and paste from pmap_pinit).

Discussed with:	peter, tegge
Sponsored by:	DARPA, Network Associates Laboratories
2003-02-24 00:39:50 +00:00
Tor Egge
07d2563244 Allow machines with one CPU and a valid mp table to boot an SMP kernel. 2003-02-23 23:49:57 +00:00
Jake Burkholder
ef49a94104 Previous commit missed a 1 that should be NGPTD, and an NPDEPG that should
be NPDEPTD.  Grumble.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 22:12:08 +00:00
Jake Burkholder
910548dea7 - Added macros NPGPTD, NBPTD, and NPDEPTD, for dealing with the size of the
page directory.
- Use these instead of the magic constants 1 or PAGE_SIZE where appropriate.
  There are still numerous assumptions that the page directory is exactly
  1 page.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 21:20:00 +00:00
Jake Burkholder
e29632c9e1 - Added macros PDESHIFT and PTESHIFT, use these instead of magic constants
in locore.
- Removed the macros PTESIZE and PDESIZE, use sizeof instead in C.

Sponsored by:	DARPA, Network Associates Laboratories
2003-02-23 09:45:50 +00:00
Alan Cox
01a06ce250 The root of the splay tree maintained within the pm_pteobj always refers
to the last accessed pte page.  Thus, the pm_ptphint is redundant and can
be removed.
2003-02-22 23:43:08 +00:00
Jake Burkholder
d44f8f150c unsigned -> pt_entry_t.
Sponsored by:	DARPA, Network Associates Laboratories
2003-02-22 23:41:27 +00:00
Peter Wemm
d8fcb6da11 Fix fumble in rev 1.525. pmap_kenter()'s second argument is a physical
address, not a page index.

Laughed at by:  jake
2003-02-20 05:35:52 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Peter Wemm
af3d516f55 Initiate de-orbit burn for USE_PCI_BIOS_FOR_READ_WRITE. This has been
#if'ed out for a while.  Complete the deed and tidy up some other bits.

We need to be able to call this stuff from outer edges of interrupt
handlers for devices that have the ISR bits in pci config space.  Making
the bios code mpsafe was just too hairy.  We had also stubbed it out some
time ago due to there simply being too much brokenness in too many systems.
This adds a leaf lock so that it is safe to use pci_read_config() and
pci_write_config() from interrupt handlers.  We still will use pcibios
to do interrupt routing if there is no acpi.. [yes, I tested this]

Briefly glanced at by:  imp
2003-02-18 03:36:49 +00:00
Julian Elischer
4a338afd7a Move a bunch of flags from the KSE to the thread.
I was in two minds as to where to put them in the first case..
I should have listenned to the other mind.

Submitted by:	 parts by davidxu@
Reviewed by:	jeff@ mini@
2003-02-17 09:55:10 +00:00
Jeff Roberson
5215b1872f - Split the struct kse into struct upcall and struct kse. struct kse will
soon be visible only to schedulers.  This greatly simplifies much the
   KSE code.

Submitted by:	davidxu
2003-02-17 05:14:26 +00:00
Jeff Roberson
e4625663c9 - Move ke_sticks, ke_iticks, ke_uticks, ke_uu, ke_su, and ke_iu back into
the proc.  These counters are only examined through calcru.

Submitted by:	davidxu
Tested on:	x86, alpha, UP/SMP
2003-02-17 02:19:58 +00:00
Poul-Henning Kamp
029f0b69a4 Change "dev_t gdbdev" to "void *gdb_arg", some possible paths for GDB
will not have a dev_t.
2003-02-16 19:22:21 +00:00
Poul-Henning Kamp
f341ca9891 Remove #include <sys/dkstat.h> 2003-02-16 14:13:23 +00:00
Alan Cox
8e42580deb Assert that the kernel map's system mutex is held in pmap_growkernel(). 2003-02-15 19:23:37 +00:00
Alan Cox
e33d37b66f - Add a mutex for synchronizing the use of CMAP/CADDR 1 and 2.
- Eliminate small style differences between pmap_zero_page(),
   pmap_copy_page(), etc.
2003-02-14 07:34:28 +00:00
David E. O'Brien
36dc5b9427 Fix the style of the SCHED_4BSD commit. 2003-02-13 22:24:44 +00:00
Peter Wemm
939a4397b1 Oops. I mis-remembered about the P4 problems. It was 5.0-DP2 that
was shipped with DISABLE_PG_G and DISABLE_PSE, not 5.0-REL.  *blush*
Disable the code - but still leave it there in case its still lurking.
2003-02-13 02:42:06 +00:00
Peter Wemm
521871f1fa Turn of PG_PS and PG_G for Pentium-4 cpus at boot time. This is so
that we can stop turning off PG_G and PG_PS globally for releases.
2003-02-13 01:52:44 +00:00
Alan Cox
393a225ced Remove kptobj. Instead, use VM_ALLOC_NOOBJ. 2003-02-12 04:35:37 +00:00
Poul-Henning Kamp
70d8e2e9aa Switch to using the TSC code in i386/i386/tsc.c. 2003-02-11 11:43:25 +00:00
Mike Barcroft
8cf5ed5125 Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
  contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
  contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
  storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
  double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
  HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
  <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
  <machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
  on the size of its argument.  __fpclassifyl() is never called on
  alpha because (sizeof(long double) == sizeof(double)), which is good
  since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)
2003-02-08 20:37:55 +00:00
Alan Cox
571cd8a190 MF alpha
- Synchronize access to the allpmaps list with a mutex.
2003-02-08 05:41:41 +00:00
Peter Wemm
e2294003a2 Commit some cosmetic changes I had laying around and almost included
with another commit.  Unwrap a line.  Unexpand a pmap_kenter().
2003-02-07 01:52:06 +00:00
Poul-Henning Kamp
dd43ae4272 This file has no longer any content from the original Berkeley file so
replace the UCB copyright with a FreeBSD 2 clause thing.

Remove some no longer relevant comments.
2003-02-05 11:11:39 +00:00
Poul-Henning Kamp
d1b40f007d i386/i386/tsc.c was repo-copied from i386/isa/clock.c.
Remove all the stuff that does not relate to the TSC.

Change the calibration to use DELAY(1000000) rather than trying to check
it against the CMOS RTC, this drastically increases precision:

Using 25 samples on a Athlon 700MHz UP machine I find:

                stddev          min          max        average
CMOS             22200 Hz    -74980 Hz     34301 Hz   704928721 Hz
DELAY             1805 Hz     -1984 Hz      2678 Hz   704937583 Hz

(The difference between the two averages is not statistically significant.)

expressed in PPM of the frequency:
                stddev          min          max
CMOS             31.49 PPM  -106.37 PPM    48.66 PPM
DELAY             2.56 PPM     2.81 PPM     3.80 PPM

This code will not be used until a followup commit to sys/isa/clock.c
and sys/pc98/pc98/clock.c which will only happen after some field testing.
2003-02-05 09:20:40 +00:00
Poul-Henning Kamp
553ebddc59 Make get_cyclecount() use binuptime() when no tsc is available: it is cheaper. 2003-02-05 08:55:10 +00:00
Hartmut Brandt
e557905435 Fix a problem in bus_dmamap_load_{mbuf,uio} when the first mbuf or the first
uio segment is empty. In this case no dma segment is create by
bus_dmamap_load_buffer, but the calling routine clears the first flag.
Under certain combinations of addresses of the first and second mbuf/uio
buffer this leads to corrupted DMA segment descriptors. This was already
fixed by tmm in sparc64/sparc64/iommu.c.

PR:		kern/47733
Reviewed by:	sam
Approved by:	jake (mentor)
2003-02-04 16:30:27 +00:00
Poul-Henning Kamp
91f1c2b3cc Split the global timezone structure into two integer fields to
prevent the compiler from optimizing assignments into byte-copy
operations which might make access to the individual fields non-atomic.

Use the individual fields throughout, and don't bother locking them with
Giant: it is no longer needed.

Inspired by:    tjr
2003-02-03 19:49:35 +00:00
Jake Burkholder
238dd3209a Split statclock into statclock and profclock, and made the method for driving
statclock based on profhz when profiling is enabled MD, since most platforms
don't use this anyway.  This removes the need for statclock_process, whose
only purpose was to subdivide profhz, and gets the profiling clock running
outside of sched_lock on platforms that implement suswintr.
Also changed the interface for starting and stopping the profiling clock to
do just that, instead of changing the rate of statclock, since they can now
be separate.

Reviewed by:	jhb, tmm
Tested on:	i386, sparc64
2003-02-03 17:53:15 +00:00
Alan Cox
ca380469a2 - Make allpmaps static.
- Use atomic subtract to update the global wired pages count.  (See
   also vm/vm_page.c revision 1.233.)
 - Assert that the page queue lock is held in pmap_remove_entry().
2003-02-03 00:05:11 +00:00
Alfred Perlstein
8deebb0160 Consolidate MIN/MAX macros into one place (param.h).
Submitted by: Hiten Pandya <hiten@unixdaemons.com>
2003-02-02 13:17:30 +00:00
Josef Karthauser
c0c9e71f9a Put replace spaces with tabs in keeping with the rest of the file. 2003-02-01 18:45:18 +00:00
Julian Elischer
6f8132a867 Reversion of commit by Davidxu plus fixes since applied.
I'm not convinced there is anything major wrong with the patch but
them's the rules..

I am using my "David's mentor" hat to revert this as he's
offline for a while.
2003-02-01 12:17:09 +00:00
Poul-Henning Kamp
3c99c0bc50 Make tsc_freq a 64bit quantity.
Inspired by:    http://www.theinquirer.net/?article=7481
2003-01-29 11:36:39 +00:00
Scott Long
5193a34646 Implement bus_dmamem_alloc_size() and bus_dmamem_free_size() as
counterparts to bus_dmamem_alloc() and bus_dmamem_free().  This allows
the caller to specify the size of the allocation instead of it defaulting
to the max_size field of the busdma tag.

This is intended to aid in converting drivers to busdma.  Lots of
hardware cannot understand scatter/gather lists, which forces the
driver to copy the i/o buffers to a single contiguous region
before sending it to the hardware.  Without these new methods, this
would require a new busdma tag for each operation, or a complex
internal allocator/cache for each driver.

Allocations greater than PAGE_SIZE are rounded up to the next
PAGE_SIZE by contigmalloc(), so this is not suitable for multiple
static allocations that would be better served by a single
fixed-length subdivided allocation.

Reviewed by:	jake (sparc64)
2003-01-29 07:25:27 +00:00
Jake Burkholder
aff81a81d6 Remove BDE_DEBUGGER.
Discussed with:	bde
2003-01-28 19:05:44 +00:00
Alan Cox
d6d92c84c1 Merge pmap_testbit() and pmap_is_modified(). The latter is the only caller
of the former.
2003-01-28 03:01:35 +00:00
Julian Elischer
a18b6f65d0 Fix KSE related patch.
Make it compile for the SMP case..
statclock_process() has changed prototypes.
2003-01-26 21:32:08 +00:00
David Xu
0dbb100b9b Move UPCALL related data structure out of kse, introduce a new
data structure called kse_upcall to manage UPCALL. All KSE binding
and loaning code are gone.

A thread owns an upcall can collect all completed syscall contexts in
its ksegrp, turn itself into UPCALL mode, and takes those contexts back
to userland. Any thread without upcall structure has to export their
contexts and exit at user boundary.

Any thread running in user mode owns an upcall structure, when it enters
kernel, if the kse mailbox's current thread pointer is not NULL, then
when the thread is blocked in kernel, a new UPCALL thread is created and
the upcall structure is transfered to the new UPCALL thread. if the kse
mailbox's current thread pointer is NULL, then when a thread is blocked
in kernel, no UPCALL thread will be created.

Each upcall always has an owner thread. Userland can remove an upcall by
calling kse_exit, when all upcalls in ksegrp are removed, the group is
atomatically shutdown. An upcall owner thread also exits when process is
in exiting state. when an owner thread exits, the upcall it owns is also
removed.

KSE is a pure scheduler entity. it represents a virtual cpu. when a thread
is running, it always has a KSE associated with it. scheduler is free to
assign a KSE to thread according thread priority, if thread priority is changed,
KSE can be moved from one thread to another.

When a ksegrp is created, there is always N KSEs created in the group. the
N is the number of physical cpu in the current system. This makes it is
possible that even an userland UTS is single CPU safe, threads in kernel still
can execute on different cpu in parallel. Userland calls kse_create to add more
upcall structures into ksegrp to increase concurrent in userland itself, kernel
is not restricted by number of upcalls userland provides.

The code hasn't been tested under SMP by author due to lack of hardware.

Reviewed by: julian
2003-01-26 11:41:35 +00:00
Jeff Roberson
4183d949e0 - Remove a redundant scheduler option.
Pointy hat to:	jeff
Spotted by:	dillon
2003-01-26 06:37:43 +00:00
Jeff Roberson
c3384118a1 - Introduce the SCHED_ULE and SCHED_4BSD options for compile time selection
of the scheduler.
 - Add SCHED_4BSD as the scheduler for all kernel config files in cvs.
2003-01-26 05:29:12 +00:00
Peter Wemm
904639d710 Nuke CHEAP_TPR stuff, including LOPRIO_LEVEL (bogus) and ALLHWI_LEVEL
(which we never used).  There is no need to tweak the TPR anymore and
only causes problems.
2003-01-23 01:03:34 +00:00
Peter Wemm
2fbe601a5d Now that TPR isn't bogusly raised at boot, there is no need to clear
it at context switch.
2003-01-23 01:01:35 +00:00
John Baldwin
10deca7e68 - Move enable_sse()'s prototype to machine/md_var.h.
- Sort definition of cpu_* variables appropriately.
- Move cpu_fxsr out of the magic non-BSS set of variables and stick it in
  the BSS along with hw_instruction_sse (make the latter static as well).

Submitted by:	bde (partially)
2003-01-22 18:18:45 +00:00
John Baldwin
caf3197636 Rename cpuid_cpuinfo to cpu_procinfo. bde requested that I rename this
variable to something in the cpu_* namespace since that's what all the
other cpuid variables were named and cpu_procinfo is what I came up with.

Requested by:	bde
2003-01-22 17:54:12 +00:00
John Baldwin
f4e27c448b Bah, add in a missing space char I noticed when MFC'ing this. 2003-01-22 17:26:18 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Jake Burkholder
7251b4bf93 Resolve relative relocations in klds before trying to parse the module's
metadata.  This fixes module dependency resolution by the kernel linker on
sparc64, where the relocations for the metadata are different than on other
architectures; the relative offset is in the addend of an Elf_Rela record
instead of the original value of the location being patched.
Also fix printf formats in debug code.

Submitted by:	Hartmut Brandt <brandt@fokus.gmd.de>
PR:		46732
Tested on:	alpha (obrien), i386, sparc64
2003-01-21 02:42:44 +00:00
Marcel Moolenaar
9d683ffd4b o Move the contents of <machine/floatingpoint.h> over to
<machine/ieeefp.h> where it belongs.
o  Remove the i386 specific inclusion of <machine/floatingpoint.h>
   from <ieeefp.h>, now that including <machine/ieeefp.h> is enough
   for all architectures.
o  Allow <machine/ieeefp.h> to inline the functions exposed by the
   headers by checking for _IEEEFP_INLINED_ in the MI header. When
   defined, prototypes are not given and it is assumed that the MD
   headers, when inlining only a subset of the functions provide
   prototypes for the functions not being inlined.

Based on patch from: Terry Lambert <tlambert2@mindspring.com>
Tested with: make release.
2003-01-19 06:01:33 +00:00
Sam Leffler
18bf5d2ba6 wi now needs wlan
Reviewed by:	imp
2003-01-16 00:21:52 +00:00
Matthew Dillon
e3669cee72 Merge all the various copies of vm_fault_quick() into a single
portable copy.
2003-01-16 00:02:21 +00:00
Matthew Dillon
f597900329 Merge all the various copies of vmapbuf() and vunmapbuf() into a single
portable copy.  Note that pmap_extract() must be used instead of
pmap_kextract().

This is precursor work to a reorganization of vmapbuf() to close remaining
user/kernel races (which can lead to a panic).
2003-01-15 23:54:35 +00:00
John Baldwin
0d238da886 Remove earlysetcpuclass() as it has been OBE.
Suggested by:	bde
2003-01-09 19:59:28 +00:00
John Baldwin
f85b149dae Rework part of the previous processor name changes so that we read
cpu_exthigh and cpu_brand in printcpuinfo() instead of in identify_cpu().
We also only do it for known-good values of cpu_vendor which is a bit more
conservative.

Reviewed by:	bde (mostly)
2003-01-09 19:54:49 +00:00
John Baldwin
338633abf8 Consistently use spaces in between arguments to strcmp(). Whitespace
only.
2003-01-08 19:16:11 +00:00
John Baldwin
5b1e7cb257 - Use cpu_exthigh instead of executing cpuid again to retrieve it for the
print_AMD_foo() functions.
- Add a brand name table for the brand index provided on Intel CPU's in
  %ebx after cpuid 1.
- For Intel CPUs, if we don't get a processor name from the extended cpuid
  then use the brand index in cpuid_cpuinfo to pick a name from the brand
  table and copy that name into cpu_brand.
- Replace the duplicated code to use the extended cpuid to replace
  cpu_model with the processor name in the AMD and Transmeta sections of
  printcpuinfo() with generic code that replaces cpu_model with
  cpu_brand if cpu_brand is not an empty string.  We also trim leading
  spaces from cpu_brand prior to doing this since at least some processor
  names (notably those of Intel CPUs) have leading spaces in the name.
- Give print_AMD_features() its own private regs[] array since
  printcpuinfo() doesn't use the one it has anymore.
2003-01-08 16:41:48 +00:00
John Baldwin
26aa6d02bf - Add a cpu_exthigh variable to hold the highest extended cpuid value
returned from cpuid 0x80000000.
- Add a cpu_brand char array to hold the processor name returned by
  cpuid 0x80000002-0x80000004 on AMD, Intel, Transmeta, and possibly
  other CPUs.
- Use cpuid to set cpu_exthigh and read the processor name if it is present
  in identify_cpu().
2003-01-08 16:35:59 +00:00
John Baldwin
b33c8e3ded Bah, get the test for more than one logical CPU right so we don't bogusly
claim a CPU has HT support when it lists 0 or 1 logical CPU's per physical
processor.
2003-01-08 16:33:03 +00:00
John Baldwin
f4b4a64293 Enumerate logical hyperthread CPUs manually if they aren't already listed
in the mptable.  The way this works is that we determine if the system
has hyperthreading and how many logical CPU's should be in each physical
CPU by using the information returned by cpuid.  During the first pass of
the mptable, we build a bitmask of the APIC IDs of the CPUs listed in the
mptable.  We then scan that bitmask to see if the CPUs are already listed
by the mptable, or if there are any APIC IDs already in use that would
conflict with the APIC IDs of the logical CPUs.  If that test succeeds,
then we fixup the count of application processors.  Later on during the
second pass of the mptable we create fake processor entries for logical
CPUs and add them to the system.

We only need this type of fixup hack when using the mptable to enumerate
CPUs.  The ACPI MADT table properly enumerates all logical CPUs.
2003-01-08 01:33:18 +00:00
John Baldwin
5460753d55 If the boot processor supports hyperthreading and contains more than one
logical CPU, display the number of logical CPUs per physical processor
underneath the list of CPU features.
2003-01-08 01:23:16 +00:00
John Baldwin
fa896b7280 Add a cpuid_cpuinfo variable to hold the results of %ebx from cpuid with
%eax of 1 and set it in identify_cpu().
2003-01-08 01:20:05 +00:00
John Baldwin
72a1e0e226 - Fix the name of the hyperthreading cpuid feature flag to be HTT instead
of HHT.
- Document fields returned in %ebx by a cpuid with %eax of 1.
2003-01-08 01:15:26 +00:00
John Baldwin
bb69b35d8d Document bit 31 of the cpuid features word as PBE (Pending Break Enable). 2003-01-03 18:54:59 +00:00
Jens Schweikhardt
9d5abbddbf Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.
2003-01-01 18:49:04 +00:00
Nate Lawson
d9ce8f5c47 Return an error when r/w is requested on an unsupported device instead of
looping.

Submitted by:	Sean Kelly <smkelly@zombie.org>
Pointed out by:	bde
2002-12-31 21:44:38 +00:00
Robert Watson
a95f262c6b Synchronize to kern/syscalls.master:1.139.
Obtained from:	TrustedBSD Project
2002-12-29 20:33:26 +00:00
Scott Long
b4b9c52ca4 Add the if_bge driver. I can't find any reason why it's not here, and it's
pretty common on Dell servers and other high-end boxes.
2002-12-28 06:22:17 +00:00
Julian Elischer
93a7aa79d6 Add code to ddb to allow backtracing an arbitrary thread.
(show thread {address})

Remove the IDLE kse state and replace it with a change in
the way threads sahre KSEs. Every KSE now has a thread, which is
considered its "owner" however a KSE may also be lent to other
threads in the same group to allow completion of in-kernel work.
n this case the owner remains the same and the KSE will revert to the
owner when the other work has been completed.

All creations of upcalls etc. is now done from
kse_reassign() which in turn is called from mi_switch or
thread_exit(). This means that special code can be removed from
msleep() and cv_wait().

kse_release() does not leave a KSE with no thread any more but
converts the existing thread into teh KSE's owner, and sets it up
for doing an upcall. It is just inhibitted from being scheduled until
there is some reason to do an upcall.

Remove all trace of the kse_idle queue since it is no-longer needed.
"Idle" KSEs are now on the loanable queue.
2002-12-28 01:23:07 +00:00
Alan Cox
84cdcd85a0 Assert that the page queues lock is held in pmap_testbit(). 2002-12-28 00:19:40 +00:00
Alan Cox
11a2911cec - Hold the page queues lock around calls to vm_page_wakeup() and
vm_page_flag_clear().
2002-12-24 07:32:38 +00:00
Poul-Henning Kamp
152e80d952 Outdent the string rather than use concatenation. 2002-12-23 22:12:17 +00:00
Tim J. Robbins
b30a7779d4 MB_LEN_MAX is not MD, move it to the MI limits.h. 2002-12-22 06:38:45 +00:00
Marcel Moolenaar
91c71b46ed Export the physical address of the RSDP to userland by means
of the `machdep.acpi_root' sysctl. This is required on ia64
because the root pointer hardly ever, if at all, lives in the
first MB of memory and also because scanning the first MB of
memory can cause machine checks.
This provides a save and reliable way for ACPI tools to work
with the tables if ACPI support is present in the kernel. On
ia64 ACPI is non-optional.
2002-12-18 08:47:07 +00:00
Nate Lawson
e38cfb14fe Back out 1.19 to rethink approach
Requested by:	julian@
2002-12-17 05:55:36 +00:00
Nate Lawson
1df5f8294f Automatically issue a "continue" along with the "detach" command. This
fixes the problem of cleanly restarting a target after entering gdb mode.

Reviewed by:	archie@
2002-12-17 01:32:11 +00:00
Julian Elischer
4706b50a40 Reformat last change
Requested by: nate@
2002-12-16 23:25:12 +00:00
Julian Elischer
6b8fc51d28 Don't dump core into a partition that is too small for it.
If we do, we usually wrote backwareds into the proceeding partititon
which is usually the root partition.
2002-12-16 23:04:54 +00:00
Olivier Houchard
47770b6fd5 Add the trm(4) driver.
MFC after:	1 day
2002-12-16 18:47:37 +00:00
Marcel Moolenaar
722d8e49a9 Regen: swapoff 2002-12-16 00:49:36 +00:00
Marcel Moolenaar
3f60ecab4e Change swapoff from MNOPROTO to UNIMPL. The former doesn't work. 2002-12-16 00:48:52 +00:00
Matthew Dillon
92da00bb24 This is David Schultz's swapoff code which I am finally able to commit.
This should be considered highly experimental for the moment.

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
MFC after:	3 weeks
2002-12-15 19:17:57 +00:00
Poul-Henning Kamp
a0b3173215 Only dump the BIOS geometry table from bootinfo on PC98, we don't use
the contents on i386 anymore.
2002-12-14 16:11:28 +00:00
Alan Cox
0ced3981d1 Add page locking to pmap_mincore().
Submitted (in part) by:	tjr@
2002-12-14 07:06:27 +00:00
Alfred Perlstein
d1e405c5ce SCARGS removal take II. 2002-12-14 01:56:26 +00:00
Alfred Perlstein
bc9e75d7ca Backout removal SCARGS, the code freeze is only "selectively" over. 2002-12-13 22:41:47 +00:00
Alfred Perlstein
0bbe7292e1 Remove SCARGS.
Reviewed by: md5
2002-12-13 22:27:25 +00:00
Julian Elischer
696058c3c5 Unbreak the KSE code. Keep track of zobie threads using the Per-CPU storage
during the context switch. Rearrange thread cleanups
to avoid problems with Giant. Clean threads when freed or
when recycled.

Approved by:	re (jhb)
2002-12-10 02:33:45 +00:00
John Baldwin
55d7b94047 Add "disabled" hints to all of the uncommon ISA devices that are in
GENERIC.  Each device can be re-enabled at startup time by unsetting the
disabled hint in the loader.

Requested by:	mdodd
Approved by:	re
Prodded by:	rwatson
2002-12-05 22:49:47 +00:00
Alan Cox
a597332c22 Hold the page queues lock around calls to pmap_remove().
Approved by:	re
2002-12-04 18:40:39 +00:00
Poul-Henning Kamp
92a306a2b6 Use the correct value when writing the Day Of Week byte in the CMOS.
The correct range is [1...7] with Sunday=1, but we have been writing
[0...6] with Sunday=0.

The Soekris computers flagged the zero, zapped the date, so if you
rebooted your soekris on a sunday, it would come up with a wrong
date.

Bruce has a more extensive rework of this code, but we will stick with
the minimalist fix for now.

Spotted by:	Soren Kristensen <soren@soekris.com>
Thanks to:	Michael Sierchio <kudzu@tenebras.com>.
Confirmed by:	bde
Approved by:	re
2002-12-04 13:46:49 +00:00
Alan Cox
f4dcf9555e Avoid recursive acquisition of the page queues lock in pmap_unuse_pt().
Approved by:	re
2002-12-03 04:00:42 +00:00
Daniel Eischen
a3dca4517e Align the FPU state in the ucontext and sigcontext to 16 bytes
to accomodate the new SSE/XMM floating point save/restore
instructions.

This commit is mostly from bde and includes some style nits.

Approved by:	re (jhb)
2002-12-02 19:58:55 +00:00
Alan Cox
d79ebb6026 Hold the page queues lock when calling pmap_unwire_pte_hold() or
pmap_remove_pte().  Use vm_page_sleep_if_busy() in
_pmap_unwire_pte_hold() so that the page queues lock is released
when sleeping.

Approved by:	re (blanket)
2002-12-02 04:54:21 +00:00
Alan Cox
e6c90801b3 Assert that the page queues lock is held in pmap_changebit()
and pmap_ts_referenced().

Approved by:	re (blanket)
2002-12-01 00:08:14 +00:00
Alan Cox
0d51d232e5 Assert that the page queues lock is held in pmap_page_exists_quick().
Approved by:	re (blanket)
2002-11-30 17:46:59 +00:00
Alan Cox
ffb309581f Assert that the page queues lock is held in pmap_remove_pages().
Approved by:	re (blanket)
2002-11-25 04:45:03 +00:00
Alan Cox
560d1fbc99 Add page queues locking to vunmapbuf(); reduce differences with respect
to the sparc64 implementation.  (Note: With modest effort on the alpha and
ia64 this function could migrate to the MI part of the kernel.)

Approved by:	re (blanket)
2002-11-24 21:37:02 +00:00
Mitsuru IWASAKI
87b45ed576 Add `if (!cold)' checkings for functions which is called via SYSINIT.
Loading acpi.ko with kldload is disallowed, however some
functions were executed unexpectedly.

Approved by:	re
2002-11-24 02:27:07 +00:00
Alan Cox
4817d8e5e6 - Assert that the page queues lock is held in pmap_remove_all().
- Fix a diagnostic message and comment in pmap_remove_all().
 - Eliminate excessive white space from pmap_remove_all().

Approved by:	re
2002-11-23 04:48:13 +00:00
Maxime Henrion
b19d9defef Under certain circumstances, we were calling kmem_free() from
i386 cpu_thread_exit().  This resulted in a panic with WITNESS
since we need to hold Giant to call kmem_free(), and we weren't
helding it anymore in cpu_thread_exit().  We now do this from a
new MD function, cpu_thread_dtor(), called by thread_dtor().

Approved by:	re@
Suggested by:	jhb
2002-11-22 23:57:02 +00:00
John Baldwin
ebff7660a3 *sigh*. It seems that in the ACPICA code, Intel defines its own APIC_IO
macro for use when parsing MADT tables, thus we always tried to set the
interrupt model to APIC.  This proved to be harmful on UP machines with
IO APIC's (or for UP kernels on SMP machines) since the wrong interrupt
routing information would be returned.

Pointy hat to:	jhb
Approved by:	re (rwatson)
2002-11-21 20:55:22 +00:00
Daniel Eischen
84b427ce23 Regenerate after adding syscalls. 2002-11-16 23:48:14 +00:00
Daniel Eischen
a4b04278f0 Add *context() syscalls to ia64 32-bit compatability table as requested
in kern/syscalls.master.
2002-11-16 15:15:17 +00:00
Daniel Eischen
2be05b70c9 Add getcontext, setcontext, and swapcontext as system calls.
Previously these were libc functions but were requested to
be made into system calls for atomicity and to coalesce what
might be two entrances into the kernel (signal mask setting
and floating point trap) into one.

A few style nits and comments from bde are also included.

Tested on alpha by: gallatin
2002-11-16 06:35:53 +00:00
Warner Losh
a4bbd12ff1 MFp4:
o Fix small style nit.  This was supposed to be part of the last batch of
  style fixes, but somehow didn't get merged.
2002-11-14 05:22:37 +00:00
Peter Wemm
41f778bb99 Recognize the Serverworks CIOB30 host to pci bridge. 2002-11-13 21:30:44 +00:00
Matthew N. Dodd
d7545b110c Loader tunable 'machdep.disable_mtrrs'.
Sysctl of same name to reflect status.

Submitted by:	 jhb
Approved by:	 re (murray)
MFC after:	 1 day
2002-11-13 09:37:43 +00:00
Alan Cox
eea85e9bb6 Move pmap_collect() out of the machine-dependent code, rename it
to reflect its new location, and add page queue and flag locking.

Notes: (1) alpha, i386, and ia64 had identical implementations
of pmap_collect() in terms of machine-independent interfaces;
(2) sparc64 doesn't require it; (3) powerpc had it as a TODO.
2002-11-13 05:39:58 +00:00
Alan Cox
6372d61e3e - Clear the page's PG_WRITEABLE flag in the i386's pmap_changebit()
if we're removing write access from the page's PTEs.
 - Export pmap_remove_all() on alpha, i386, and ia64.  (It's already
   exported on sparc64.)
2002-11-11 05:17:34 +00:00
Mitsuru IWASAKI
2be7d43928 Add a new loader tunable, hw.hasbrokenint12, to indicate that BIOS
has broken int 12H.
If hw.hasbrokenint12="1" in loader environment, kernel never use BIOS
INT 12 call to determine base memory size.
Otherwise, kernel use INT 12 in old behaviour.
This should fix kernel panic problem caused by 1.544 changes.

MFC after:	1 day
2002-11-09 21:17:41 +00:00
Dag-Erling Smørgrav
97b67f3141 Print real / avail memory in megabytes rather than kilobytes. 2002-11-09 16:19:14 +00:00
Thomas Moestl
0fca57b8b8 Move the definitions of the hw.physmem, hw.usermem and hw.availpages
sysctls to MI code; this reduces code duplication and makes all of them
available on sparc64, and the latter two on powerpc.
The semantics by the i386 and pc98 hw.availpages is slightly changed:
previously, holes between ranges of available pages would be included,
while they are excluded now. The new behaviour should be more correct
and brings i386 in line with the other architectures.

Move physmem to vm/vm_init.c, where this variable is used in MI code.
2002-11-07 23:57:17 +00:00
Alfred Perlstein
4ef42f2b0f Properly parenthesize the DBREG_DRX macro's variables to allow for
DBREG_DRX(&dbregs, n) usage.
2002-11-07 22:42:31 +00:00
Alan Cox
aa8e11b6c4 Simplify and optimize pmap_object_init_pt(). More specifically,
take advantage of the fact that the vm object's list of pages is
now ordered to reduce the overhead of finding the desired set of
pages to be mapped.  (See revision 1.215 of vm/vm_page.c.)
2002-11-07 18:33:55 +00:00
David Xu
8c132e9fae 1.Fix smp race between kernel vm86 BIOS calling and userland vm86 mode code,
remove global variable in_vm86call, set vm86 calling flag in PCB flags.

2.Fix vm86 BIOS calling preempted problem by changing vm86_lock mutex type
  from MTX_DEF to MTX_SPIN. vm86pcb is not remembered in thread struct,
  when the thread calling vm86 BIOS is preempted by interrupt thread,
  and later switching back to the thread would cause incorrect context be
  loaded into CPU registers, this leads to kernel crash.
2002-11-07 01:34:23 +00:00
Juli Mallett
751d91aabd Remove what was a temporary bogus assignment of bits of siginfo_t, as it does
not look like the prerequisites to fill it in properly will be in the tree
for the upcoming release, but it's mostly done, so there is no need for these
to stay around to remind us.
2002-11-06 14:53:35 +00:00
David Xu
1f82496322 Fix typo. ioport_rid should be irq_rid. 2002-11-05 04:03:42 +00:00
Robert Watson
fabb3caa9e Sync to src/sys/kern/syscalls.master 2002-11-02 23:55:30 +00:00
Warner Losh
ce494452fe MFp4:
o It turns out that we always need to try to route the interrupts for
  the case where the $PIR tells us there can be only one.  Some machines
  require this, while others fail when we try to do this (bogusly, imho).
  Since we have no apriori way of knowing which is which, we always try to
  do the routing and hope for the best if things fail.
o Add some additional comments that state the obvious, but amplify it in
  non-obvious ways (judging from the questions I've gotten).

This should un-break older laptops that still have to use PCIBIOS to route
interrupts.

Tested by: sam
2002-11-02 22:35:24 +00:00
Warner Losh
984de797ff Use 0xffffffff instead of -1 for id to compare against.
Use exact width types, since this is a MD file and won't be used elsewhere.
Fix a couple of resulting printf breakages

Bug found by: phk using Flexlint
2002-11-02 22:32:04 +00:00
John Baldwin
ab79480392 Note that the sched_lock protects md_ldt of struct mdproc. 2002-10-25 20:06:16 +00:00
Peter Wemm
331e4823a2 Finish fixing the 5.x FPU code for dealing with signal handlers.
Obtained from:  bde
2002-10-25 19:12:16 +00:00
Peter Wemm
23eeeff7be Split 4.x and 5.x signal handling so that we can keep 4.x signal
handling clean and functional as 5.x evolves.  This allows some of the
nasty bandaids in the 5.x codepaths to be unwound.

Encapsulate 4.x signal handling under COMPAT_FREEBSD4 (there is an
anti-foot-shooting measure in place, 5.x folks need this for a while) and
finish encapsulating the older stuff under COMPAT_43.  Since the ancient
stuff is required on alpha (longjmp(3) passes a 'struct osigcontext *'
to the current sigreturn(2), instead of the 'ucontext_t *' that sigreturn
is supposed to take), add a compile time check to prevent foot shooting
there too.  Add uniform COMPAT_43 stubs for ia64/sparc64/powerpc.

Tested on: i386, alpha, ia64.  Compiled on sparc64 (a few days ago).
Approved by: re
2002-10-25 19:10:58 +00:00
Mitsuru IWASAKI
fb3a308a4a Change method to determine base memory size.
Try INT 15H/E820H first, then fall back to the old compatibility
method (INT 12H).
This is a workaround for newer machines which have broken INT 12H BIOS
service implementation.

Reviewed by:	-current ML
MFC after:	3 days
2002-10-25 18:46:36 +00:00
Warner Losh
d793791855 Use the correct values for LDBL_*. Libc doesn't completely support
long doubles at the moment (printf truncates them to doubles).
However, long doubles to appear to work to the ranges listed in this
commit on both -stable (4.5) and -current.  There may be some slight
rounding issues with long doubles, but that's an orthogonal issue to
these constants.

I've had this in my local tree for 3 months, and in my company's local
tree for 15 months with no ill effects.

Obtained from: NetBSD
Not likely to like it: bde
2002-10-25 07:02:52 +00:00
Julian Elischer
1434d3fe6f Extract out KSE specific code from machine specific code
so that there is ony one copy of it. Fix that one copy
so that KSEs with no mailbox in a KSE program are not a cause
of page faults (this can legitmatly happen).

Submitted by:	(parts) davidxu
2002-10-24 23:09:48 +00:00
John Baldwin
34bf8de99d No need for pmtimer hint anymore. 2002-10-22 17:32:27 +00:00
Poul-Henning Kamp
50c026e579 Change the definition of the debugging registers to be an array, so
that we can index into it, rather than do pointer gymnastics on a
structure containing 8 elements.

Verified by:	MD5 hash on the produced .o files.
2002-10-20 20:48:56 +00:00
Poul-Henning Kamp
05f6411a98 Remove a boatload of '&' which are surplus to the requirements.
Validated by:	md5 hash is unchanged.
2002-10-20 18:02:46 +00:00
Poul-Henning Kamp
7f30cdf366 Revert last commit, there actually was a -1 waaaaay down in pcireg_cfgread(). 2002-10-20 17:54:17 +00:00
Poul-Henning Kamp
218565dc75 Hide inline assembly if lint is defined. 2002-10-20 17:30:30 +00:00
Poul-Henning Kamp
a67ee49294 "id" is never going to be -1 when it is unsigned.
Spotted by:	FlexeLint
2002-10-20 17:21:43 +00:00
Peter Wemm
8556393bb2 Stake a claim on 418 (__xstat), 419 (__xfstat), 420 (__xlstat) 2002-10-19 22:25:31 +00:00
Peter Wemm
c8447553b5 Grab 416/417 real estate before I get burned while testing again.
This is for the not-quite-ready signal/fpu abi stuff.  It may not see
the light of day, but I'm certainly not going to be able to validate it
when getting shot in the foot due to syscall number conflicts.
2002-10-19 22:09:23 +00:00
Robert Watson
bc5245d94c Add a placeholder for the execve_mac() system call, similar to SELinux's
execve_secure() system call, which permits a process to pass in a label
for a label change during exec.  This permits SELinux to change the
label for the resulting exec without a race following a manual label
change on the process.  Because this interface uses our general purpose
MAC label abstraction, we call it execve_mac(), and wrap our port of
SELinux's execve_secure() around it with appropriate sid mappings.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2002-10-19 21:06:57 +00:00
Marcel Moolenaar
1aeb23cdfa Add two hooks to signal module load and module unload to MD code.
The primary reason for this is to allow MD code to process machine
specific attributes, segments or sections in the ELF file and
update machine specific state accordingly. An immediate use of this
is in the ia64 port where unwind information is updated to allow
debugging and tracing in/across modules. Note that this commit
does not add the functionality to the ia64 port. See revision 1.9
of ia64/ia64/elf_machdep.c.

Validated on: alpha, i386, ia64
2002-10-19 19:16:03 +00:00
Robert Watson
c7063e5913 Permits UFS ACLs to be used with the GENERIC kernel. Due to recent
ACL configuration changes, this shouldn't result in different code paths
for file systems not explicitly configured for ACLs by the system
administrator.  For UFS1, administrators must still recompile their
kernel to add support for extended attributes; for UFS2, it's sufficient
to enable ACLs using tunefs or at mount-time (tunefs preferred for
reliability reasons).  UFS2, for a variety of reasons, including
performance and reliability, is the preferred file system for use with
ACLs.

Approved by:	re
2002-10-19 16:54:15 +00:00
Jim Pirzyk
b2eb172cc3 Add the !define(COMPILING_LINT)
pass the pointy hat...

Requested by: Juli Mallett <jmallett@FreeBSD.org>
2002-10-17 18:17:28 +00:00
Mitsuru IWASAKI
0ebefa8c4e 1. Fix a comment. Locking _is_ needed (but not done).
2. Update a comment.  We now restore much more than RTC updates and
   interrupts.
3. Order change.  Stop interrupts by writing to RTC_STATUSB,
   restore rate bits for the interrupts by writing to RTC_STATUSA,
   then enable interrupts again.
   This seems to be done perfectly backwards in startrtclock().
   Otherwise, the idea for this change was obtained from
   startrtclock().
4. Don't stop the clock (RTCB_HALT).  We only program some control bits
   and don't want to stop the clock.
5. (Not really related.)  Add caveats to the comment about timer_restore().
   The update is non-atomic since locking is not done.

On locking:
6. rtcin() and writertc() are locked() adequately by splhigh() in RELENG_4,
   but this locking is null in -current.
7. Doing things in the correct order in (3) combined with (6) is probably
   enough locking for rtcrestore() in RELENG_4.  In -current, the
   writertc()'s race with rtcintr() unless the BIOS disables RTC interrupts.

Submitted by:	bde (including commit message)
MFC after:	1 week
2002-10-17 13:55:39 +00:00
Jim Pirzyk
c8c1cf0ca7 put an #error directive when SMP and CPU_DISABLE_CMPXCHG are set
together.

Requested by: Lars Eggart <larse@isi.edu>
Enlighted how to do it by: John Baldwin <jhb@freebsd.org>
2002-10-17 05:51:36 +00:00
John Baldwin
a73f15c7a8 Use the global pcib devclass instead of our own static copy. 2002-10-16 18:38:35 +00:00
John Baldwin
90fa95e81d - curproc may be NULL in 4-stable. In that case use the vmspace from
proc0.
- Remove unused include.

Sponsored by:	The Weather Channel
2002-10-16 17:22:03 +00:00
John Baldwin
42233ad3af Include <sys/select.h> on -stable instead of <sys/selinfo.h> to get the
definition of struct selinfo.

Sponsored by:	The Weather Channel
2002-10-16 17:20:43 +00:00
Poul-Henning Kamp
1eaae5cbe8 Be consistent about functions being static.
Spotted by:	FlexeLint.
2002-10-16 08:57:14 +00:00
Peter Wemm
af3f249f3a The a.out md_coredump stuff isn't referenced anywhere anymore, and
hasn't been filled in for ages..  Nuked.
2002-10-15 00:02:50 +00:00
Jim Pirzyk
77e8341280 Add a knob to turn on and off the CMPXCHG instruction on > i386 IA32 systems.
This is most beneficial for vmware client os installs.

Reviewed by: jmallet, iedowse, tlambert2@mindspring.com
MFC After: never, -STABLE does not currently use this instruction
2002-10-14 19:33:12 +00:00
Mike Barcroft
4275e0d98d Remove the P1003_1B kernel option; it is no longer used. 2002-10-13 16:29:17 +00:00
Mike Barcroft
7a77412855 Add standards visibility conditionals. Change any uses of sigset_t to
struct __sigset to avoid depending on objects from <sys/signal.h>.
2002-10-13 00:31:46 +00:00
Poul-Henning Kamp
1d6055e77c Remove NO_GEOM option. No outstanding show-stoppers.
Sponsored by:	DARPA & NAI Labs.
2002-10-12 07:26:48 +00:00
Jeff Roberson
b43179fbe8 - Create a new scheduler api that is defined in sys/sched.h
- Begin moving scheduler specific functionality into sched_4bsd.c
 - Replace direct manipulation of scheduler data with hooks provided by the
   new api.
 - Remove KSE specific state modifications and single runq assumptions from
   kern_switch.c

Reviewed by:	-arch
2002-10-12 05:32:24 +00:00
Mike Barcroft
2b7f24d210 Change iov_base's type from char *' to the standard void *'. All
uses of iov_base which assume its type is `char *' (in order to do
pointer arithmetic) have been updated to cast iov_base to `char *'.
2002-10-11 14:58:34 +00:00
Peter Wemm
d6b8445ebd re-regen. Sigh. 2002-10-09 22:40:41 +00:00
Peter Wemm
d4f4eb09d9 Sigh. Fix fat-fingering of diff. I knew this was going to happen. 2002-10-09 22:40:02 +00:00
Peter Wemm
9105d26b73 regenerate. sendfile stuff and other recently picked up stubs. 2002-10-09 22:28:48 +00:00
Peter Wemm
459e3a7a37 Try and deal with the #ifdef COMPAT_FREEBSD4 sendfile stuff. This would
have been a lot easier if do_sendfile() was usable externally.
2002-10-09 22:27:24 +00:00
Peter Wemm
4f4c431d9b Try and patch up some tab-to-space spammage. 2002-10-09 22:14:35 +00:00
Peter Wemm
8e223883f0 Add placeholder stubs for nsendfile, mac_syscall, ksem_close, ksem_post,
ksem_wait, ksem_trywait, ksem_init, ksem_open, ksem_unlink, ksem_getvalue,
ksem_destroy, __mac_get_pid, __mac_get_link, __mac_set_link,
extattr_set_link, extattr_get_link, extattr_delete_link.
2002-10-09 22:10:23 +00:00
John Baldwin
6b4d1b08a2 Use d_thread_t for cdevsw functions instead of struct thread * so that it
is easier to share this code with 4-stable.
2002-10-09 20:39:26 +00:00
John Baldwin
e7ab2f3683 Remove 'at' hints for npx and apm as both drivers have identify routines
that add an instance of themselves.  The npx(4) driver doesn't even check
the npx 'port' hint but hardcodes IO_NPX instead.  The npx(4) driver also
will use isa IRQ 13 (on x86, 8 on pc98) by default if no 'irq' hint is
specified, so we don't need that hint either.
2002-10-09 17:00:46 +00:00
Julian Elischer
48bfcddd94 Round out the facilty for a 'bound' thread to loan out its KSE
in specific situations. The owner thread must be blocked, and the
borrower can not proceed back to user space with the borrowed KSE.
The borrower will return the KSE on the next context switch where
teh owner wants it back. This removes a lot of possible
race conditions and deadlocks. It is consceivable that the
borrower should inherit the priority of the owner too.
that's another discussion and would be simple to do.

Also, as part of this, the "preallocatd spare thread" is attached to the
thread doing a syscall rather than the KSE. This removes the need to lock
the scheduler when we want to access it, as it's now "at hand".

DDB now shows a lot mor info for threaded proceses though it may need
some optimisation to squeeze it all back into 80 chars again.
(possible JKH project)

Upcalls are now "bound" threads, but "KSE Lending" now means that
other completing syscalls can be completed using that KSE before the upcall
finally makes it back to the UTS. (getting threads OUT OF THE KERNEL is
one of the highest priorities in the KSE system.) The upcall when it happens
will present all the completed syscalls to the KSE for selection.
2002-10-09 02:33:36 +00:00
Warner Losh
ea5420299c o go ahead and route the interupt, even if it is supposedly unique.
there are some strange machines that seem to need this.
o delete bogus comment.
o don't use the the bios for read/writing config space.  They interact badly
  with SMP and being called from ISR.  This brings -current in line with
  -stable.

# make the latter #ifdef on USE_PCI_BIOS_FOR_READ_WRITE in case we
# need to go back in a hurry.
2002-10-07 05:15:05 +00:00
Mike Barcroft
ddb056b7d4 Add conditionals to allow va_list to be defined in other headers. 2002-10-06 22:02:06 +00:00
Mike Barcroft
0b058e3cbd o Add conditionals to allow va_list to be defined in other headers.
o Standardize on _MACHINE_STDARG_H_ to allow multiple header includes.
o Restrict the definition of va_copy() to C99 environments.
2002-10-06 22:01:07 +00:00
Poul-Henning Kamp
3bd6561289 NB: This commit does *NOT* make GEOM the default in FreeBSD
NB: But it will enable it in all kernels not having options "NO_GEOM"

Put the GEOM related options into the intended order.

Add "options NO_GEOM" to all kernel configs apart from NOTES.

In some order of controlled fashion, the NO_GEOM options will be
removed, architecture by architecture in the coming days.

There are currently three known issues which may force people to
need the NO_GEOM option:

boot0cfg/fdisk:
        Tries to update the MBR while it is being used to control
        slices.  GEOM does not allow this as a direct operation.

SCSI floppy drives:
        Appearantly the scsi-da driver return "EBUSY" if no media
        is inserted.  This is wrong, it should return ENXIO.

PC98:
        It is unclear if GEOM correctly recognizes all variants of
        PC98 disklabels.  (Help Wanted!  I have neither docs nor HW)

These issues are all being worked.

Sponsored by:	DARPA & NAI Labs.
2002-10-05 16:35:33 +00:00
Daniel Eischen
ef795b8f41 Fix building of minimal kernels without npx by rearranging ifdefs.
Also fix some style bugs in surrounding code, and add a comment
about FP state restoral that seems questionable.

Submitted by:	bde
2002-10-05 14:36:14 +00:00
Mike Barcroft
e61d3b10d7 Fix namespace issues by using visibility conditionals from
<sys/cdefs.h>.
2002-10-05 05:47:56 +00:00
Mike Barcroft
085f8416a2 style(9) <machine/setjmp.h> headers so they look mostly the same. 2002-10-04 22:10:06 +00:00
Sam Leffler
14c17bd293 New bus_dma interfaces for use by crypto device drivers:
o bus_dmamap_load_mbuf
o bus_dmamap_load_uio

Test on i386.  Known to compile on alpha and sparc64, but not tested.
Otherwise untried.
2002-10-04 20:40:39 +00:00
John Baldwin
fa778f80c2 Fix a bogon in previous commit. bcopy() from the malloc'd memory that we
already copied into, rather than doing the bcopy() from the userland
pointer.  "Oops."
2002-10-04 20:19:36 +00:00
Daniel Eischen
80047e95cf Add another temporary hack to allow running older i386 binaries.
This will be removed when new versions of syscalls sigreturn()
and sigaction() are added (mini is working on this but is in
the middle of a move).

This should fix the problem of cvsupd dying.
2002-10-04 14:50:55 +00:00
Mitsuru IWASAKI
2f00e60504 Add 2 Ids for new ServerWorks host to PCI bridge chipset.
These are still unknown name but these are working as well
as the other ServerWorks chipset.
Description strings should be corrected when the chipsets
are known.

MFC after:	1 week
2002-10-02 17:50:38 +00:00
Archie Cobbs
36a8dac10d Let kse_wakeup() take a KSE mailbox pointer argument.
Reviewed by:	julian
2002-10-02 16:48:16 +00:00
Scott Long
316ec49abd Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create.  Passing the
value 0 prevents the alternate kstack from being created.  Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.

Reviewed by:	jake, peter, jhb
2002-10-02 07:44:29 +00:00
Poul-Henning Kamp
b29d22f94e The pmap_prefault_pageorder[] array was initialize with wrong values
due to a missing comma.

I have no idea what trouble, if any, this may have caused.

Pointed out by:	FlexeLint
2002-10-01 20:51:47 +00:00
Poul-Henning Kamp
c2b6013026 It is too much work convincing lint why we would want empty structures,
so make the non-empty #ifdef lint.
2002-10-01 14:08:08 +00:00
Poul-Henning Kamp
7e9bac35e2 A more lint friendly #ifdef lint section. 2002-10-01 14:01:58 +00:00
John Baldwin
92ceafffd0 - Give legacy an identify routine that always adds 'legacy0' at an order
of 1 so that it is not probed until after acpi0 is probed and attached.
- In legacy_probe(), return ENXIO if acpi0 is around and alive.
- nexus_attach() is now much simpler and just lets its child drivers do
  all the work.
2002-09-30 18:47:11 +00:00
John Baldwin
31a51bf683 Trash the PnPBIOStable pointer later on when we know that the acpi probe
and attach routines have succeeded so that if they fail we can still use
the PnP BIOS to find ISA on-board devices.  The fact that we do this here
is gross but fixing it properly involves a lot more work.
2002-09-30 18:45:20 +00:00
David E. O'Brien
dbe57134ec Turn back on the "SMP: AP CPU #N Launched!" message on normal boots.
Peter's rev 1.189 should fix the lost console on SCSI-based systems due
to this message.
2002-09-30 15:39:57 +00:00
David E. O'Brien
469541bfde Only print out the "SMP: AP CPU #N Launched!" message on verbose boots.
The kernel printf() isn't race-free
2002-09-30 07:03:16 +00:00
David E. O'Brien
e4544528f6 Save the FP state in the PCB as that is compatable with releng4 binaries.
This is a band-aid until the KSE pthread committers get back on the ground
and have their machines setup.

Submitted by:	eischen
2002-09-30 07:02:22 +00:00
Peter Wemm
8eb8107b44 Deal with some SMP races by doing the entire copyin at once rather
than doing the checks piecemeal and then doing a second copyin later.

PR:		38021
Submitted by:	davidx (I've tweaked the patch a bit)
2002-09-28 22:44:45 +00:00
Peter Wemm
feea0ab05b There is no need for start/num to be signed in i386_ldt_args. 2002-09-28 20:42:04 +00:00
Peter Wemm
8b223ac209 Repair range checking for reading the ldt list.
PR:		38016
Submitted by:	davidx
2002-09-28 19:37:54 +00:00
Poul-Henning Kamp
cb8e433232 Don't call function in return() for a void function. 2002-09-28 17:36:29 +00:00
Poul-Henning Kamp
37c841831f Be consistent about "static" functions: if the function is marked
static in its prototype, mark it static at the definition too.

Inspired by:    FlexeLint warning #512
2002-09-28 17:15:38 +00:00
Søren Schmidt
4c2c25d405 Add the pst (Promise SX6000) driver to GENERIC. 2002-09-27 19:09:21 +00:00
Peter Wemm
bbe04fe2ca ISMEMSDP(), IS286GDP(), IS386GDP(), ISGDP(), ISSDP() and ISSYSSDP() are
not used anywhere anymore.
2002-09-26 05:07:41 +00:00
Archie Cobbs
89def71cbd Make the following name changes to KSE related functions, etc., to better
represent their purpose and minimize namespace conflicts:

	kse_fn_t		-> kse_func_t
	struct thread_mailbox	-> struct kse_thr_mailbox
	thread_interrupt()	-> kse_thr_interrupt()
	kse_yield()		-> kse_release()
	kse_new()		-> kse_create()

Add missing declaration of kse_thr_interrupt() to <sys/kse.h>.
Regenerate the various generated syscall files. Minor style fixes.

Reviewed by:	julian
2002-09-25 18:10:42 +00:00
Mark Murray
82e5cdeb6e Fix a declaration that is actually supposed to be a macro definition.
Submitted by:	marius@alchemy.franken.de
2002-09-25 13:46:23 +00:00
Alfred Perlstein
4f492bfab5 use __packed. 2002-09-23 18:54:32 +00:00
John Baldwin
b8581e0d56 Now that we only probe host-PCI bridges once, we no longer have to check to
see if we have been probed before by checking for a pciX bus device.
2002-09-23 18:14:31 +00:00
John Baldwin
8ff25e9763 Put verbose printf's in the PCI BIOS interrupt routing code under
if (bootverbose).
2002-09-23 18:13:42 +00:00
John Baldwin
58eab4797a Update the nexus driver for the addition of the legacy driver:
- nexus no longer has PCI bridges as direct children, so the PCI bus
  ivar is no longer used and is removed.
- Don't attach default EISA, ISA, or MCA busses.  Instead, if we do not
  have an acpi0 device after bus_generic_probe(), add a legacy0 child
  device.
- Remove machine/nexusvar.h.
2002-09-23 16:03:00 +00:00
John Baldwin
2ab55f4392 Change the nexus_pcib driver (eventually to be renamed to legacy_pcib) to
hang off of the legacy driver instead of the nexus.
2002-09-23 15:52:30 +00:00
John Baldwin
e8e951ce31 Add a new legacy(4) device driver for use on machines that do not have
ACPI or for when ACPI support is disabled or not present in the kernel.
Basically, the nexus device is now split into two with some parts
(such as adding default ISA, MCA, and EISA busses if they aren't found
as well as support for PCI bus device ivars) being moved to the legacy
driver.
2002-09-23 15:50:06 +00:00
Peter Wemm
1a8ec9c55a PIC_GOTOFF is OBE. 2002-09-23 07:27:45 +00:00
Peter Wemm
691cb905d6 use __packed, rather than __attribute__((packed)). 2002-09-23 06:50:07 +00:00
Peter Wemm
c692fbe091 At great personal risk, add a __packed and __aligned(x) define that
expand to __attribute__((packed)) and __attribute__((aligned(x)))
respectively.  Replace the handful of gcc-ism's that use
__attribute__((aligned(16))) etc around the kernel with __aligned(16).

There are over 400 __attribute__((packed)) to deal with, that can come
later.  I just want to use __packed in new code rather than add more
gcc-ism's.
2002-09-23 05:55:10 +00:00