History log of /netbsd-current/sys/compat/netbsd32/netbsd32.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.143 30-Jul-2023 rin

COMPAT_NETBSD32: Add support for epoll(2).


# 1.142 29-Jul-2023 rin

COMPAT_NETBSD32: Catch up with sys___kevent100() addition.

XXX
Add epoll_* and memfd_create.


# 1.141 12-Feb-2023 andvar

s/strucure/structure/ and s/structues/structures/ in comments.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.140 23-Apr-2022 reinoud

Implement support for mounting UDF in compat32
Fixes PR#56801


# 1.139 11-Nov-2021 martin

Adapt to recent posix_spawn extensions.


# 1.138 06-Nov-2021 thorpej

COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.141 12-Feb-2023 andvar

s/strucure/structure/ and s/structues/structures/ in comments.


Revision tags: netbsd-10-base bouyer-sunxi-drm-base
# 1.140 23-Apr-2022 reinoud

Implement support for mounting UDF in compat32
Fixes PR#56801


# 1.139 11-Nov-2021 martin

Adapt to recent posix_spawn extensions.


# 1.138 06-Nov-2021 thorpej

COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.140 23-Apr-2022 reinoud

Implement support for mounting UDF in compat32
Fixes PR#56801


# 1.139 11-Nov-2021 martin

Adapt to recent posix_spawn extensions.


# 1.138 06-Nov-2021 thorpej

COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.139 11-Nov-2021 martin

Adapt to recent posix_spawn extensions.


# 1.138 06-Nov-2021 thorpej

COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.138 06-Nov-2021 thorpej

COMPAT_NETBSD32 is all about running the 32-bit flavor of native
binaries on a 64-bit platform[*], as such:
- Make the logic about which "sendsig" flavor to call MI (as it is in the
native 64-bit environment) and follow the same rules as the native 32-bit
environment.
- Make COMPAT_NETBSD32 x COMPAT_16 work the same as it would in the
native 32-bit environment by providing a netbsd32_sendsig_sigcontext_16_hook,
rather than overriding the entire sendsig logic with a netbsd32_sendsig_hook.
- In netbsd32___sigaction_sigtramp(), make sure the compat_netbsd32_16
module is loaded if the trampoline version specifies a sigcontext style
handler, otherwise return EINVAL so that libc can try again with siginfo
style.

[*] ...except for arm32, which uses it to mean "run 32-bit OABI binaries
from the 32-bit EABI environment". Doing it this way was arguably a mistake,
but we are stuck with it for now, so support it by providing a machine-
dependent override for netbsd32_sendsig() that also disables the corresponding
logic in netbsd32___sigaction_sigtramp().

Fixes PR kern/56487.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base thorpej-i2c-spi-conf-base thorpej-cfargs-base thorpej-futex-base
# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.137 19-Jan-2021 simonb

The read/write/send/recv system calls return ssize_t because -1 is
returned on error. Therefore we must restrict the lengths of any
buffers to NETBSD32_SSIZE_MAX with compat32 to avoid garbage return
values.

Fixes ATF lib/libc/sys/t_write:write_err.


# 1.136 18-Jan-2021 simonb

s/u_intN_t/uintN_t/


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


Revision tags: thorpej-futex-base
# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.135 14-Jan-2021 simonb

Handle FSSIOCSET and FSSIOCGET; vndconfig(8) works with compat32 now.
XXX: FSSIOCSET50 and FSSIOCGET50 are not (yet) handled.


Revision tags: thorpej-futex-base
# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


# 1.133 16-May-2020 christos

branches: 1.133.2;
Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.134 01-Nov-2020 pgoyette

Separate the compat_netbsd32_coredump from the compat_netbsd32 and
coredump modules, into its own module.

Welcome to 7.99.75 !!!


Revision tags: thorpej-futex-base
# 1.133 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.133 16-May-2020 christos

Add ACL support for FFS. From FreeBSD.


Revision tags: bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 ad-namecache-base3 ad-namecache-base2 ad-namecache-base1 ad-namecache-base
# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.132 24-Dec-2019 kamil

Introduce PT_LWPSTATUS + PT_LWPNEXT, obsolete PT_LWPINFO

