History log of /freebsd-current/sys/i386/include/param.h
Revision Date Author Comments
# 29363fb4 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# 2ff63af9 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


# ed83a561 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

i386: clean up empty lines in .c and .h files


# c3d326fd 05-Feb-2020 Mark Johnston <markj@FreeBSD.org>

Define MAXCPU consistently between the kernel and KLDs.

This reverts r177661. The change is no longer very useful since
out-of-tree KLDs will be built to target SMP kernels anyway. Moveover
it breaks the KBI in !SMP builds since cpuset_t's layout depends on the
value of MAXCPU, and several kernel interfaces, notably
smp_rendezvous_cpus(), take a cpuset_t as a parameter.

PR: 243711
Reviewed by: jhb, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23512


# 9a527560 29-Jan-2019 Konstantin Belousov <kib@FreeBSD.org>

i386: Merge PAE and non-PAE pmaps into same kernel.

Effectively all i386 kernels now have two pmaps compiled in: one
managing PAE pagetables, and another non-PAE. The implementation is
selected at cold time depending on the CPU features. The vm_paddr_t is
always 64bit now. As result, nx bit can be used on all capable CPUs.

Option PAE only affects the bus_addr_t: it is still 32bit for non-PAE
configs, for drivers compatibility. Kernel layout, esp. max kernel
address, low memory PDEs and max user address (same as trampoline
start) are now same for PAE and for non-PAE regardless of the type of
page tables used.

Non-PAE kernel (when using PAE pagetables) can handle physical memory
up to 24G now, larger memory requires re-tuning the KVA consumers and
instead the code caps the maximum at 24G. Unfortunately, a lot of
drivers do not use busdma(9) properly so by default even 4G barrier is
not easy. There are two tunables added: hw.above4g_allow and
hw.above24g_allow, the first one is kept enabled for now to evaluate
the status on HEAD, second is only for dev use.

i386 now creates three freelists if there is any memory above 4G, to
allow proper bounce pages allocation. Also, VM_KMEM_SIZE_SCALE changed
from 3 to 1.

The PAE_TABLES kernel config option is retired.

In collaboarion with: pho
Discussed with: emaste
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D18894


# d86c1f0d 13-Apr-2018 Konstantin Belousov <kib@FreeBSD.org>

i386 4/4G split.

The change makes the user and kernel address spaces on i386
independent, giving each almost the full 4G of usable virtual addresses
except for one PDE at top used for trampoline and per-CPU trampoline
stacks, and system structures that must be always mapped, namely IDT,
GDT, common TSS and LDT, and process-private TSS and LDT if allocated.

By using 1:1 mapping for the kernel text and data, it appeared
possible to eliminate assembler part of the locore.S which bootstraps
initial page table and KPTmap. The code is rewritten in C and moved
into the pmap_cold(). The comment in vmparam.h explains the KVA
layout.

There is no PCID mechanism available in protected mode, so each
kernel/user switch forth and back completely flushes the TLB, except
for the trampoline PTD region. The TLB invalidations for userspace
becomes trivial, because IPI handlers switch page tables. On the other
hand, context switches no longer need to reload %cr3.

copyout(9) was rewritten to use vm_fault_quick_hold(). An issue for
new copyout(9) is compatibility with wiring user buffers around sysctl
handlers. This explains two kind of locks for copyout ptes and
accounting of the vslock() calls. The vm_fault_quick_hold() AKA slow
path, is only tried after the 'fast path' failed, which temporary
changes mapping to the userspace and copies the data to/from small
per-cpu buffer in the trampoline. If a page fault occurs during the
copy, it is short-circuit by exception.s to not even reach C code.

The change was motivated by the need to implement the Meltdown
mitigation, but instead of KPTI the full split is done. The i386
architecture already shows the sizing problems, in particular, it is
impossible to link clang and lld with debugging. I expect that the
issues due to the virtual address space limits would only exaggerate
and the split gives more liveness to the platform.

Tested by: pho
Discussed with: bde
Sponsored by: The FreeBSD Foundation
MFC after: 1 month
Differential revision: https://reviews.freebsd.org/D14633


# 3f6867ef 10-Dec-2017 Conrad Meyer <cem@FreeBSD.org>

i386: Bump KSTACK_PAGES default to match amd64

Logically, extend r286288 to cover all threads, by default.

The world has largely moved on from i386. Most FreeBSD users and developers
test on amd64 hardware. For better or worse, we have written a non-trivial
amount of kernel code that relies on stacks larger than 8 kB, and it "just
works" on amd64, so there has been little incentive to shrink it.

amd64 had its KSTACK_PAGES bumped to 4 back in Peter's initial AMD64 commit,
r114349, in 2003. Since that time, i386 has limped along on a stack half
the size. We've even observed the stack overflows years ago, but neglected
to fix the issue; see the 20121223 and 20150728 entries in UPDATING.

If anyone is concerned with this change, I suggest they configure their
AMD64 kernels with KSTACK_PAGES 2 and fix the fallout there first. Eugene
has identified a list of high stack usage functions in the first PR below.

PR: 219476, 224218
Reported by: eugen@, Shreesh Holla <hshreesh AT yahoo.com>
Relnotes: maybe
Sponsored by: Dell EMC Isilon


# 51369649 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# 2744a0b6 28-Aug-2017 Conrad Meyer <cem@FreeBSD.org>

Drop CACHE_LINE_SIZE to 64 bytes on x86

The actual cache line size has always been 64 bytes.

The 128 number arose as an optimization for Core 2 era Intel processors. By
default (configurable in BIOS), these CPUs would prefetch adjacent cache
lines unintelligently. Newer CPUs prefetch more intelligently.

