History log of /freebsd-current/sys/i386/linux/linux_genassym.c
Revision Date Author Comments
# ce8e645a 18-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Follow style(9), include sys/systm.h after sys/param.h


# 3460fab5 18-Aug-2023 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Remove sys/cdefs.h inclusion where it's not needed due to 685dc743


# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

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

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 8f9635dc 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Retire handmade DWARF annotations from signal trampolines

The Linux exports __kernel_sigreturn and __kernel_rt_sigreturn from the
vdso. Modern glibc's sigaction sets the sa_restorer field of sigaction
to the corresponding vdso __sigreturn, and sets the SA_RESTORER.
Our signal trampolines uses the FreeBSD-way to call a signal handler,
so does not use the sigaction's sa_restorer.

However, as glibc's runtime linker depends on the existment of the vdso
__sigreturn symbols, for all Linuxulators was added separate trampolines
named __sigcode with DWARF anotations and left separate __sigreturn
methods, which are exported.

MFC after: 2 weeks


# 6e826d27 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Better naming for ucontext field of struct rt_sigframe

To reduce sendsig code difference and to avoid confusing me,
rename sf_sc to sf_uc to match the content.

MFC after: 2 weeks


# 21f24617 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Move sigframe definitions to separate headers

The signal trampoine-related definitions are used only in the MD part
of code, wherefore moved from everywhere used linux.h to separate MD
headers.

MFC after: 2 weeks


# ba279bcd 15-May-2022 Dmitry Chagin <dchagin@FreeBSD.org>

linux(4): Cleanup signal trampolines

This is the first stage of a signal trampolines refactoring.

From trampolines retired emulation of the 'call' instruction, which is
replaced by direct call of a signal handler. The signal handler address
is in the register.

The previous trampoline implemenatation used semi-Linux-way to call
a signal handler via the 'jmp' instruction. Wherefore the trampoline
emulated a 'call' instruction to into the stack the return address for
signal handler's 'ret' instruction. Wherefore handmade DWARD annotations
was used.

While here rephrased and removed excessive comments.

MFC after: 2 weeks


# bdc37934 24-May-2015 Dmitry Chagin <dchagin@FreeBSD.org>

Implement vdso - virtual dynamic shared object. Through vdso Linux
exposes functions from kernel with proper DWARF CFI information so that
it becomes easier to unwind through them.
Using vdso is a mandatory for a thread cancelation && cleanup
on a modern glibc.

Differential Revision: https://reviews.freebsd.org/D1060


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

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


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

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


# 9dee707c 07-Sep-2008 Konstantin Belousov <kib@FreeBSD.org>

Segment registers are stored in the uc_mcontext member of the struct
l_ucontext. To restore the registers content, trampoline needs to
dereference uc_mcontext instead of taking some undefined values from
l_ucontext.

Submitted by: Dmitry Chagin <dchagin@>
MFC after: 1 week


# 27e0099c 02-Jun-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().


# 4db068aa 04-Sep-2002 Bruce Evans <bde@FreeBSD.org>

Include <sys/systm.h> for the definition of offsetof() instead of depending
on the definition being misplaced in <sys/types.h>. The definition probably
belongs in <sys/stddef.h>.


# 5002a60f 08-Sep-2001 Marcel Moolenaar <marcel@FreeBSD.org>

Round of cleanups and enhancements. These include (in random order):

o Introduce private types for use in linux syscalls for two reasons:
1. establish type independence for ease in porting and,
2. provide a visual queue as to which syscalls have proper
prototypes to further cleanup the i386/alpha split.
Linuxulator types are prefixed by 'l_'. void and char have not
been "virtualized".

o Provide dummy functions for all syscalls and remove dummy functions
or implementations of truely obsolete syscalls.

o Sanitize the shm*, sem* and msg* syscalls.

o Make a first attempt to implement the linux_sysctl syscall. At this
time it only returns one MIB (KERN_VERSION), but most importantly,
it tells us when we need to add additional sysctls :-)

o Bump the kenel version up to 2.4.2 (this is not the same as the
KERN_VERSION MIB, BTW).