PT_LWPINFO is a legacy ptrace(2) operation that was originally intended
to retrieve the thread (LWP) information inside a traced process.

It has a number of flaws and is confused with PT_LWPINFO from FreeBSD.

PT_LWPSTATUS and PT_LWPNEXT address the problems (shortly by: rename,
removal of pl_event) and introduces new features: signal context
(pl_sigpend, pl_sigmask), LWP name (pl_name), LWP TLS base address
(pl_private). The private pointer was so far missing information for
a debugger.

PT_LWPSTATUS@nnn is now shipped with core(5) files and contain LWP specific
information, so far missed in the core(5) files.

PT_LWPSTATUS retrieves LWP information for the prompted thread.
PT_LWPNEXT retrieves LWP information for the next thread, borrowing the
semantics from NetBSD specific PT_LWPINFO.

PT_LWPINFO is namespaced with __LEGACY_PT_LWPINFO and still available for
the foreseeable future, without plans of removing it.

Add ATF tests for PT_LWPSTATUS + PT_LWPNEXT.

Keep ATF tests for PT_LWPINFO.

Switch GDB to new API.

Proposed on tech-kern@.


Revision tags: phil-wifi-20191119
# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

branches: 1.123.4;
use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.131 18-Nov-2019 rin

8-byte objects on i386 or arm-oabi are aligned in 4-byte boundary.
Therefore, we must use __attribute__((__aligned__(4))) for them.
netbsd32_{,u}int64 are provided for this purpose. However, we
cannot use it in <compat/sys/siginfo.h> due to circular dependency
b/w <machine/netbsd32_machdep.h>.

In order to distangle it, we choose here to have a duplicate type,
netbsd32_siginfo_uint64, in <compat/sys/siginfo.h>. The equivalence
with netbsd32_uint64 is asserted in <compat/netbsd32/netbsd32.h>.

Now, gdb for i386 works again on amd64 kernel.

Based on patch provided by kamil. Thanks!

XXX
pullup to netbsd-9


# 1.130 18-Nov-2019 rin

Sorry, revert unintentional parts of the previous commit:
http://mail-index.netbsd.org/source-changes/2019/11/18/msg110946.html

I was going to commit only netbsd32_signal.c.


# 1.129 18-Nov-2019 rin

Belatedly catch up with kern_sig.c rev 1.358:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_sig.c#rev1.358

Provide syscall information with SIGTRAP TRAP_SCE/TRAP_SCX so that
picotrace/truss, for example, works fine on COMPAT_NETBSD32.

With some minor changes:

- Centralize netbsd32_si{,32}_si{32,}() into netbsd32_ksi{,32}_ksi{32,}().
- Provide si_status with SIGCHLD.
- Remove the remaining of SA.

XXX
pullup to netbsd-9


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.128 07-Nov-2019 rin

For netbsd32_statvfs, f_spare should be netbsd32_uint64, not uint64_t.

Fix syscalls using struct statvfs on COMPAT_NETBSD32 on amd64, where
NETBSD32_INT64_ALIGN is __attribute__((__aligned__(4))).


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.127 03-Oct-2019 kamil

Switch kevent udata from intptr_t void*

Synchromize the struct field format with other BSDs and Darwin.

No ABI change between older and newer struct form on the ports.

The change will require no changes to most C users during the transition
period as the header keeps a caller cast.

Discussed with core@ and there were no objections for this move.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.126 26-Sep-2019 christos

accrightslen should be u_int for compat too


# 1.125 25-Sep-2019 christos

avoid signed-compare warning; use uintmax_t to print.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.124 22-Sep-2019 christos

Add a new member to struct vfsstat and grow the unused members
The new member is caled f_mntfromlabel and it is the dkw_wname
of the corresponding wedge. This is now used by df -W to display
the mountpoint name as NAME=


Revision tags: netbsd-9-base phil-wifi-20190609 isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

branches: 1.118.2;
add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


Revision tags: isaki-audio2-base
# 1.123 20-Feb-2019 mrg

use KASSERTMSG() in netbsd32_ptr32i().


# 1.122 09-Feb-2019 mrg