The latest Core 2 era CPU was introduced in September 2008 (Xeon 7400
series, "Dunnington"). If you are still using one of these CPUs, especially
in a multi-socket configuration, consider locating the "adjacent cache line
prefetch" option in BIOS and disabling it.

Reported by: mjg
Reviewed by: np
Discussed with: jhb
Sponsored by: Dell EMC Isilon


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 3208d3ff 04-Aug-2015 Konstantin Belousov <kib@FreeBSD.org>

Give large kernel stack to the initial thread . Otherwise, ZFS
overflows the stack during root mount in some configurations.

Tested by: Fabian Keil <freebsd-listen@fabiankeil.de> (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks


# 6fdfd882 02-Jul-2015 Konstantin Belousov <kib@FreeBSD.org>

Use single instance of the identical INKERNEL() and PMC_IN_KERNEL()
macros on amd64 and i386. Move the definition to machine/param.h.
kgdb defines INKERNEL() too, the conflict is resolved by renaming kgdb
version to PINKERNEL().

On i386, correct the lowest kernel address. After the shared page was
introduced, USRSTACK no longer points to the last user address + 1 [*]

Submitted by: Oliver Pinter [*]
Sponsored by: The FreeBSD Foundation
MFC after: 1 week


# 34c15db9 13-Apr-2015 Konstantin Belousov <kib@FreeBSD.org>

Add config option PAE_TABLES for the i386 kernel. It switches pmap to
use PAE format for the page tables, but does not incur other
consequences of the full PAE config. In particular, vm_paddr_t and
bus_addr_t are left 32bit, and max supported memory is still limited
by 4GB.

The option allows to have nx permissions for memory mappings on i386
kernel, while keeping the usual i386 KBI and avoiding the kernel data
sizing problems typical for the PAE config.

Intel documented that the PAE format for page tables is available
starting with the Pentium Pro, but it is possible that the plain
Pentium CPUs have the required support (Appendix H). The goal is to
enable the option and non-exec mappings on i386 for the GENERIC
kernel. Anybody wanting a useful system on 486, have to reconfigure
the modern i386 kernel anyway.

Discussed with: alc, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks


# 941646f5 07-May-2013 Attilio Rao <attilio@FreeBSD.org>

Rename VM_NDOMAIN into MAXMEMDOM and move it into machine/param.h in
order to match the MAXCPU concept. The change should also be useful
for consolidation and consistency.

Sponsored by: EMC / Isilon storage division
Obtained from: jeff
Reviewed by: alc


# c67f5b54 21-Apr-2013 Tijl Coosemans <tijl@FreeBSD.org>

Remove redundant definitions of _ALIGN and _ALIGNBYTES.


# d4e9009c 27-Mar-2013 Konstantin Belousov <kib@FreeBSD.org>

Fix the VM_BCACHE_SIZE_MAX definition on i386 to match the maximal
buffer map size, auto-tuned on the 4GB machine. Having the maxbcache
bigger than the buffer map causes the transient bio map sizing logic
to assume that there is enough KVA to use approximately 90MB (buffer
map is sized to 110MB, and maxbcache is 200MB). The increase in the
KVA usage caused other big KVA consumers, like nvidia.ko, to fail the
initialization.

Change the definition for both PAE and non-PAE cases, since PAE is
even more KVA-starved.

Reported and tested by: David Wolfskill
Discussed with: alc
Sponsored by: The FreeBSD Foundation


# ae7f84a9 27-Aug-2012 Dag-Erling Smørgrav <des@FreeBSD.org>

Parly revert r239255: reinstate a default maxswzone on i386, where KVA is
scarce, but set it slightly higher so we can handle 8 GB of swap.


# e2082935 14-Aug-2012 Dag-Erling Smørgrav <des@FreeBSD.org>

As discussed on -current, remove the hardcoded default maxswzone.

MFC after: 3 weeks


# 68b739cd 18-Jul-2011 Attilio Rao <attilio@FreeBSD.org>

Add the possibility to specify from kernel configs MAXCPU value.
This patch is going to help in cases like mips flavours where you
want a more granular support on MAXCPU.

No MFC is previewed for this patch.

Tested by: pluknet
Approved by: re (kib)


# 1368987a 22-Jun-2011 John Baldwin <jhb@FreeBSD.org>

Move {amd64,i386}/pci/pci_bus.c and {amd64,i386}/include/pci_cfgreg.h to
the x86 tree. The $PIR code is still only enabled on i386 and not amd64.
While here, make the qpi(4) driver on conditional on 'device pci'.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# ebc91405 31-Oct-2009 Alan Cox <alc@FreeBSD.org>

MFC r197316
Add a new sysctl for reporting all of the supported page sizes.


# fe105d45 18-Sep-2009 Alan Cox <alc@FreeBSD.org>

Add a new sysctl for reporting all of the supported page sizes.

Reviewed by: jhb
MFC after: 3 weeks


# a254d1f1 08-Sep-2009 Poul-Henning Kamp <phk@FreeBSD.org>

Get rid of the _NO_NAMESPACE_POLLUTION kludge by creating an
architecture specific include file containing the _ALIGN*
stuff which <sys/socket.h> needs.


# 8c393fd1 05-Jul-2009 Sam Leffler <sam@FreeBSD.org>

Cleanup ALIGNED_POINTER:
o add to platforms where it was missing (arm, i386, powerpc, sparc64, sun4v)
o define as "1" on amd64 and i386 where there is no restriction
o make the type returned consistent with ALIGN
o remove _ALIGNED_POINTER
o make associated comments consistent

Reviewed by: bde, imp, marcel
Approved by: re (kensmith)


# 8aba835b 18-May-2009 John Baldwin <jhb@FreeBSD.org>

Bump CACHE_LINE_SIZE to 128 for x86. Intel's manuals explicitly recommend
using 128 byte alignment for locks. (See IA-32 SDM Vol 3A 7.11.6.7)


# 9725389e 19-Apr-2009 Robert Watson <rwatson@FreeBSD.org>

Don't conditionally define CACHE_LINE_SHIFT, as we anticipate sizing
a fair number of static data structures, making this an unlikely
option to try to change without also changing source code. [1]

Change default cache line size on ia64, sparc64, and sun4v to 128
bytes, as this was what rtld-elf was already using on those
platforms. [2]

Suggested by: bde [1], jhb [2]
MFC after: 2 weeks


# 22037b2d 19-Apr-2009 Robert Watson <rwatson@FreeBSD.org>

Add description and cautionary note regarding CACHE_LINE_SIZE.

MFC after: 2 weeks
Suggested by: alc


# a93fa8f2 19-Apr-2009 Robert Watson <rwatson@FreeBSD.org>

For each architecture, define CACHE_LINE_SHIFT and a derived
CACHE_LINE_SIZE constant. These constants are intended to
over-estimate the cache line size, and be used at compile-time
when a run-time tuning alternative isn't appropriate or
available.

Defaults for all architectures are 64 bytes, except powerpc
where it is 128 bytes (used on G5 systems).

MFC after: 2 weeks
Discussed on: arch@


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 3d074cf3 01-Oct-2008 John Baldwin <jhb@FreeBSD.org>

Bump MAXCPU to 32 now that 32 CPU x86 systems exist.

Tested by: rwatson, mdtansca
Approved by: peter


# dec9f635 25-Sep-2008 Kip Macy <kmacy@FreeBSD.org>

add NPGPTD_SHIFT for the nkpt calculation

MFC after: 1 month


# e4839437 26-Mar-2008 John Birrell <jb@FreeBSD.org>

When building a kernel module, define MAXCPU the same as SMP so
that modules work with and without SMP.


# d5e61c97 08-Jan-2006 Warner Losh <imp@FreeBSD.org>

By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into
param.h. Per request, I've placed these just after the
_NO_NAMESPACE_POLLUTION ifndef. I've not renamed anything yet, but
may since we don't need the __.

Submitted by: bde, jhb, scottl, many others.


# 224d1402 06-Dec-2005 Ruslan Ermilov <ru@FreeBSD.org>

Drop _MACHINE_ARCH and _MACHINE defines (not to be confused with
MACHINE_ARCH and MACHINE). Their purpose was to be able to test
in cpp(1), but cpp(1) only understands integer type expressions.
Using such unsupported expressions introduced a number of subtle
bugs, which were discovered by compiling with -Wundef.


# ab44ebf5 19-Nov-2004 David Schultz <das@FreeBSD.org>

Remove UAREA_PAGES.

Reviewed by: arch@


# 9923b511 02-Sep-2004 Scott Long <scottl@FreeBSD.org>

Turn PREEMPTION into a kernel option. Make sure that it's defined if
FULL_PREEMPTION is defined. Add a runtime warning to ULE if PREEMPTION is
enabled (code inspired by the PREEMPTION warning in kern_switch.c). This
is a possible MT5 candidate.


# df3a834f 01-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Give up trying to make preemption dependent on SCHED_4BSD
the list of breakages was getting too long


# 6222ded0 01-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Don't ask for this for modules. no modules need to know about preemption at the moment


# f164d414 01-Sep-2004 Scott Long <scottl@FreeBSD.org>

Protect the PREEMPTION logic with #ifdef _KERNEL to fix the build.


# 02ea3bca 01-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Only turn preemption for 4bsd.
it's still poison for ULE.


# 6804a3ab 01-Sep-2004 Julian Elischer <julian@FreeBSD.org>

Give the 4bsd scheduler the ability to wake up idle processors
when there is new work to be done.

MFC after: 5 days


# 9352fe30 01-Aug-2004 Scott Long <scottl@FreeBSD.org>

Turn off PREEMPTION by default while it gets debugged. It's been causing
4 weeks of problems including deadlocks and instant panics. Note that the
real bugs are likely in the scheduler.


# 0c0b25ae 02-Jul-2004 John Baldwin <jhb@FreeBSD.org>

Implement preemption of kernel threads natively in the scheduler rather
than as one-off hacks in various other parts of the kernel:
- Add a function maybe_preempt() that is called from sched_add() to
determine if a thread about to be added to a run queue should be
preempted to directly. If it is not safe to preempt or if the new
thread does not have a high enough priority, then the function returns
false and sched_add() adds the thread to the run queue. If the thread
should be preempted to but the current thread is in a nested critical
section, then the flag TDF_OWEPREEMPT is set and the thread is added
to the run queue. Otherwise, mi_switch() is called immediately and the
thread is never added to the run queue since it is switch to directly.
When exiting an outermost critical section, if TDF_OWEPREEMPT is set,
then clear it and call mi_switch() to perform the deferred preemption.
- Remove explicit preemption from ithread_schedule() as calling
setrunqueue() now does all the correct work. This also removes the
do_switch argument from ithread_schedule().
- Do not use the manual preemption code in mtx_unlock if the architecture
supports native preemption.
- Don't call mi_switch() in a loop during shutdown to give ithreads a
chance to run if the architecture supports native preemption since
the ithreads will just preempt DELAY().
- Don't call mi_switch() from the page zeroing idle thread for
architectures that support native preemption as it is unnecessary.
- Native preemption is enabled on the same archs that supported ithread
preemption, namely alpha, i386, and amd64.

This change should largely be a NOP for the default case as committed
except that we will do fewer context switches in a few cases and will
avoid the run queues completely when preempting.

Approved by: scottl (with his re@ hat)


# f36cfd49 07-Apr-2004 Warner Losh <imp@FreeBSD.org>

Remove advertising clause from University of California Regent's
license, per letter dated July 22, 1999 and email from Peter Wemm,
Alan Cox and Robert Watson.

Approved by: core, peter, alc, rwatson


# 49a2507b 14-Jun-2003 Alan Cox <alc@FreeBSD.org>

Migrate the thread stack management functions from the machine-dependent
to the machine-independent parts of the VM. At the same time, this
introduces vm object locking for the non-i386 platforms.

Two details:

1. KSTACK_GUARD has been removed in favor of KSTACK_GUARD_PAGES. The
different machine-dependent implementations used various combinations
of KSTACK_GUARD and KSTACK_GUARD_PAGES. To disable guard page, set
KSTACK_GUARD_PAGES to 0.

2. Remove the (unnecessary) clearing of PG_ZERO in vm_thread_new. In
5.x, (but not 4.x,) PG_ZERO can only be set if VM_ALLOC_ZERO is passed
to vm_page_alloc() or vm_page_grab().


# 7ab9b220 29-Mar-2003 Jake Burkholder <jake@FreeBSD.org>

- 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


# 227f9a1c 24-Mar-2003 Jake Burkholder <jake@FreeBSD.org>

- 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)


