Home | History | Annotate | Download | only in include
History log of /src/sys/arch/mips/include/mips_param.h
RevisionDateAuthorComments
 1.56  03-May-2025  riastradh mips_param.h: Add include guard.

Prompted by nearby fix for:

PR port-evbmips/59385: PGSHIFT is inconsistently defined on MIPS
 1.55  03-May-2025  riastradh mips: Include opt_cputype.h before any of the flags it defines.

PR port-evbmips/59385: PGSHIFT is inconsistently defined on MIPS
 1.54  25-Apr-2025  riastradh mips: Align stack pointer on entry to signal handler.

Based on a patch by rin@. The variant approach I took puts the stack
frame allocation and alignment logic in one place (getframe, used by
sendsig_siginfo for native (n64, on mips), netbsd32_sendsig_siginfo
for compat32 (n32/o32, on mips), and sendsig_sigcontext (compat 1.6))
and reduces the chance of provoking compiler exploitation of
undefined behaviour by doing arithmetic in uintptr_t rather than in
pointers to large aligned structs. This also ensures the resulting
pointer is aligned for the object (struct siginfo_sigframe, struct
siginfo_sigframe32, struct sigcontext), not just for the ABI stack
alignment.

PR kern/59327: user stack pointer is not aligned properly
 1.53  20-Apr-2025  riastradh t_signal_and_sp: Add mips support.

PR kern/59327: user stack pointer is not aligned properly

PR kern/58149: Cannot return from a signal handler if SP was
misaligned when the signal arrived

Stack pointer misaligment in some cases hypothesized to be a possible
cause of:

PR port-evbmips/59236: Multiple segfaults in erlite3 boot
 1.52  04-Oct-2021  andvar remove duplicate the article in comments.
 1.51  31-May-2021  simonb Include "opt_param.h" (ifdef _KERNEL_OPT) everywhere that MSGBUFSIZE is
referenced since some sources include <machine/param.h>.
 1.50  23-May-2021  mrg fix "uname -p" on mips n32.

this has been returning "mipsn64eb" on my edgerouter4 with the
32 bit uname binary.

introduce o32, n32, and n64 versions of MACHINE_ARCH, and use
them appropriately in PROC_MACHINE_ARCH32(). now o32, n32 and
n64 "uname -p" all return different values.
 1.49  08-May-2021  skrll branches: 1.49.2;
KNG
 1.48  26-Apr-2021  christos Make MACHINE_ARCH for n64 binaries mipsn64e[bl] instead of mips64e[bl] to
differentiate them from n32/o32 binaries.
 1.47  26-Aug-2020  simonb branches: 1.47.6;
Define a UPAGES_MAX constant to size the a md_upte array in MIPS's
struct mdlwp. This is exposed to userland, so we can't use something
based on PAGE_SIZE.
 1.46  23-Aug-2020  simonb Use a 16kB USPACE (and larger kernel stack) for LP64 kernels. Invert
the logic for setting the USPACE size. Define a desired USPACE size
(16kB for LP64, 8kB otherwise) then divide by PAGE_SIZE to get UPAGES.

Fixes random segmap lossage, since the uarea usually sits immediately
above the segmap for a process. Thanks to mrg@, skrll@ and dholland@
for testing, debugging and general help tracking down this problem.
 1.45  26-Jul-2020  simonb #define<tab>
Nuke trailing whitespace.
 1.44  26-Jul-2020  simonb Add a space in a comment.
 1.43  23-Jul-2020  skrll Add a comment to CACHE_LINE_SIZE / COHERENCY_UNIT size defines
 1.42  23-Jul-2020  skrll On second thoughts this can't be conditional so define CACHE_LINE_SIZE /