- expand the comment about what netbsd32_machdep.h should provide.
- add missing NETBSD32_POINTER_TYPE
- add static inline functions to convert pointers to/from 32 bit,
inclusing an overflow check for NETBSD32PTR32PLUS().


# 1.121 27-Jan-2019 pgoyette

Merge the [pgoyette-compat] branch


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126
# 1.120 25-Nov-2018 mlelstv

Restore netbsd32 compat code for new NPF ABI.


Revision tags: pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906
# 1.119 11-Aug-2018 mrg

support nullfs in netbsd32.


Revision tags: pgoyette-compat-0728 phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521
# 1.118 10-May-2018 christos

add {send,recv}mmsg


Revision tags: pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415
# 1.117 14-Apr-2018 mrg

redo the previous -- compat/sys/siginfo.h is already included
later, as is another header. move them up near the top.


Revision tags: pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 pgoyette-compat-base
# 1.116 18-Dec-2017 mrg

branches: 1.116.2;
include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

branches: 1.114.8;
tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


# 1.116 18-Dec-2017 mrg

include <compat/sys/siginfo.h> for siginfo32_t.


# 1.115 17-Dec-2017 christos

handle siginfo requests for ptrace32


Revision tags: tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 nick-nhusb-base-20170204 bouyer-socketcan-base pgoyette-localcount-20170107 nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.


Revision tags: nick-nhusb-base-20161204
# 1.114 13-Nov-2016 rin

tv_usec in netbsd32_timeval is suseconds_t (aka int32_t) rather than
netbsd32_long (considered harmless)

approved by martin


Revision tags: pgoyette-localcount-20161104
# 1.113 19-Oct-2016 skrll

PR kern/51514: ptrace(2) fails for 32-bit process on 64-bit kernel

Updated from the original patch in the PR by me.


Revision tags: nick-nhusb-base-20161004
# 1.112 23-Sep-2016 skrll

Trailing whitespace


# 1.111 23-Sep-2016 skrll

Types for wait6 and clock_getcpuclockid2


# 1.110 17-Sep-2016 christos

deal with not having KTRACE


Revision tags: localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226
# 1.109 26-Nov-2015 martin

branches: 1.109.2;
We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.


Revision tags: nick-nhusb-base-20150921
# 1.108 10-Aug-2015 mrg

move some header-specific pointer-typedefs into a header-specific area.


# 1.107 22-Jun-2015 mrg

add netbsd32 support for nfssvc(2). we do this by defining 5 copyin/out
functions that do all the ugly work, are just plain copyin/out for the
native system calls, and do the necessary translations for netbsd32.

with this i'm able to run 32 bit nfsd and mountd on 64 bit kernel and
mount the file systems remotely.


# 1.106 21-Jun-2015 mrg

s/sparc64/native 64 bit/ in a comment...


# 1.105 21-Jun-2015 martin

Implement trivial conversion for pset_*


# 1.104 20-Jun-2015 martin

Implement modctl, sigqueinfo and mq_*


Revision tags: nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base
# 1.103 05-Oct-2014 christos

branches: 1.103.2;
add tmpfs.


Revision tags: netbsd-7-0-2-RELEASE netbsd-7-0-1-RELEASE netbsd-7-0-RELEASE netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 netbsd-7-base tls-earlyentropy-base tls-maxphys-base
# 1.102 28-Jun-2014 dholland

branches: 1.102.2;
Revert the following changes:

src/sys/sys/quotactl.h 1.37
src/sys/compat/netbsd32/netbsd32.h 1.101
src/sys/compat/netbsd32/netbsd32_netbsd.c 1.188, 1.189
src/sys/kern/vfs_quotactl.c 1.39
src/sys/kern/vfs_syscalls.c 1.483
src/sys/ufs/lfs/ulfs_quota.c 1.11
src/sys/ufs/ufs/ufs_quota.c 1.116
src/lib/libquota/quota_kernel.c 1.5

and do them correctly.

If you're going to change the name of something, you need to change
the name of *all* the things with the same name, not just a handful,
and you should change it to something similar so it still matches the
rest of the system rather than just picking an arbitrarily different
name.

Hi, Joerg.