# 910548de 23-Feb-2003 Jake Burkholder <jake@FreeBSD.org>

- 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


# 66422f5b 16-Sep-2002 Peter Wemm <peter@FreeBSD.org>

Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports. As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL. It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha


# ec61f55d 31-Aug-2002 Matthew Dillon <dillon@FreeBSD.org>

Reduce the maximum KVA reserved for swap meta structures from 70 to 32 MB.
Reduce the swap meta calculation by a factor of 2, it's still massive overkill.

X-MFC after: immediately


# 6380601f 14-May-2002 Poul-Henning Kamp <phk@FreeBSD.org>

Move MI stuff out of MD param.h files.

It can all still be overridden in the MD files should need suddenly arise.


# b40ce416 12-Sep-2001 Julian Elischer <julian@FreeBSD.org>

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

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

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

X-MFC after: ha ha ha ha


# 268bdb43 24-Aug-2001 Peter Wemm <peter@FreeBSD.org>

Optionize UPAGES for the i386. As part of this I split some of the low
level implementation stuff out of machine/globaldata.h to avoid exposing
UPAGES to lots more places. The end result is that we can double
the kernel stack size with 'options UPAGES=4' etc.

This is mainly being done for the benefit of a MFC to RELENG_4 at some
point. -current doesn't really need this so much since each interrupt
runs on its own kstack.