o Implement new syscalls, of which most are specific to i386. Our
syscall table is now up to date with Linux 2.4.2. Some highlights:
- Implement the 32-bit uid_t and gid_t bases syscalls.
- Implement a couple of 64-bit file size/offset bases syscalls.

o Fix or improve numerous syscalls and prototypes.

o Reduce style(9) violations while I'm here. Especially indentation
inconsistencies within the same file are addressed. Re-indenting
did not obfuscate actual changes to the extend that it could not
be combined.

NOTE: I spend some time testing these changes and found that if there
were regressions, they were not caused by these changes AFAICT.
It was observed that installing a RH 7.1 runtime environment
did make matters worse. Hangs and/or reboots have been observed
with and without these changes, so when it failed to make life
better in cases it doesn't look like it made it worse.


# da936bf8 29-Oct-2000 Poul-Henning Kamp <phk@FreeBSD.org>

Remove unneeded <stddef.h> #includes.


# 79363394 16-Oct-2000 Andrew Gallatin <gallatin@FreeBSD.org>

A start at an implemention of linux_rt_sendsig & linux_rt_sigreturn
and associated user-level signal trampoline glue.

Without this patch, an SA_SIGINFO style handler can be installed by a linux
app, but if the handler accesses its sip argument, it will get a garbage
pointer and likely segfault.

We currently supply a valid pointer, but its contents are mainly
garbage. Filling this in properly is future work.

This is the second of 3 commits that will get IBM's JDK 1.3 working with
FreeBSD ...


# 7eed7188 08-Jan-2000 Bruce Evans <bde@FreeBSD.org>

Include <stddef.h> here so that <sys/assym.h> can be unpolluted.

Include <sys/param.h> before <sys/assym.h> in case any of the magic
in the former is ever needed in the latter.


# e8c295ab 03-Jan-2000 Marcel Moolenaar <marcel@FreeBSD.org>

Make offsetof equivalent with <stddef.h>. This paves the way for
further enhancements/reorganisations.

Discussed with: bde


# 00d6d49a 23-Dec-1999 Marcel Moolenaar <marcel@FreeBSD.org>

Use genassym(1) and <sys/assym.h> to generate assembler symbols.


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

$Id$ -> $FreeBSD$


# 5206bca1 27-Apr-1999 Luoqi Chen <luoqi@FreeBSD.org>

Enable vmspace sharing on SMP. Major changes are,
- %fs register is added to trapframe and saved/restored upon kernel entry/exit.
- Per-cpu pages are no longer mapped at the same virtual address.
- Each cpu now has a separate gdt selector table. A new segment selector
is added to point to per-cpu pages, per-cpu global variables are now
accessed through this new selector (%fs). The selectors in gdt table are
rearranged for cache line optimization.
- fask_vfork is now on as default for both UP and SMP.
- Some aio code cleanup.

Reviewed by: Alan Cox <alc@cs.rice.edu>
John Dyson <dyson@iquest.net>
Julian Elischer <julian@whistel.com>
Bruce Evans <bde@zeta.org.au>
David Greenman <dg@root.com>


# e33e271f 29-Jul-1998 Bruce Evans <bde@FreeBSD.org>

Fixed printf format errors.

Use offsetof() instead of null pointer hacks. Use a home made offsetof()
because including <stddef.h> is not permitted in LKMs.


# 2625bd34 01-Feb-1998 Bruce Evans <bde@FreeBSD.org>

Declare printf() instead of including <stdio.h>, so that this doesn't
depend on anything outside of the "sys" tree.


# f9a4e5c5 25-Aug-1997 Bruce Evans <bde@FreeBSD.org>

Minor formatting and style fixes.


# 293a9e51 20-Jul-1997 Bruce Evans <bde@FreeBSD.org>

Removed unused #includes.


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

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


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

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

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

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


# a1ebcbfb 02-Mar-1996 Peter Wemm <peter@FreeBSD.org>

Minor touch-up... make two functions static, and add missing $Id$


# d66a5066 02-Mar-1996 Peter Wemm <peter@FreeBSD.org>

Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)

I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.

The main changes:

COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".

A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.

linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.

Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.

The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.

Supporting changes elsewhere in the kernel:

The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.

The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.

makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)

At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.