To wit, rename the quotactl "delete" operation to "del", because
"delete" is a reserved word in C++ and for some reason Joerg wants to
run internal interfaces used only by C code through his C++ compiler.
Do not rename it to "remove" instead, because this doesn't match
libquota or the rest of the usage throughout the system; and rename
all the related identifiers, not just the ones that blew the mind of
Joerg's C++ compiler.

Because this is not a user-facing API (the only userland consumer
sys/quotactl.h is libquota) it is sort of ok to make arbitrary
source-incompatible changes; however, by the same token it's completely
unnecessary. If it *were* a user-facing API that someone might have a
semi-rational reason to want to run a C++ compiler on, it would be
incorrect to change it at this point.


# 1.101 13-Jun-2014 joerg

delete -> remove


Revision tags: yamt-pagecache-base9 rmind-smpnet-nbase rmind-smpnet-base
# 1.100 30-Apr-2014 njoly

Do not use native off_t type under compat netbsd32, but a new
netbsd32_off_t that provide the expected alignment for 64bit types.


Revision tags: riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.99 03-Feb-2014 manu

branches: 1.99.2;
Properly translate struct swapent for COMPAT_NETBSD32 (missing commit)


# 1.98 24-Jan-2014 christos

sigaction until 1.4 had an int sigmask, don't trash the stack.


# 1.97 01-Jan-2014 dsl

Change the type of the 'cookie' that holds the state of the core dump file
from 'void *' to the actual type 'struct coredump_iostate *'.
In most of the code the contents of the structure are still unknown.
This just stops the wrong type of pointer being passed to the 'void *'
parameter.
I hope I've found everything, amd64 GENERIC and i386 GENERIC & ALL compile.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base agc-symver-base yamt-pagecache-base8 yamt-pagecache-base7 yamt-pagecache-base6
# 1.96 12-Oct-2012 christos

branches: 1.96.2;
fix pre-5 stat system call structure which should have used the pre-64-time_t
timestamps!


Revision tags: jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4
# 1.95 08-Apr-2012 martin

branches: 1.95.2;
Rework posix_spawn locking and memory management:
- always provide a vmspace for the new proc, initially borrowing from proc0
(this part fixes PR 46286)
- increase parallelism between parent and child if arguments allow this,
avoiding a potential deadlock on exec_lock
- add a new flag for userland to request old (lockstepped) behaviour for
better error reporting
- adapt test cases to the previous two and add a new variant to test the
diagnostics flag
- fix a few memory (and lock) leaks
- provide netbsd32 compat


Revision tags: jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6
# 1.94 06-Mar-2012 macallan

allow mounting ext2fs and msdosfs
while there also enable lfs but that's untested


Revision tags: jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3
# 1.93 19-Feb-2012 rmind

Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.


Revision tags: jmcneill-usbmp-base2 netbsd-6-base
# 1.92 01-Feb-2012 dholland

branches: 1.92.2;
Be consistent about whether idtype and objtype codes are signed or
unsigned. They are signed. (While unsigned might have been a better
choice, it doesn't really matter and the majority of preexisting uses
were signed. And consistency is good.)


# 1.91 01-Feb-2012 dholland

Improve the names of some members of struct quotactl_args. These are
effectively function parameter names, but since they need to be
described with the same names in the man page the choices do matter.
Some.


# 1.90 01-Feb-2012 dholland

Update compat_netbsd32 for new quotactl.


# 1.89 31-Jan-2012 matt

Add netbsd32_socklenp_t


Revision tags: jmcneill-usbmp-pre-base2 jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base
# 1.88 12-Oct-2011 dholland

branches: 1.88.2; 1.88.6;
As a precaution, add sys/param.h explicitly to some headers that will
no longer get it via sys/ucred.h and don't already include it
explicitly. These should in turn be removed when it can be confirmed
that it's safe to do so. (Because sys/param.h is full of things that
are often tested with #if, it's not in general safe to remove it
without checking, as such tests fail silently if the symbol goes
missing.)


# 1.87 30-Jun-2011 wiz

dependant -> dependent


Revision tags: rmind-uvmplock-nbase cherry-xenmp-base rmind-uvmplock-base
# 1.86 06-Mar-2011 bouyer

merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.