# 2f9e4e80 19-Aug-2001 Matthew Dillon <dillon@FreeBSD.org>

Limit the amount of KVM reserved for the buffer cache and for swap-meta
information. The default limits only effect machines with > 1GB of ram
and can be overriden with two new kernel conf variables VM_SWZONE_SIZE_MAX
and VM_BCACHE_SIZE_MAX, or with loader variables kern.maxswzone and
kern.maxbcache. This has the effect of leaving more KVM available for
sizing NMBCLUSTERS and 'maxusers' and should avoid tripups where a sysad
adds memory to a machine and then sees the kernel panic on boot due to
running out of KVM.

Also change the default swap-meta auto-sizing calculation to allocate half
of what it was previously allocating. The prior defaults were way too high.
Note that we cannot afford to run out of swap-meta structures so we still
stay somewhat conservative here.


# 6b1d8cea 08-Nov-2000 Jeroen Ruigrok van der Werven <asmodai@FreeBSD.org>

Fix CMSG and ALIGN macro usage.
Previously we had to include <machine/param.h> or <sys/param.h> bogusly
due to the fact that <sys/socket.h> CMSG macros needed the ALIGN macro,
which was defined in param.h. However, including param.h was a disaster
for namespace pollution.
This solution, as contributed by shin a while ago, fixes it elegantly
by wrapping the definitions around some namespace pollution preventer
definitions.
This patch was long overdue.
This should allow any network programmer to use <sys/socket.h> as
before.

PR: 19971, 20530
Submitted by: Martin Kaeske <MartinKaeske@lausitz.net>
Mark Andrews <Mark.Andrews@nominum.com>
Patch submitted by: shin
Reviewed by: bde


# c794ceb5 17-Oct-2000 Paul Saab <ps@FreeBSD.org>

Implement write combining for crashdumps. This is useful when
write caching is disabled on both SCSI and IDE disks where large
memory dumps could take up to an hour to complete.

Taking an i386 scsi based system with 512MB of ram and timing (in
seconds) how long it took to complete a dump, the following results
were obtained:

Before: After:
WCE TIME WCE TIME
------------------ ------------------
1 141.820972 1 15.600111
0 797.265072 0 65.480465

Obtained from: Yahoo!
Reviewed by: peter


# ec222a71 07-Oct-2000 Bosko Milekic <bmilekic@FreeBSD.org>

Cleanup comment in machine/param.h regarding mbuf-related sizes, and get rid
of MCLOFSET, which does not appear to be used anywhere anymore, and if it is,
it probably shouldn't be.


# 92b123a0 22-Sep-2000 Paul Saab <ps@FreeBSD.org>

Move MAXCPU from machine/smp.h to machine/param.h to fix breakage
with !SMP kernels. Also, replace NCPUS with MAXCPU since they are
redundant.


# 863bdc0c 28-Mar-2000 Jonathan Lemon <jlemon@FreeBSD.org>

Change the mbuf size from 128 -> 256. Increasing the mbuf header size
caused some headers not to fit in MHLEN any more. This matches the
current size on the alpha, so it shouldn't cause problems.

Problem observed by: Geoff Rehmet <geoff@is.co.za>
Originally suggested by: shin


# 7ba4a775 11-Dec-1999 Peter Wemm <peter@FreeBSD.org>

