summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_machdep.c
Commit message (Collapse)AuthorAgeFilesLines
* Use the LCONVPATHEXIST() macro rather than it's exact expansion to bejhb2005-02-071-4/+1
| | | | consistent.
* o Split out kernel part of execve(2) syscall into two parts: one thatsobomax2005-01-291-9/+17
| | | | | | | | | | | copies arguments into the kernel space and one that operates completely in the kernel space; o use kernel-only version of execve(2) to kill another stackgap in linuxlator/i386. Obtained from: DragonFlyBSD (partially) MFC after: 2 weeks
* o Move copyin()/copyout() out of i386_{get,set}_ldt() andsobomax2005-01-261-43/+34
| | | | | | | | | i386_{get,set}_ioperm() and make those APIs visible in the kernel namespace; o use i386_{get,set}_ldt() and i386_{get,set}_ioperm() instead of sysarch() in the linuxlator, which allows to kill another two stackgaps. MFC after: 2 weeks
* Add a few stub syscalls to get TransGaming's winex a bit closer todfr2004-09-061-0/+27
| | | | working.
* Give setrunqueue() and sched_add() more of a clue as tojulian2004-09-011-1/+1
| | | | | | where they are coming from and what is expected from them. MFC after: 2 days
* Correct the arguments to kern_sigaltstack() as they were reversed.jhb2004-08-241-2/+2
| | | | | PR: kern/68079 Submitted by: Georg-W. Koltermann gwk at rahn-koltermann dot de
* Locking for the per-process resource limits structure.jhb2004-02-041-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64
* Use __FBSDID().obrien2003-06-021-2/+3
|
* Synchronize the two linux_clone() implementations which includes a fewjhb2003-04-181-22/+22
| | | | minor cleanups in both.
* - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread withjeff2003-03-311-1/+1
| | | | | | | a follow on commit to kern_sig.c - signotify() now operates on a thread since unmasked pending signals are stored in the thread. - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
* Print the return value from mmap() in the DEBUG case.mdodd2003-03-251-3/+11
|
* Including <sys/stdint.h> is (almost?) universally only to be able to usephk2003-03-181-1/+0
| | | | | %j in printfs, so put a newsted include in <sys/systm.h> where the printf prototype lives and save everybody else the trouble.
* Clean up whitespace and remove register keyword.des2003-03-031-5/+5
|
* More caddr_t removal, in conjunction with copy{in,out}(9) this time.des2003-03-031-8/+6
| | | | Also clean up some egregious casts and incorrect use of sizeof.
* Style(9). Make some function declarations consistent with the rest,markm2002-10-191-6/+2
| | | | and remove some nearby extraneous {}'s.
* Fixed syntax errors and printf format errors.bde2002-10-121-3/+5
|
* - Add support for IPC_64 extensions into shmctl(2), semctl(2) and msgctl(2);sobomax2002-10-111-26/+73
| | | | | | | | | | | | | - add wrappers for mmap2(2) and ftruncate64(2) system calls; - don't spam console with printf's when VFAT_READDIR_BOTH ioctl(2) is invoked; - add support for SOUND_MIXER_READ_STEREODEVS ioctl(2); - make msgctl(IPC_STAT) and IPC_SET actually working by converting from BSD msqid_ds to Linux and vice versa; - properly return EINVAL if semget(2) is called with nsems being negative. Reviewed by: marcel Approved by: marcel Tested with: LSB runtime test
* Some kernel threads try to do significant work, and the default KSTACK_PAGESscottl2002-10-021-1/+1
| | | | | | | | | | | | | doesn't give them enough stack to do much before blowing away the pcb. This adds MI and MD code to allow the allocation of an alternate kstack who's size can be speficied when calling kthread_create. Passing the value 0 prevents the alternate kstack from being created. Note that the ia64 MD code is missing for now, and PowerPC was only partially written due to the pmap.c being incomplete there. Though this patch does not modify anything to make use of the alternate kstack, acpi and usb are good candidates. Reviewed by: jake, peter, jhb
* Completely redo thread states.julian2002-09-111-0/+1
| | | | Reviewed by: davidxu@freebsd.org
* Use the new kern_* functions to avoid the need to store argumentsiedowse2002-09-011-43/+21
| | | | | | | | in the stack gap. This converts most VFS and signal related system calls, as well as select(). Discussed on: -arch Approved by: marcel
* Part 1 of KSE-IIIjulian2002-06-291-1/+0
| | | | | | | | | | | | | The ability to schedule multiple threads per process (one one cpu) by making ALL system calls optionally asynchronous. to come: ia64 and power-pc patches, patches for gdb, test program (in tools) Reviewed by: Almost everyone who counts (at various times, peter, jhb, matt, alfred, mini, bernd, and a cast of thousands) NOTE: this is still Beta code, and contains lots of debugging stuff. expect slight instability in signals..
* Change the suser() API to take advantage of td_ucred as well as do ajhb2002-04-011-1/+1
| | | | | | | | | | | | general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@
* Fix format warning.peter2002-02-271-1/+1
| | | | Submitted by: LINT, -Werror
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredjhb2002-02-271-1/+1
| | | | reference.
* Pre-KSE/M3 commit.julian2002-02-071-2/+3
| | | | | | | | | | this is a low-functionality change that changes the kernel to access the main thread of a process via the linked list of threads rather than assuming that it is embedded in the process. It IS still embeded there but remove all teh code that assumes that in preparation for the next commit which will actually move it out. Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
* Oops, these already included sys/lock.h, they just did so afterjhb2001-10-111-1/+0
| | | | sys/mutex.h which is too late.
* Add missing includes of sys/lock.h.jhb2001-10-111-0/+1
|
* o Modify access control checks in linux_iopl() to use securelevel_gt()rwatson2001-09-261-2/+2
| | | | | | | rather than direct variable checks. (Yet another API to perform direct hardware I/O.) Obtained from: TrustedBSD Project
* KSE Milestone 2julian2001-09-121-64/+64
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Round of cleanups and enhancements. These include (in random order):marcel2001-09-081-96/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add a new MI pointer to the process' trapframe p_frame instead of usingjhb2001-06-291-2/+2
| | | | | | various differently named pointers buried under p_md. Reviewed by: jake (in principle)
* Undo part of the tangle of having sys/lock.h and sys/mutex.h included inmarkm2001-05-011-3/+4
| | | | | | | | | | | other "system" header files. Also help the deprecation of lockmgr.h by making it a sub-include of sys/lock.h and removing sys/lockmgr.h form kernel .c files. Sort sys/*.h includes where possible in affected files. OK'ed by: bde (with reservations)
* rfork() masks RFSTOPPED out of the flags it passes to fork1(), so we havedes2001-03-111-7/+3
| | | | | | | to call fork1() directly if we don't want out process queued right away. This has the serendipitous side effect of saving us a call to pfind(). This makes threaded Linux apps (such as Opera) work again.
* Create clone'd linux processes as stopped processes at first and don'tjhb2001-03-061-1/+9
| | | | | actually make them runnable until after the emulator layer has had a chance to perform fixups.
* Linux does not filesystem-sync file-backed writable mmap pages ondillon2001-02-281-0/+2
| | | | | | | | | | | | a regular basis. Adjust our linux emulation to conform. This will cause more dirty pages to be left for the pagedaemon to deal with, but our new low-memory handling code can deal with it. The linux way appears to be a trend, and we may very well make MAP_NOSYNC the default for FreeBSD as well (once we have reasonable sequential write-behind heuristics for random faults). (will be MFC'd prior to 4.3 freeze) Suggested by: Andrew Gallatin
* Allow debugging output to be controlled on a per-syscall granularity.jlemon2001-02-161-29/+39
| | | | | | Also clean up debugging output in a slightly more uniform fashion. The default behavior remains the same (all debugging output is turned on)
* - Proc locking.jhb2001-01-241-1/+6
| | | | - Use NULL instead of 0.
* Don't use p->p_sigstk.ss_flags to keep state of whether themarcel2000-11-301-2/+0
| | | | | | | | | | | | | | | process is on the alternate stack or not. For compatibility with sigstack(2) state is being updated if such is needed. We now determine whether the process is on the alternate stack by looking at its stack pointer. This allows a process to siglongjmp from a signal handler on the alternate stack to the place of the sigsetjmp on the normal stack. When maintaining state, this would have invalidated the state information and causing a subsequent signal to be delivered on the normal stack instead of the alternate stack. PR: 22286
* Revert auto-generation. The Alpha port is broken.marcel2000-11-101-1/+1
| | | | Syncing with it is wrong.
* Make MINSIGSTKSZ machine dependent, and have the sigaltstackmarcel2000-11-091-4/+1
| | | | | | | | | | | | | | | | | | | | | | syscall compare against a variable sv_minsigstksz in struct sysentvec as to properly take the size of the machine- and ABI dependent struct sigframe into account. The SVR4 and iBCS2 modules continue to have a minsigstksz of 8192 to preserve behavior. The real values (if different) are not known at this time. Other ABI modules use the real values. The native MINSIGSTKSZ is now defined as follows: Arch MINSIGSTKSZ ---- ----------- alpha 4096 i386 2048 ia64 12288 Reviewed by: mjacob Suggested by: bde
* Sync with Alpha:marcel2000-11-091-2/+1
| | | | | Do not use sysent.c, proto.h and syscall.h in source tree; use auto-generated versions.
* fix the sigaltstack hack by lowering the stack size to the original valuegallatin2000-10-311-0/+2
| | | | | if the request was for less than MINSIGSTKSZ (in which case we "round up"). discussed with: marcel
* Some linux apps, such as IBM's JDK 1.3, will attempt to mmap threadgallatin2000-10-171-0/+28
| | | | | | | | | | | | | | | | | | stacks near the top of their address space. If their TOS is greater than vm_maxsaddr, vm_map_growstack() will confuse the thread stack with the process stack and deliver a SEGV if they attempt to grow the thread stack past their current stacksize rlimit. To avoid this, adjust vm_maxsaddr upwards to reflect the current stacksize rlimit rather than the maximum possible stacksize. It would be better to adjust the mmap'ed region, but some apps (again, IBM's JDK 1.3) do not check mmap's return value.. This commit (in conjunction with setting MINSIGSTKSZ to 2048 & rebuilding your kernel and modules) will get IBM's JDK 1.3 working with FreeBSD at least well enough to run many of the example applets. Reviewed by: marcel Tested by: sto@stat.duke.edu, many others on freebsd-java@
* This is the first of 3 commits that will get IBM's JDK 1.3 workinggallatin2000-10-131-10/+39
| | | | | | | | | | | | | | | | | | | | | | | with FreeBSD (not including the MINSIGSTKSZ issue, which belongs to Marcel). Due to time constraints, I'm going to space them out over a few days. This fixes two problems with linux_sigaltstack() o ss == 0 is perfectly valid use, so do not fail in this case. o Fix flag handling: - Our SS_DISABLE is 4, linux's is 2, so we need conversion routines. These conversion routines will be needed by linux_rt_sendsig() and linux_rt_sigreturn (forthcoming), so they are not static. - Linux's flag 0 historically meant SS_ONSTACK according to a comment in their linux/kernel/signal.c file. Among other things, this fixes a warning from Sun's JDK 1.3: "Java HotSpot(TM) Client VM warning: cannot uninstall alt signal stack" Reviewed by: marcel Tested by: sto@stat.duke.edu, many others on freebsd-java@
* When sigaltstack is called with a stack size that's not smallermarcel2000-09-061-1/+2
| | | | | | | than LINUX_MINSIGSTKSZ but smaller than MINSIGSTKSZ, cheat and pass MINSIGSTKSZ to the kernel. This is a workaround. Submitted through: nate
* Fix typo in license.marcel2000-08-251-1/+1
|
* Collect the MD syscalls from /sys/compat/linux here. Since thismarcel2000-08-221-0/+634
is a new file, fix most of the style bugs at the same time.
OpenPOWER on IntegriCloud