Revision tags: bouyer-quota2-nbase bouyer-quota2-base
# 1.85 22-Jan-2011 matt

Add the ability to mount NFS filesystems in COMPAT_NETBSD32
If in the kernel and NFS_ARGS_ONLY, just export struct nfs_args and its flags.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base
# 1.84 14-Dec-2009 matt

branches: 1.84.4; 1.84.6; 1.84.8;
Merge from matt-nb5-mips64


Revision tags: matt-premerge-20091211
# 1.83 12-Dec-2009 njoly

Remove semicolon from NETBSD32TOx_UAP macro definitions.


Revision tags: yamt-nfs-mp-base8 yamt-nfs-mp-base7 jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5 yamt-nfs-mp-base4 jym-xensuspend-nbase yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 jym-xensuspend-base nick-hppapmap-base
# 1.82 16-Mar-2009 njoly

Fix dev_t alignment, by not using the new 64bit value directly but
rather a 32bit aligned version (netbsd32_dev_t = netbsd32_uint64).

ok by cube@.


Revision tags: nick-hppapmap-base2
# 1.81 28-Jan-2009 njoly

branches: 1.81.2;
Revert the previous packed attribute fix. Instead make netbsd32_time_t
of type netbsd32_int64 which provides a 64-bit value with a 32-bit
alignment.

Suggested by dsl.


# 1.80 28-Jan-2009 njoly

Make netbsd32_timespec/netbsd32_timeval structures packed. This fix an
alignment problem between 64-bit kernel and 32-bit userland versions,
which ended in different structure sizes.


Revision tags: mjf-devfs2-base
# 1.79 11-Jan-2009 christos

merge christos-time_t


Revision tags: christos-time_t-nbase christos-time_t-base haad-dm-base2 haad-nbase2 ad-audiomp2-base haad-dm-base
# 1.78 22-Nov-2008 mrg

branches: 1.78.4;
implement netbsd32__sched_setparam(), netbsd32__sched_getparam(),
netbsd32__sched_setaffinity() and netbsd32__sched_getaffinity().


Revision tags: netbsd-5-base matt-mips64-base2 haad-dm-base1
# 1.77 15-Oct-2008 wrstuden

branches: 1.77.2; 1.77.4;
Merge wrstuden-revivesa into HEAD.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.76 29-May-2008 mrg

branches: 1.76.4;
remove clause #3 from my license where there are no other
copyright holders involved.


# 1.75 24-May-2008 njoly

Fix netbsd32_ipc_perm and netbsd32_shmid_ds structures to use correct
types.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase nick-net80211-sync-base keiichi-mipv6-base matt-armv6-nbase mjf-devfs-base hpcarm-cleanup-base
# 1.74 02-Feb-2008 dsl

branches: 1.74.6; 1.74.8; 1.74.10; 1.74.12;
Fix build


# 1.73 02-Feb-2008 dsl

Use the netbsd32_[u]int64 type for all 64bit items to ensure we have the
correct alignment/padding rules.
Removed the now-unnecessary #pragma packed for amd64.
Should fix the alignment of 'struct netbsd32_kevent' on non-amd64.


# 1.72 02-Feb-2008 dsl

Change u_intxx_t to uintxx_t and uint to unsigined int etc.
Fix indentation.


Revision tags: vmlocking2-base3 bouyer-xeni386-nbase bouyer-xeni386-base matt-armv6-base
# 1.71 25-Dec-2007 perry

Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h


# 1.70 20-Dec-2007 dsl

Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.


Revision tags: yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase jmcneill-pm-base
# 1.69 07-Dec-2007 ad

branches: 1.69.4;
Add: _lwp_setname, _lwp_getname, _lwp_ctl.


Revision tags: vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 reinoud-bufcleanup-base vmlocking-base
# 1.68 29-Sep-2007 dsl

branches: 1.68.4; 1.68.6;
Use netbsd32_uint64 instead of fsblkcnt_t and fsfilcnt_t in order to get
the correct alignment (4 bytes for i386) for the whole structure.


Revision tags: yamt-x86pmap-base
# 1.67 16-Sep-2007 dsl