Reclaim UPAGES_HOLE (8k) that was chopped out of process address space.
The UPAGES have not been there since Jan '96, but the hole was preserved
for BSD/OS binary compatability. This has been fixed other ways (%ebx
now has a pointer to PS_STRINGS), and the stack is nowhere near where
it used to be so this hack isn't required anymore.


# 8b22cebb 21-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

Back out a portion of the last commit. DFLTPHYS and MAXPHYS cannot
be set by a kernel conf option due to the struct buf structural
dependancy (sizing of b_pages[]) creating a conflict with modules
(which are not compiled with kernel config options overrides).

We'll be able to sysctl these two later on when the buffer subsystem
is revamped.


# a59d364a 21-Sep-1999 Matthew Dillon <dillon@FreeBSD.org>

Change default block size for user VBLK device access from 2K to PAGE_SIZE
(4K on an i386, 8K on an alpha).

Make BLKDEV_IOSIZE, DFLTPHYS, and MAXPHYS kernel-configurable.


# c3aac50f 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 1684ea57 28-Feb-1999 Warner Losh <imp@FreeBSD.org>

Don't define MACHINE, MACHINE_ARCH, _MACHINE or _MACHINE_ARCH if
already defined. This allows for cross building to work because we
need to lie to make to tell it to use the target names rather than the
host names.

This should have no effect on either architecture. I've confirmed
that the intel build by make buildworld's for the past 3 months.


# 1c6d46f9 19-Feb-1999 Luoqi Chen <luoqi@FreeBSD.org>

Introduce machine-dependent macro pgtok() to convert page count to number
of kilobytes. Its definition for each architecture could be optimized to
avoid potential numerical overflows.


# 6c7178bd 06-Jan-1999 Peter Wemm <peter@FreeBSD.org>

OBJFORMAT_DEFAULT = elf now. (this is where /usr/bin/objformat and
libc/gen/getobjformat.c get their default from)


# 6cde7a16 13-Oct-1998 David Greenman <dg@FreeBSD.org>

Fixed two potentially serious classes of bugs:

1) The vnode pager wasn't properly tracking the file size due to
"size" being page rounded in some cases and not in others.
This sometimes resulted in corrupted files. First noticed by
Terry Lambert.
Fixed by changing the "size" pager_alloc parameter to be a 64bit
byte value (as opposed to a 32bit page index) and changing the
pagers and their callers to deal with this properly.
2) Fixed a bogus type cast in round_page() and trunc_page() that
caused some 64bit offsets and sizes to be scrambled. Removing
the cast required adding casts at a few dozen callers.
There may be problems with other bogus casts in close-by
macros. A quick check seemed to indicate that those were okay,
however.


# cfa4d739 08-Sep-1998 John Polstra <jdp@FreeBSD.org>

Add a new library function getobjformat(). It checks all the
standard places ("/etc/objformat", ${OBJFORMAT}, argv) for an
indication of the user's preferred object file format. This
consolidates some code that was starting to be duplicated in more
and more places.

Use the new function in ldconfig.

Note: I don't think that gcc should use getobjformat(), even though
it could. The compiler should limit itself to functions that are
widespread, to ease porting and cross-compilation.


# 582e5286 31-Aug-1998 KATO Takenori <kato@FreeBSD.org>

- hw.machine_arch returns cpu architecture type.
- moved definition of MACHINE_ARCH from cpu.h to parm.h as alpha.
- Added definitions of _MACHINE and _MACHINE_ARCH.
- Added hw.ispc98. The hw.ispc98 is 1 in PC98 kernel and is 0 in
IBM-PC kernel.

Discussed with: John Birrell <jb@FreeBSD.ORG>


# 7cac3870 14-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Oops, uoff_t can't be used here yet.


# f0c2a198 14-Jun-1998 Bruce Evans <bde@FreeBSD.org>

Removed LOCORE ifdef. This header isn't used for locore stuff.