COHERENCY_UNIT as 128 for all mips.
 1.41  23-Jul-2020  skrll Define CACHE_LINE_SIZE / COHERENCY_UNIT as 128 for MIPS64_OCTEON
 1.40  19-Jun-2019  skrll Whitespace and whitespace consistency
 1.39  11-May-2019  skrll #define<tab> for consistency
 1.38  11-Jul-2016  matt branches: 1.38.18;
Change MIPS to use the common pmap code.
Switch to 8KB pages on CPUs with a R4K MMU.
Simplify cache code.
Merge in most of changes from matt-mips64 branch
 1.37  11-Jun-2015  matt Use (uint64_t) to avoid 32-bit overflow
 1.36  11-Jun-2015  matt Don't include <machine/param.h> in .S files, get the needed values from assym.h
Define NBPG as UL to avoid integer over with NBXSEG on LP64 systems.
(.S files don't like numbers with UL appended to them).
 1.35  07-Jun-2015  matt assembly no longer include <machine/cpu.h>. Instead MIPS_CURLWP is gotten
from regdef.h and everything else from assym.h. <mips/mips_param.h> no
longer include <machine/cpu.h>
 1.34  23-May-2013  christos branches: 1.34.10;
add generic copyrights so FreeBSD can use them.
 1.33  01-Feb-2012  matt branches: 1.33.6;
Add ALIGNBYTES32/ALIGN32 for netbsd32.
 1.32  24-Jan-2012  christos Use and define ALIGN() ALIGN_POINTER() and STACK_ALIGN() consistently,
and avoid definining them in 10 different places if not needed.
 1.31  20-Jan-2012  joerg Change CMSG_SPACE and CMSG_LEN to provide Integer Constant Expressions
again. This was changed in sys/socket.h r1.51 to work around fallout
from the IPv6 aux data migration. It broke the historic ABI on some
platforms. This commit restores compatibility for netbsd32 code on such
platforms and provides a template for future changes to the CMSG_*
alignment. Revert PCC/Clang workarounds in postfix and tmux.
 1.30  19-Jan-2012  matt Add ALIGNBYTES32/ALIGN32 (same as ALIGNBYTES/ALIGN).
 1.29  05-Mar-2011  matt branches: 1.29.4; 1.29.8;
If _KERNEL is not defined, force MACHINE to be "mips". Userland should be
using uname/sysctl to get this value.
 1.28  20-Feb-2011  matt Major merge forward from matt-nb5-mips64.
New fixup code.
New common SPL code.
New common interrupt code.
Move related variables into structures.
Cleanup locore (move MD variable into it).
Kill StudlyCaps
Use PCU for FPU
 1.27  08-Feb-2010  joerg branches: 1.27.2; 1.27.4; 1.27.6;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.26  14-Dec-2009  matt branches: 1.26.2;
Merge from matt-nb5-mips64
Merge mips-specific arch files.
 1.25  13-Aug-2009  matt Move MID_MACHINE to <mips/mips_param.h> and use local values so we don't
need to include exec_aout.h
 1.24  09-Aug-2009  matt Beginning of large-page support.
 1.23  28-Aug-2006  yamt branches: 1.23.60; 1.23.78;
- remove unused bdbtofsb.
- move the following macros from MD headers to sys/param.h.
ctod
dtoc
ctob
btoc
dbtob
btodb
 1.22  26-Aug-2006  matt Don't cast pointers using unsigned and/or int. Use intptr_t or uintptr_t
as appropriate.
 1.21  11-Dec-2000  tsutsui branches: 1.21.40; 1.21.54; 1.21.58;
space -> TAB
 1.20  09-Jun-2000  soda make paddr_t 64bit on arc port by introducing _MIPS_PADDR_T_64BIT.
 1.19  27-Mar-2000  nisimura branches: 1.19.2;
Nuke MIPS_16K_PAGE conditional which should be commited in. It
was used for debugg'n purposes which only make senses on particular
hardware configurations and has never been intended to extend pagesize
of NetBSD/mips.
 1.18  19-Feb-2000  mycroft Don't pull in cpu.h in non-kernel code.
 1.17  11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.16  09-Jan-2000  simonb Use the badaddr() prototype in mips/include/cpu.h by including
<machine/cpu.h> in mips/include/mips_param.h. Remove duplicate
badaddr() prototypes from some pmax header files.
 1.15  04-Dec-1999  ragge CL* discarding.
 1.14  25-Sep-1999  shin branches: 1.14.2; 1.14.8;
Changes for NetBSD/hpcmips.

Support VR4100.
Support 16KB page.
Support CPU without FPU.

Fix virtual alias problem(physio() case).

[new options]

options MIPS3_4100 /* VR4100 core */
options MIPS_16K_PAGE /* enable kernel support for 16k pages */
options SOFTFLOAT /* No FPU; avoid touching FPU registers */
 1.13  24-Apr-1999  simonb Nuke register and remove trailling white space.
 1.12  09-Feb-1999  tv branches: 1.12.4;
Split the "mips" MACHINE_ARCH for 1.4. newsmips is "mipseb"; pmax is
"mipsel".
 1.11  14-Jan-1999  castor * Create mips_reg_t data type to allow register size to be
decoupled from long or int or long long. Define macros in asm.h to facilitate
choosing these on a port by port basis.

* Create <machine/pubassym.h> mechanism to allow jmp_buf structure size
to be calculated at system build time.

* Define _MIPS_BSD_SIM macro which specifies what calling style is appropritae
for the architecture. For 64-bit oriented systems set the Status Register
to allow 64-bit instructions.

* Remove UADDR related macros because kernel U structure is now mapped
normally.
* Separate cpu.h into cpu.h and cpuarch.h to keep things neat.
* Add support for QED 52xx processors
 1.10  11-Sep-1998  jonathan Changes to sys/arch/mips from ARC port, from Noriyuki Soda <soda@sra.co.jp>.
Adds (most) support for ARC platform to port-independent mips code.

Some changes (e.g., clean up of overlapping CPU/FPU ids) inspired by
comparison to the OpenBSD 2.1 codebase of Soda's ARC port.

Open issues:
* Still no support for r4600 or mipsIV CPUs with two-way L1 cache.
Code derived from Per Fogelstrom's OpenBSD source doesn't work
on mips3 pmaxes with L2 cache.

* Still some port-specific #ifdefs, for interrupt enable and
pmax L2 cache-size. Needs more thought, but overlaps with
work-in-progress by Tohru and Tsubai on spl()s and related stuff.
 1.9  25-Aug-1998  nisimura Make spl(9) rountines target port dependent. delay() is also port
dependent anticipating a target with high resolution timer available
for on-the-fly re-programming. Enum decstation_t was removed from MI
trap.c.
 1.8  19-Feb-1998  thorpej Use a reasonable default for NKMEMCLUSTERS. Previous default value wouldn't
run multi-user for very long at all, and every kernel configuration file
overrides it!
 1.7  20-Sep-1997  leo Move the definition of MSGBUFSIZE up to the machine-arch level if
possible. Pointed out by Bernd Ernesti.
 1.6  20-Aug-1997  jonathan Move SSIZE and DELAY() definitions to sys/arch/mips/include/mips_param.h.
Update comment in pmax/include/param.h (pr 3988).
 1.5  07-Jul-1997  jonathan branches: 1.5.2;
DDB for mips.
Add DDB interface to /sys/arch/mips/mips..
Rework heuristic stack traceback to work with DDB.
Add hooks to print exception log from DDB.
Add hooks from pmax console drivers: call Debugger()
after break from serial console, or 'DO' key from LK-xxx.
 1.4  16-Jun-1997  jonathan Garbage-collect non-jumptable prototype for wbflush().
 1.3  08-Jun-1997  jonathan Move MACHINE_ARCH and _MACHINE_ARCH from pmax/include/param.h to
mips/include/mips_param.h. (They should be common to all mips ports.)
 1.2  28-Feb-1997  jonathan Define ALIGNED_POINTER
(missed when other <arch>/include/param.h files were updated)
 1.1  19-May-1996  jonathan branches: 1.1.8;
Remove common-across-all-MIPS-cpu definitions (e.g., user-level-visible
page/segment size definitions and macros) from pmax/include/param.h,
and move them to mips/include/mips_param.h.
 1.1.8.1  12-Mar-1997  is Merge in changes from Trunk
 1.5.2.2  22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.2.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.14.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.2.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.14.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.58.1  03-Sep-2006  yamt sync with head.
 1.21.54.1  09-Sep-2006  rpaulo sync with head
 1.21.40.1  30-Dec-2006  yamt sync with head.
 1.23.78.13  04-Aug-2012  matt Make MIPS use a multi-level page table for the kernel address space.
(just like the user address does). XXX fix mips1
 1.23.78.12  27-Feb-2012  matt Make sure we don't overflow a 32-bit integer.
 1.23.78.11  27-Dec-2011  matt Deal with not defining PAGE_SIZE or PAGE_SHIFT for non-kernel inclusion.
 1.23.78.10  27-Dec-2011  matt Make these play nice with modules.
 1.23.78.9  23-Dec-2011  matt Use MIPS_PAGE_SHIFT to define the page size to be used from a config file.
Add support for tracking which colors have been used for an EXECPAGE.
 1.23.78.8  03-Dec-2011  matt Add __cacheline_aligned and __read_mostly from -HEAD.
 1.23.78.7  02-Dec-2011  matt Add support for 8KB pages.
 1.23.78.6  16-Aug-2010  matt Support user VAs > 4GB (but less than 1TB for now) using a 3 level page table.
Add debug code to help find redundant faults (PMAP_FAULTINFO).
 1.23.78.5  05-Feb-2010  matt Add __HAVE_FAST_SOFTINTS support.
Add routine to remap an uarea via a direct-mapped address. This avoids
TLB machinations when swtching to/from the softint thread. This can only
be done for lwp which won't exit.
 1.23.78.4  12-Sep-2009  matt Add MACHINE32_ARCH definitions.
 1.23.78.3  07-Sep-2009  matt Derive NBSEG and SEGSHIFT from NBPG and PGSHIFT.
 1.23.78.2  22-Aug-2009  matt Move MACHINE_ARCH definition to <mips/mips_param.h>
Move mbuf related defines to <mips/mips_param.h>
 1.23.78.1  20-Aug-2009  matt Add a default MSIZE/MCLBYTES block here since each mips port does the same
thing.
 1.23.60.2  11-Mar-2010  yamt sync with head
 1.23.60.1  19-Aug-2009  yamt sync with head.
 1.26.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.27.6.1  05-Mar-2011  bouyer Sync with HEAD
 1.27.4.1  06-Jun-2011  jruoho Sync with HEAD.
 1.27.2.2  06-Mar-2011  rmind sync with head (and fix few botches with this)
 1.27.2.1  05-Mar-2011  rmind sync with head
 1.29.8.1  18-Feb-2012  mrg merge to -current.
 1.29.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.4.1  17-Apr-2012  yamt sync with head
 1.33.6.2  03-Dec-2017  jdolecek update from HEAD
 1.33.6.1  23-Jun-2013  tls resync from head
 1.34.10.2  05-Oct-2016  skrll Sync with HEAD
 1.34.10.1  22-Sep-2015  skrll Sync with HEAD
 1.38.18.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.38.18.1  10-Jun-2019  christos Sync with HEAD
 1.47.6.2  17-Jun-2021  thorpej Sync w/ HEAD.
 1.47.6.1  13-May-2021  thorpej Sync with HEAD.
 1.49.2.1  31-May-2021  cjep sync with head

RSS XML Feed