branches: 1.67.2;
Define netbsd32_uint64 for 64bit integers with the alignment requirement
of the corresponding 32bit architecture.
Use it for the 64bit items in netbsd32_statvfs so that the structure
doesn't collect 8byte alignment (and 4 bytes of trailing padding).
This replaces the 'packed' attribute which wasn't architecture specific
and would cause massive overheads accessing every member of sparc64.
Should allow the MIPS64 port do DTRT.


Revision tags: nick-csl-alignment-base5 matt-mips64-base nick-csl-alignment-base
# 1.66 17-Jul-2007 christos

branches: 1.66.6; 1.66.8;
include <compat/sys/mount.h> MFSNAMELEN


Revision tags: mjf-ufs-trans-base
# 1.65 30-Jun-2007 dsl

Changes to sompat socket function to avoid the dreaded stackgap.


# 1.64 03-Jun-2007 dsl

Split netbsd32___semctl14() so that it is callable from
compat_10_netbsd32_sys_semsys() (where the one parameter is already in
kernel space).
Note that the code in compat_10_netbsd32_sys_semsys() has always been wrong,
since it called compat_14_sys___semctl() - which would read 64bit values!


Revision tags: yamt-idlelwp-base8
# 1.63 30-Apr-2007 dsl

Rework compat stat() and statvfs() code so that it no longer uses the stackgap.


Revision tags: thorpej-atomic-base
# 1.62 18-Mar-2007 dsl

Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).


# 1.61 16-Mar-2007 dsl

remove all the double (and triple) casts used to convert 32bit userspace
pointers to and from 64bit kernel pointers. Instead use the defines
NETBSD32PTR64(p32) to read a 32bit pointer and (the new) NETBSD32PTR32(p32,p64)
to write a 32bit pointer throughout.
The 32bit pointer is now a struct to enforce the above.
amd64 (with linux emul) and sparc64 will both compile (when the arch stuff
goes in soon), and amd64 still runs some i386 binaries.


# 1.60 04-Mar-2007 christos

branches: 1.60.2; 1.60.4; 1.60.6;
fix fallout from caddr_t changes.


# 1.59 04-Mar-2007 christos

Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base
# 1.58 19-Feb-2007 cube

Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.


Revision tags: post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 newlock2-base netbsd-4-base
# 1.56 21-Nov-2006 christos

adjust limits takes struct proc again.


# 1.55 21-Nov-2006 christos

From Nicolas Joly:

> It seems that 32bits programs, running under compat_netbsd32, using
> setrlimit force all other programs to have their maximum data size
> fixed at 3GB, where native 64bits apps used 8GB previously.

I tracked this one to the `netbsd32_adjust_limits()' function (called
when creating a new process under compat_netbsd32), where data and
stack limits are set without checking for shared `p_limit' structure
(p_limit->p_refcnt > 1). This explain the side effect where processes
have their limits changed when a compat_netbsd32 (or compat_linux32)
program is run.