Use uoff_t instead of `unsigned long long' for unsigned offsets.

Fixed some style bugs.


# 50ce7ff4 23-Jan-1998 John Dyson <dyson@FreeBSD.org>

Add better support for larger I/O clusters, including larger physical
I/O. The support is not mature yet, and some of the underlying implementation
needs help. However, support does exist for IDE devices now.


# 78292efe 30-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

Another round of lock pushdown.
Add a simplelock to deal with disable_intr()/enable_intr() as used in UP kernel.
UP kernel expects that this is enough to guarantee exclusive access to
regions of code bracketed by these 2 functions.
Add a simplelock to bracket clock accesses in clock.c: clock_lock.

Help from: Bruce Evans <bde@zeta.org.au>


# 662f9a69 29-Aug-1997 KATO Takenori <kato@FreeBSD.org>

Move MACHINE_ARCH definition from <machine/param.h> to <machine/cpu.h>.

Submitted by: Bruce Evans <bde@zeta.org.au>


# d3e65fbc 29-Aug-1997 KATO Takenori <kato@FreeBSD.org>

Fix typo in the comment introduced by me.


# 664f8517 29-Aug-1997 KATO Takenori <kato@FreeBSD.org>

Added a sysctl arg, hw.machine_arch. The hw.machine_arch is "ibm-pc"
on IBM-PC box and is "pc-98" on NEC PC-98 box. Userland program can
distinguish architecture on which the program runs.


# 886e7896 23-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

The last of the encapsolation of cpl/spl/ipending things into a critical
region protected by the simplelock 'cpl_lock'.

Notes:

- this code is currently controlled on a section by section basis with
defines in machine/param.h. All sections are currently enabled.

- this code is not as clean as I would like, but that can wait till later.

- the "giant lock" still surrounds most instances of this "cpl region".
I still have to do the code that arbitrates setting cpl between the
top and bottom halves of the kernel.

- the possibility of deadlock exists, I am committing the code at this
point so as to exercise it and detect any such cases B4 the "giant lock"
is removed.


# b3e4e390 20-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

Moved the COM_LOCK and COM_UNLOCK macros to machine/param.h.


# 4a73d99f 20-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

Made PEND_INTS default.
Made NEW_STRATEGY default.
Removed misc. old cruft.

Centralized simple locks into mp_machdep.c
Centralized simple lock macros into param.h

More cleanup in the direction of making splxx()/cpl MP-safe.


# 75d23f5f 17-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

Turn on the lockmanager by default for SMP.

Reviewed by: "John S. Dyson" <toor@dyson.iquest.net>


# 48a09cf2 08-Aug-1997 John Dyson <dyson@FreeBSD.org>

VM86 kernel support.
Work done by BSDI, Jonathan Lemon <jlemon@americantv.com>,
Mike Smith <msmith@gsoft.com.au>, Sean Eric Fagan <sef@kithrup.com>,
and probably alot of others.
Submitted by: Jnathan Lemon <jlemon@americantv.com>


# d3d1eb99 06-Aug-1997 John Dyson <dyson@FreeBSD.org>

Fix the DDB breakpoint code when using the 4MB page support.


# 28f53d31 04-Aug-1997 Steve Passe <fsmp@FreeBSD.org>

pushed down "volatility" of simplelock to actual int inside the struct.

Submitted by: bde@zeta.org.a


# e27fb7b6 24-Jul-1997 Steve Passe <fsmp@FreeBSD.org>

param.h:
Macros to convert the Lite2 lock manager primitives to the names used
in the kernel proper. This allows us to hide them from the lock
manager till they can be turned on.
smp.h:
declarations for the new simplelock functions.


# d9593fb9 23-Jul-1997 Steve Passe <fsmp@FreeBSD.org>

Forced 32bit alignment of struct simple_lock in param.h.

Added declarations of new simple_lock data and functions to smp.h.


# b1ba015c 22-Jul-1997 Steve Passe <fsmp@FreeBSD.org>

Added a missing semicolon, compile failed when I turned on simple_lock().
Evidently this has never been compiled before, NOT a good sign...


# de871ab6 07-Apr-1997 Peter Wemm <peter@FreeBSD.org>

Define UPAGES_HOLE at 2 (same as current UPAGES) in case UPAGES changes
later. This is used to calculate the top of user address space.


# 6875d254 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.


# 996c772f 09-Feb-1997 John Dyson <dyson@FreeBSD.org>

This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
Mount_std mounts will not work until the getfsent
library routine is changed.

Reviewed by: various people
Submitted by: Jeffery Hsu <hsu@freebsd.org>


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# bb2038d5 06-Oct-1996 Bruce Evans <bde@FreeBSD.org>

Improved the btodb() and dbtob() macros. I made them give unsigned
[long long] results when I last worked on them, but they are normally
used together with to daddr_t's and off_t's which are signed, so the
unsigned results did little except cause warnings.


# aa8de40a 03-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Another sweep over the pmap/vm macros, this time with more focus on
the usage. I'm not satisfied with the naming, but now at least there is
less bogus stuff around.


# 5084d10d 02-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

Move atdevbase out of locore.s and into machdep.c
Macroize locore.s' page table setup even more, now it's almost readable.
Rename PG_U to PG_A (so that I can...)
Rename PG_u to PG_U. "PG_u" was just too ugly...
Remove some unused vars in pmap.c
Remove PG_KR and PG_KW
Remove SSIZE
Remove SINCR
Remove BTOPKERNBASE

This concludes my spring cleaning, modulus any bug fixes for messes I
have made on the way.

(Funny to be back here in pmap.c, that's where my first significant
contribution to 386BSD was... :-)


# e911eafc 02-May-1996 Poul-Henning Kamp <phk@FreeBSD.org>

removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
NPDEPG

Major macro cleanup.


# b64b660c 25-May-1995 David Greenman <dg@FreeBSD.org>

Made "NMBCLUSTERS" calculation dynamic and fixed bogus use of "NMBCLUSTERS"
in machdep.c (it should use the global nmbclusters). Moved the calculation
of nmbclusters into conf/param.c (same place where nmbclusters has always
been assigned), and made the calculation include an extra amount based
on "maxusers". NMBCLUSTERS can still be overrided in the kernel config
file as always, but this change will make that generally unnecessary. This
fixes the "bug" reports from people who have misconfigured kernels seeing
the network hang when the mbuf cluster pool runs out.

Reviewed by: John Dyson


# 43decb53 19-Feb-1995 Gary Palmer <gpalmer@FreeBSD.org>

Bruces fixes for large filesystems

Submitted by: Bruce Evans <bde@zeta.org.au>


# fb1322e4 23-Jan-1995 David Greenman <dg@FreeBSD.org>

Decrease MCLBYTES from 4k back to 2k. It isn't likely that we'll be doing
page flipping anytime soon and 4k just wastes memory. Performance via the
looback interface will decrease slightly by this change. Idealy, we need
buffers that can have variable sizes, but this requires a rewrite of far
too much code at the moment.


# 6052572a 18-Sep-1994 Bruce Evans <bde@FreeBSD.org>

Replace `unsigned' by `u_int' so that it is not necessary to include
<sys/types.h> before including this header. This header is now
idempotent.

Uniformize idempotency #ifdef.


# 26f9a767 25-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.

Reviewed by: Rodney W. Grimes
Submitted by: John Dyson and David Greenman


# 04f18356 07-Mar-1994 David Greenman <dg@FreeBSD.org>

1) "Pre-faulting" in of pages into process address space
Eliminates vm_fault overhead on process startup and
mmap referenced data for in-memory pages.

(process startup time using in-memory segments *much* faster)

2) Even more efficient pmap code. Code partially cleaned up.
More comments yet to follow.

(generally more efficient pte management)

3) Pageout clustering ( in addition to the FreeBSD V1.1 pagein
clustering.)

(much faster paging performance on non-write behind disk
subsystems, slightly faster performance on other systems.)

4) Slightly changed vm_pageout code for more efficiency and
better statistics. Also, resist swapout a little more.

(less likely to pageout a recently used page)

5) Slight improvement to the page table page trap efficiency.

(generally faster system VM fault performance)

6) Defer creation of unnamed anonymous regions pager until needed.

(speeds up shared memory bss creation)

7) Remove possible deadlock from swap_pager initialization.

8) Enhanced procfs to provide "vminfo" about vm objects and user
pmaps.

9) Increased MCLSHIFT/MCLBYTES from 2K to 4K to improve net &
socket performance and to prepare for things to come.

John Dyson
dyson@implode.root.com
David Greenman
davidg@root.com


# ec120393 30-Jan-1994 David Greenman <dg@FreeBSD.org>

VM system performance improvements from John Dyson and myself. The
following is a summary:

1) increased object cache back up to a more reasonable value.
2) removed old & bogus cruft from machdep.c (clearseg, copyseg,
physcopyseg, etc).
3) inlined many functions in pmap.c
4) changed "load_cr3(rcr3())" into tlbflush() and made tlbflush inline
assembly.
5) changed the way that modified pages are tracked - now vm_page struct
is kept updated directly - no more scanning page tables.
6) removed lots of unnecessary spl's
7) removed old unused functions from pmap.c
8) removed all use of page_size, page_shift, page_mask variables - replaced
with PAGE_ constants.
9) moved trunc/round_page, atop, ptoa, out of vm_param.h and into i386/
include/param.h, and optimized them.
10) numerous changes to sys/vm/ swap_pager, vnode_pager, pageout, fault
code to improve performance. LRU algorithm modified to be more
effective, read ahead/behind values tuned for better performance,
etc, etc...


# 7f8cb368 14-Jan-1994 David Greenman <dg@FreeBSD.org>

"New" VM system from John Dyson & myself. For a run-down of the
major changes, see the log of any effected file in the sys/vm
directory (swap_pager.c for instance).


# aaf08d94 18-Dec-1993 Garrett Wollman <wollman@FreeBSD.org>

Make everything compile with -Wtraditional. Make it easier to distribute
a binary link-kit. Make all non-optional options (pagers, procfs) standard,
and update LINT to reflect new symtab requirements.

NB: -Wtraditional will henceforth be forgotten. This editing pass was
primarily intended to detect any constructions where the old code might
have been relying on traditional C semantics or syntax. These were all
fixed, and the result of fixing some of them means that -Wall is now a
realistic possibility within a few weeks.


# 57bb0ee4 17-Nov-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

New version of scsi code from Julian


# 0967373e 12-Nov-1993 David Greenman <dg@FreeBSD.org>

First steps in rewriting locore.s, and making info useful
when the machine panics.

i386/i386/locore.s:
1) got rid of most .set directives that were being used like
#define's, and replaced them with appropriate #define's in
the appropriate header files (accessed via genassym).
2) added comments to header inclusions and global definitions,
and global variables
3) replaced some hardcoded constants with cpp defines (such as
PDESIZE and others)
4) aligned all comments to the same column to make them easier to
read
5) moved macro definitions for ENTRY, ALIGN, NOP, etc. to
/sys/i386/include/asmacros.h
6) added #ifdef BDE_DEBUGGER around all of Bruce's debugger code
7) added new global '_KERNend' to store last location+1 of kernel
8) cleaned up zeroing of bss so that only bss is zeroed
9) fix zeroing of page tables so that it really does zero them all
- not just if they follow the bss.
10) rewrote page table initialization code so that 1) works correctly
and 2) write protects the kernel text by default
11) properly initialize the kernel page directory, upages, p0stack PT,
and page tables. The previous scheme was more than a bit
screwy.
12) change allocation of virtual area of IO hole so that it is
fixed at KERNBASE + 0xa0000. The previous scheme put it
right after the kernel page tables and then later expected
it to be at KERNBASE +0xa0000
13) change multiple bogus settings of user read/write of various
areas of kernel VM - including the IO hole; we should never
be accessing the IO hole in user mode through the kernel
page tables
14) split kernel support routines such as bcopy, bzero, copyin,
copyout, etc. into a seperate file 'support.s'
15) split swtch and related routines into a seperate 'swtch.s'
16) split routines related to traps, syscalls, and interrupts
into a seperate file 'exception.s'
17) remove some unused global variables from locore that got
inserted by Garrett when he pulled them out of some .h
files.

i386/isa/icu.s:
1) clean up global variable declarations
2) move in declaration of astpending and netisr

i386/i386/pmap.c:
1) fix calculation of virtual_avail. It previously was calculated
to be right in the middle of the kernel page tables - not
a good place to start allocating kernel VM.
2) properly allocate kernel page dir/tables etc out of kernel map
- previously only took out 2 pages.

i386/i386/machdep.c:
1) modify boot() to print a warning that the system will reboot in
PANIC_REBOOT_WAIT_TIME amount of seconds, and let the user
abort with a key on the console. The machine will wait for
ever if a key is typed before the reboot. The default is
15 seconds, but can be set to 0 to mean don't wait at all,
-1 to mean wait forever, or any positive value to wait for
that many seconds.
2) print "Rebooting..." just before doing it.

kern/subr_prf.c:
1) remove PANICWAIT as it is deprecated by the change to machdep.c

i386/i386/trap.c:
1) add table of trap type strings and use it to print a real trap/
panic message rather than just a number. Lot's of work to
be done here, but this is the first step. Symbolic traceback
is in the TODO.