The fix is to use `dosetrlimit()' to ensure the needed copy-on-write
behaviour for shared structure.


Revision tags: abandoned-netbsd-4-base yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 yamt-pdpolicy-base8 yamt-pdpolicy-base7 rpaulo-netinet-merge-pcb-base
# 1.54 13-Jul-2006 martin

branches: 1.54.4;
Fix alignement problems for fhandle_t, exposed by gcc4.1.

While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base chap-midi-base simonb-timecounters-base
# 1.53 31-May-2006 drochner

branches: 1.53.2;
support ntp_gettime again
compile tested by Havard Eidnes


Revision tags: yamt-pdpolicy-base5 elad-kernelauth-base
# 1.52 11-May-2006 mrg

branches: 1.52.2;
add an extra (uintptr_t) cast to NETBSD32TOP.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3
# 1.51 29-Mar-2006 cube

Implement the _lwp* and sa_* families of syscalls, using the newly
introduced hooks in the native code.


Revision tags: peter-altq-base yamt-pdpolicy-base2
# 1.50 06-Mar-2006 cube

branches: 1.50.2; 1.50.4;
Implement the SysV IPC family of syscalls.


Revision tags: yamt-pdpolicy-base
# 1.49 05-Mar-2006 cube

branches: 1.49.2;
Implement the ksem_* family of syscalls.


Revision tags: yamt-uio_vmspace-base5
# 1.48 11-Dec-2005 christos

branches: 1.48.4; 1.48.6;
merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 yamt-vop-base2 ktrace-lwp-base
# 1.47 24-Oct-2005 cube

Move prototypes for siginfo32 to/from siginfo converters at the right
place.


Revision tags: thorpej-vnode-attr-base
# 1.46 23-Oct-2005 cube

- Split sys_kevent into kevent1 so that it can be used by COMPAT_NETBSD32
code.

- To achieve COMPAT_NETBSD32 compatibility, introduce a parameter to
kevent1 that points to functions that do the actual copyin/copyout
operations. This is similar to what was done in FreeBSD by Paul Saab.

- Add the COMPAT_NETBSD32 definitions and hooks.


Revision tags: yamt-vop-base
# 1.45 07-Oct-2005 chs

branches: 1.45.2;
make the previous apply only to x86_64.


# 1.44 07-Oct-2005 chs

add __attribute__((packed)) to struct netbsd32_stat13. the alignment of
64-bit values is annoying in the x86 world: they require 64-bit alignment
in 64-bit mode but only 32-bit alignment in 32-bit mode.


# 1.43 27-Sep-2005 chs

this needs stuff from compat/sys/siginfo.h now, just include it here.


# 1.42 27-Sep-2005 chs

make this compile again.


# 1.41 24-Sep-2005 christos

make the siginfo converters static and comment out the one that is not used.


# 1.40 20-Aug-2005 kent

fix a compilation problem on NetBSD/amd64


# 1.39 19-Aug-2005 christos

Fix lossage I created with the 64 bit ino_t change.


# 1.38 19-Aug-2005 christos

64 bit inode changes.


# 1.37 23-Jul-2005 cube

Regen (__sigtimedwait(2)).


# 1.36 23-Jul-2005 cube

Implement the timer_create(2) family of syscalls.


# 1.35 13-Jul-2005 cube

netbsd32_execve2() doesn't exist anymore.


# 1.34 04-Jul-2005 cube

branches: 1.34.2;
Implement uuidgen(2).


# 1.33 10-Jun-2005 matt

Rework the coredump code to have no explicit knownledge of how coredump
i/o is done. Instead, pass an opaque cookie which is then passed to a
new routine, coredump_write, which does the actual i/o. This allows the
method of doing i/o to change without affecting any future MD code.
Also, make netbsd32_core.c [re]use core_netbsd.c (in a similar manner that
core_elf64.c uses core_elf32.c) and eliminate that code duplication.
cpu_coredump{,32} is now called twice, first with a NULL iocookie to fill
the core structure and a second to actually write md parts of the coredump.
All i/o is nolonger random access and is suitable for shipping over a stream.


# 1.32 02-Jun-2005 drochner

in siginfo conversion functions, declare the source operand as "const"


Revision tags: yamt-km-base4 kent-audio2-base
# 1.31 26-Mar-2005 fvdl

Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.


Revision tags: yamt-km-base3 netbsd-3-base
# 1.30 26-Feb-2005 perry

branches: 1.30.2;
nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.29 17-Jun-2004 cube

branches: 1.29.4; 1.29.6;
o Add support for the statvfs family of syscalls (statvfs1, fstatvfs1,
fhstatvfs1 and getvfsstat)
o Move the statfs family out of netbsd32_fs.c and netbsd32_netbsd.c to
netbsd_compat_20.c, compiled with COMPAT_20

Reviewed by christos@.


# 1.28 20-May-2004 atatat

Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).


Revision tags: netbsd-2-0-base
# 1.27 21-Jan-2004 mrg

branches: 1.27.2;
delete ktrsyscall32() prototype


# 1.26 15-Jan-2004 mrg

add a copy of the ktrsyscall() entry point for 32 bit emulated calls.
the main purpose of this function is to adjust the "argsize" value of
the ktrace syscall record, otherwise userland will see N/2 (rounded
down) arguments instead of N.


# 1.25 13-Oct-2003 fvdl

Implement 32bit get/setcontext entry points.


# 1.24 18-Jan-2003 thorpej

branches: 1.24.2;
Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base
# 1.23 27-Nov-2002 atatat

Complete the rename: s/sa_/<compat>_sa_/g

Also tweak the darwin siginfo stuff to avoid the same type of collision.


# 1.22 23-Oct-2002 scw

In preparation for COMPAT_NETBSD32 on SH-5:

- The MD netbsd32_machdep.h header now defines the 32-bit pointer type
instead of using u_int32_t everywhere,
- The MD netbsd32_machdep.h header now defines a macro (at least on
current implementations) which converts a 32-bit pointer to its 64-bit
equivalent,
- Change the MI code to utilise the above two items in all the right places,
- Implement netbsd32___sigaction_sigtramp().

Tested on Sparc64 by Matt Green.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 kqueue-aftermerge kqueue-beforemerge netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base kqueue-base
# 1.21 08-Dec-2001 thorpej

Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).


Revision tags: thorpej-mips-cache-base thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base
# 1.20 25-Aug-2001 mrg

update copyright notices.


# 1.19 19-Jun-2001 fvdl

branches: 1.19.2;
Some of this was sparc-specific, so ifdef __sparc__ it (XXX). Also,
change the alignment of one structure with an MD ifdef. Should
be moved into the netbsd32_machdep parts.


# 1.18 06-Jun-2001 mrg

proto for coredump32


Revision tags: thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 04-Feb-2001 mrg

branches: 1.17.2;
make sysctl vm.loadavg work.


# 1.16 02-Feb-2001 mrg

de-static netbsd32_exec_aout_prep_[zno]magic().
de-static netbsd32_from_stat43().
move the guts of netbsd32_execve() into netbsd32_execve2().

all of are for the forthcoming sunos32 compat mode (for sparc64).


# 1.15 03-Dec-2000 fvdl

Add systm.h to pull in copyout* prototypes.


# 1.14 01-Dec-2000 jdolecek

add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now


# 1.13 18-Nov-2000 mrg

kill gcc warnings.


# 1.12 22-Aug-2000 mrg

declare struct firm_event32


# 1.11 09-Jul-2000 mrg

- massive warning fix fest.
- fix pread/pwrite return values (plus some other syscalls that looked
similarly broken).
- prototypes and clean up for netbsd32_ioctl.c

now getpw*() works under compat32!


Revision tags: netbsd-1-5-ALPHA2 netbsd-1-5-base minoura-xpg4dl-base chs-ubc2-newbase
# 1.10 30-Dec-1999 eeh

branches: 1.10.4;
Update to 32-bit compatibility routines.


Revision tags: wrstuden-devbsize-19991221 wrstuden-devbsize-base comdex-fall-1999-base fvdl-softdep-base
# 1.9 11-Oct-1999 eeh

branches: 1.9.2;
Add netbsd32_compat_14.c

Rename everything from compat_netbsd32 -> netbsd32 so we don't have silly
names like compat_14_compat_netbsd32_sys_shmctl().


Revision tags: chs-ubc2-base
# 1.8 12-Jul-1999 kleink

branches: 1.8.2;
XSH5: change function signature to `void *sbrk(intptr_t)'.


Revision tags: netbsd-1-4-PATCH003 netbsd-1-4-PATCH002 kame_141_19991130 netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 netbsd-1-4-RELEASE netbsd-1-4-base
# 1.7 25-Mar-1999 mrg

branches: 1.7.4;
clean and up make compile


# 1.6 25-Mar-1999 mrg

SPARC32->NETBSD32


# 1.5 25-Mar-1999 mrg

include the MD header.


# 1.4 25-Mar-1999 mrg

move sparc32 to netbsd32; split out MD part (signal handling) (mostly via repository copy, rename and perl -pi :-)


Revision tags: kenh-if-detach-base chs-ubc-base
# 1.3 01-Oct-1998 eeh

Overhaul. Now will run simple things like /bin/sh and /bin/echo.


# 1.2 07-Sep-1998 eeh

Need to make sure high bits of addresses are zeroed out.


# 1.1 26-Aug-1998 mrg

add a 32-bit compatibility module for the sparc64 port, so it can run NetBSD/sparc binaries with a LP64 kernel.