i386/i386/Makefile.i386:
1) add support in to build support.s, exception.s and swtch.s

...and various changes to various header files to make all of the
above happen.


# 6e393973 07-Nov-1993 Garrett Wollman <wollman@FreeBSD.org>

Made all header files idempotent and moved incorrect common data from
headers into a related source file. Added cons.h as first step towards
moving i386/i386/cons.h to machine/cons.h where it belongs.


# d42d25c4 15-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

param.h:

Mark the fact that PGSHIFT and PDRSHIFT are really the same as
PG_SHIFT and PD_SHIFT, these should be collapsed some day soon.

Document that KERNBASE should really be KPTDPTDI << PDRSHIFT, for
now leave it as the constant 0xFE000000 until I make a seperate
common header file for this stuff (vmaddresses.h?)

Remove NKMEMCLUSTERS define, it was only being used to define
VM_KMEM_SIZE, so why have all the indirection. Besides who wants
to work in CLBYTE sizes chuncks.


pmap.h:

Fix $Id$ and some other minor format clean ups.

Remove the XXX comment about NKPDE, since it now has the correct value
of 7.

Remove unused LASTPTDI and move the APTD into the very end of memory to
free up 4MB of kernel virtual address space.
Remove unused RSVDPTDI and free up 12MB of kernel virtual address space.


vmparam.h

Fix $Id$.

Increase SHMMAXPGS to 512 (2MB) now that there is room for it to be
bigger. The XXX comment stays until the kernel moves down in memory
to free up enough space to use the proper default of 4MB.

VM_KMEM_SIZE is now a direct constant stating the size of the kernel
malloc region. Increased the value from 3MB to 16MB.


# da73bf46 11-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Fixed PHYSTOKV, addition operator on pointers is the wrong thing to do
here. This is really a crock, but it works.


# d529c3d8 12-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Add PHYSTOKV used in scsi drivers with a correct definition based on
KERNBASE.

Change #define<tab> to #define<space> on lines that had it wrong


# c77ba360 08-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Fix definitions to be in terms of a minimum number of constants by
using the SHIFT value as the basis for the other values, for example
instead of:
#define NBPG 4096
#define PGSHIFT 12
use:
#define PGSHIFT 12
#define NBPG (1 << PGSHIFT)

===================================================================
RCS file: /a/cvs/386BSD/src/sys/i386/include/param.h,v
retrieving revision 1.3
diff -c -r1.3 param.h
*** 1.3 1993/10/08 12:49:55
--- param.h 1993/10/08 12:53:19
***************
*** 52,76 ****
#define ALIGNBYTES (sizeof(int) - 1)
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)

- #define NBPG 4096 /* bytes/page */
- #define PGOFSET (NBPG-1) /* byte offset into page */
#define PGSHIFT 12 /* LOG2(NBPG) */
#define NPTEPG (NBPG/(sizeof (struct pte)))

- #define NBPDR (1024*NBPG) /* bytes/page dir */
- #define PDROFSET (NBPDR-1) /* byte offset into page dir */
#define PDRSHIFT 22 /* LOG2(NBPDR) */

#define KERNBASE 0xFE000000 /* start of kernel virtual */
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)

! #define DEV_BSIZE 512
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
#define BLKDEV_IOSIZE 2048
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */

- #define CLSIZE 1
#define CLSIZELOG2 0

/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
#define SSIZE 1 /* initial stack size/NBPG */
--- 52,79 ----
#define ALIGNBYTES (sizeof(int) - 1)
#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)

#define PGSHIFT 12 /* LOG2(NBPG) */
+ #define NBPG (1 << PGSHIFT) /* bytes/page */
+ #define PGOFSET (NBPG-1) /* byte offset into page */
#define NPTEPG (NBPG/(sizeof (struct pte)))

#define PDRSHIFT 22 /* LOG2(NBPDR) */
+ #define NBPDR (1 << PDRSHIFT) /* bytes/page dir */
+ #define PDROFSET (NBPDR-1) /* byte offset into page dir */

#define KERNBASE 0xFE000000 /* start of kernel virtual */
#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT)

! #define KERNSIZE 0x00C00000 /* size of kernel virtual */
!
#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+ #define DEV_BSIZE (1 << DEV_BSHIFT)
+
#define BLKDEV_IOSIZE 2048
#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */

#define CLSIZELOG2 0
+ #define CLSIZE (1 << CLSIZELOG2)

/* NOTE: SSIZE, SINCR and UPAGES must be multiples of CLSIZE */
#define SSIZE 1 /* initial stack size/NBPG */
***************
*** 92,99 ****
#ifndef MCLSHIFT
#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
#endif /* MCLSHIFT */
! #define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
! #define MCLOFSET (MCLBYTES - 1) /* offset within a m_buf cluster */

#ifndef NMBCLUSTERS
#ifdef GATEWAY
--- 95,102 ----
#ifndef MCLSHIFT
#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
#endif /* MCLSHIFT */
! #define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */
! #define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */

#ifndef NMBCLUSTERS
#ifdef GATEWAY


# 89ec6ec6 07-Oct-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Removed patch kit header. Cleaned up tabbing and removed extra blank
lines to match NetBSD. Added $Id$.
Added MID_MACHINE from NetBSD.
Removed definition of DELAY() for non-kernel soures.
Fixed some small english errors that had been corrected in NetBSD.
File is now identical to NetBSD's, but will be changing soon for some
of my clean up work.


# f798d060 27-Jul-1993 Nate Williams <nate@FreeBSD.org>

fts(3) integration patches


# 5b81b6b3 12-Jun-1993 Rodney W. Grimes <rgrimes@FreeBSD.org>

Initial import, 0.1 + pk 0.2.4-B1