summaryrefslogtreecommitdiffstats
path: root/sys/amd64/ia32
Commit message (Collapse)AuthorAgeFilesLines
* Change some movl's to mov's. Newer GAS no longer accept 'movl' instructionsobrien2009-01-312-8/+8
| | | | | | for moving between a segment register and a 32-bit memory location. Looked at by: jhb
* - When executing FreeBSD/amd64 binaries from FreeBSD/i386 or Linux/i386kib2008-09-021-0/+1
| | | | | | | | | | | | | | | | | processes, clear PCB_32BIT and PCB_GS32BIT bits [1]. - Reread the fs and gs bases from the msr unconditionally, not believing the values in pcb_fsbase and pcb_gsbase, since usermode may reload segment registers, invalidating the cache. [2]. Both problems resulted in the wrong fs base, causing wrong tls pointer be dereferenced in the usermode. Reported and tested by: Vyacheslav Bocharov <adeepv at gmail com> [1] Reported by: Bernd Walter <ticsoat cicely7 cicely de>, Artem Belevich <fbsdlist at src cx>[2] Reviewed by: peter MFC after: 3 days
* Bring back the save/restore of the %ds, %es, %fs and %gs registers forkib2008-07-301-1/+1
| | | | | | | | | | | | | | | the 32bit images on amd64. Change the semantic of the PCB_32BIT pcb flag to request the context switch code to operate on the segment registers. Its previous meaning of saving or restoring the %gs base offset is assigned to the new PCB_GS32BIT flag. FreeBSD 32bit image activator sets the PCB_32BIT flag, while Linux 32bit emulation sets PCB_32BIT | PCB_GS32BIT. Reviewed by: peter MFC after: 2 weeks
* Protect the setting of the fsbase/gsbase MSR registers and thepeter2008-03-231-0/+2
| | | | pcb_[fg]sbase values with a critical section, like the rest of the kernel.
* Since version 4.3, gcc changed its behaviour concerning the i386/amd64kib2008-03-131-2/+2
| | | | | | | | | | | | | | | | | | ABI and the direction flag, that is it now assumes that the direction flag is cleared at the entry of a function and it doesn't clear once more if needed. This new behaviour conforms to the i386/amd64 ABI. Modify the signal handler frame setup code to clear the DF {e,r}flags bit on the amd64/i386 for the signal handlers. jhb@ noted that it might break old apps if they assumed DF == 1 would be preserved in the signal handlers, but that such apps should be rare and that older versions of gcc would not generate such apps. Submitted by: Aurelien Jarno <aurelien aurel32 net> PR: 121422 Reviewed by: jhb MFC after: 2 weeks
* Optimize vmmeter locking.attilio2007-06-101-5/+0
| | | | | | | | | | In particular: - Add an explicative table for locking of struct vmmeter members - Apply new rules for some of those members - Remove some unuseful comments Heavily reviewed by: alc, bde, jeff Approved by: jeff (mentor)
* Rework the PCPU_* (MD) interface:attilio2007-06-041-2/+2
| | | | | | | | | | | | - Rename PCPU_LAZY_INC into PCPU_INC - Add the PCPU_ADD interface which just does an add on the pcpu member given a specific value. Note that for most architectures PCPU_INC and PCPU_ADD are not safe. This is a point that needs some discussions/work in the next days. Reviewed by: alc, bde Approved by: jeff (mentor)
* Newer versions of gcc don't support treating structures passed by valuekmacy2006-12-172-17/+18
| | | | | | | | | | as if they were really passed by reference. Specifically, the dead stores elimination pass in the GCC 4.1 optimiser breaks the non-compliant behavior on which FreeBSD relied. This change brings FreeBSD up to date by switching trap frames to being explicitly passed by reference. Reviewed by: kan Tested by: kan
* Move some declaration of 32-bit signal structures into filedavidxu2006-10-051-21/+5
| | | | freebsd32-signal.h, implement sigtimedwait and sigwaitinfo system calls.
* Stop reloading %fs and %gs, since it causes the base address fromdavidxu2006-09-231-4/+0
| | | | | | | | GDT to be loaded into FS.base and GS.base, these values of course are not the values set by sysarch() with I386_SET_FSBASE and I386_SET_GSBASE, the change fixed a crash for 32bit libthr after signal handler returned and normal code is accessing thread pointer, for example: movl %gs:8, %eax.
* Retire SYF_ARGMASK and remove both SYF_MPSAFE and SYF_ARGMASK. sy_narg isjhb2006-07-281-1/+1
| | | | now back to just being an argument count.
* Now that all system calls are MPSAFE, retire the SYF_MPSAFE flag used tojhb2006-07-281-13/+0
| | | | | | | | | mark system calls as being MPSAFE: - Stop conditionally acquiring Giant around system call invocations. - Remove all of the 'M' prefixes from the master system call files. - Remove support for the 'M' prefix from the script that generates the syscall-related files from the master system call files. - Don't explicitly set SYF_MPSAFE when registering nfssvc.
* Unify the checking for lock misbehavior in the various syscall()jhb2006-07-271-5/+13
| | | | | | | | | | | | | | implementations and adjust some of the checks while I'm here: - Add a new check to make sure we don't return from a syscall in a critical section. - Add a new explicit check before userret() to make sure we don't return with any locks held. The advantage here is that we can include the syscall number and name in syscall() whereas that info is not available in userret(). - Drop the mtx_assert()'s of sched_lock and Giant. They are replaced by the more general checks just added. MFC after: 2 weeks
* Add KTR_SYSC tracing to the syscall() implementations that didn't have itjhb2006-07-271-0/+5
| | | | | | yet. MFC after: 1 week
* Add missing ptrace(2) system-call stops to various syscall()jhb2006-07-271-0/+5
| | | | | | implementations. MFC after: 1 week
* Simplify system time accounting for profiling.phk2006-02-081-3/+2
| | | | | | | | | | Rename struct thread's td_sticks to td_pticks, we will need the other name for more appropriately named use shortly. Reduce it from uint64_t to u_int. Clear td_pticks whenever we enter the kernel instead of recording its value as reference for userret(). Use the absolute value of td->pticks in userret() and eliminate third argument.
* Call the audit syscall enter/exit functions for the amd64 architecture,wsalamon2006-02-041-0/+3
| | | | | | | both 32-bit and 64-bit paths. System calls will now be audited. Obtained from: TrustedBSD Project Approved by: rwatson (mentor)
* Catch up to the system siginfo changes. Use a union for the ia32 layoutpeter2005-12-061-1/+3
| | | | | of siginfo just like the system one. There are now two fields to copy instead of one.
* Catch up with the recent <sys/signal.h> change and make this compile.ru2005-11-041-1/+1
|
* include opt_compat.h to unbreak the buildps2005-10-241-0/+2
|
* 1. Change prototype of trapsignal and sendsig to use ksiginfo_t *, mostdavidxu2005-10-142-15/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | changes in MD code are trivial, before this change, trapsignal and sendsig use discrete parameters, now they uses member fields of ksiginfo_t structure. For sendsig, this change allows us to pass POSIX realtime signal value to user code. 2. Remove cpu_thread_siginfo, it is no longer needed because we now always generate ksiginfo_t data and feed it to libpthread. 3. Add p_sigqueue to proc structure to hold shared signals which were blocked by all threads in the proc. 4. Add td_sigqueue to thread structure to hold all signals delivered to thread. 5. i386 and amd64 now return POSIX standard si_code, other arches will be fixed. 6. In this sigqueue implementation, pending signal set is kept as before, an extra siginfo list holds additional siginfo_t data for signals. kernel code uses psignal() still behavior as before, it won't be failed even under memory pressure, only exception is when deleting a signal, we should call sigqueue_delete to remove signal from sigqueue but not SIGDELSET. Current there is no kernel code will deliver a signal with additional data, so kernel should be as stable as before, a ksiginfo can carry more information, for example, allow signal to be delivered but throw away siginfo data if memory is not enough. SIGKILL and SIGSTOP have fast path in sigqueue_add, because they can not be caught or masked. The sigqueue() syscall allows user code to queue a signal to target process, if resource is unavailable, EAGAIN will be returned as specification said. Just before thread exits, signal queue memory will be freed by sigqueue_flush. Current, all signals are allowed to be queued, not only realtime signals. Earlier patch reviewed by: jhb, deischen Tested on: i386, amd64
* Don't set segment registers via ptrace yet. Its not ready.peter2005-10-041-0/+4
|
* Implement 32 bit getcontext/setcontext/swapcontext on amd64. I've addedpeter2005-09-271-40/+165
| | | | | stubs for ia64 to keep it compiling. These are used by 32 bit apps such as gdb.
* Jumbo-commit to enhance 32 bit application support on 64 bit kernels.peter2005-06-301-0/+224
| | | | | | | | | | | | | | | | | | | | | | | | This is good enough to be able to run a RELENG_4 gdb binary against a RELENG_4 application, along with various other tools (eg: 4.x gcore). We use this at work. ia32_reg.[ch]: handle the 32 bit register file format, used by ptrace, procfs and core dumps. procfs_*regs.c: vary the format of proc/XXX/*regs depending on the client and target application. procfs_map.c: Don't print a 64 bit value to 32 bit consumers, or their sscanf fails. They expect an unsigned long. imgact_elf.c: produce a valid 32 bit coredump for 32 bit apps. sys_process.c: handle 32 bit consumers debugging 32 bit targets. Note that 64 bit consumers can still debug 32 bit targets. IA64 has got stubs for ia32_reg.c. Known limitations: a 5.x/6.x gdb uses get/setcontext(), which isn't implemented in the 32/64 wrapper yet. We also make a tiny patch to gdb pacify it over conflicting formats of ld-elf.so.1. Approved by: re
* Use PCPU_LAZY_INC() for cnt.v_{intr,trap,syscalls} rather than atomicjhb2005-04-121-1/+1
| | | | operations in some places and simple non-per CPU math in others.
* Remove sched_free_thread() which was only usedjulian2004-08-311-3/+0
| | | | | | | | in diagnostics. It has outlived its usefulness and has started causing panics for people who turn on DIAGNOSTIC, in what is otherwise good code. MFC after: 2 days
* Don't repeat the definition of IDTVEC(). It is in asmacros.h.bde2004-05-241-3/+0
|
* Added profiling support for Xint0x80_syscall.bde2004-05-231-0/+2
|
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999 and email from Peter Wemm. Approved by: core, peter
* Catch up with some proc/procsig locking improvements that were made to thepeter2004-02-211-6/+2
| | | | i386 version and were not merged over.
* Make sigaltstack as per-threaded, because per-process sigaltstack statedavidxu2004-01-031-12/+12
| | | | | | | | | | | | | is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Reviewed by: deischen, dfr
* Catch up with the procsig locking changes elsewhere. We were doingpeter2003-12-031-0/+6
| | | | | | things like copyin/out with psp->ps_mtx held. That was not good. Approved by: re (scottl)
* Initial landing of SMP support for FreeBSD/amd64.peter2003-11-171-3/+1
| | | | | | | | | | | | | | | | - This is heavily derived from John Baldwin's apic/pci cleanup on i386. - I have completely rewritten or drastically cleaned up some other parts. (in particular, bootstrap) - This is still a WIP. It seems that there are some highly bogus bioses on nVidia nForce3-150 boards. I can't stress how broken these boards are. I have a workaround in mind, but right now the Asus SK8N is broken. The Gigabyte K8NPro (nVidia based) is also mind-numbingly hosed. - Most of my testing has been with SCHED_ULE. SCHED_4BSD works. - the apic and acpi components are 'standard'. - If you have an nVidia nForce3-150 board, you are stuck with 'device atpic' in addition, because they somehow managed to forget to connect the 8254 timer to the apic, even though its in the same silicon! ARGH! This directly violates the ACPI spec.
* Stop pretending to support kernel profiling. The FAKE_MCOUNT() etcpeter2003-11-131-2/+0
| | | | | calls are just gradually getting more and more stale. At this point it would be better to start from scratch once prof_machdep.c is adapted.
* Move a MD 32 bit binary support routine into the MD areas. exec_setregspeter2003-11-081-0/+41
| | | | | | | is highly MD in an emulation environment since it operates on the host environment. Although the setregs functions are really for exec support rather than signals, they deal with the same sorts of context and include files. So I put it there rather than create yet another file.
* The great s/npx/fpu/gipeter2003-11-081-5/+5
|
* MFi386 by jhb: use symbolic constants for the IDT entries.peter2003-09-221-2/+2
|
* Switch to using the emulator in the common compat area.peter2003-08-2315-4269/+15
| | | | Still work-in-progress.
* Initial sweep at dividing up the generic 32bit-on-64bit kernel supportpeter2003-08-221-0/+1
| | | | | | from the ia32 specific stuff. Some of this still needs to move to the MI freebsd32 area, and some needs to move to the MD area. This is still work-in-progress.
* Regenpeter2003-08-214-14/+14
|
* This is too funny for words. Swap syscalls 416 and 417 around. It workspeter2003-08-211-2/+2
| | | | better that way when sigaction() and sigreturn() do the right thing.
* Use __FBSDID().obrien2003-07-255-9/+14
| | | | Brought to you by: a boring talk at Ottawa Linux Symposium
* Regenerate.peter2003-05-311-0/+447
|
* Make this compile with WITNESS enabled. It wants the syscall names.peter2003-05-313-3/+5
|
* Deal with the user VM space expanding. 32 bit applications do not likepeter2003-05-233-8/+8
| | | | | | | | | having their stack at the 512GB mark. Give 4GB of user VM space for 32 bit apps. Note that this is significantly more than on i386 which gives only about 2.9GB of user VM to a process (1GB for kernel, plus page table pages which eat user VM space). Approved by: re (blanket)
* Collect the nastiness for preserving the kernel MSR_GSBASE around thepeter2003-05-151-8/+1
| | | | | | | | | | load_gs() calls into a single place that is less likely to go wrong. Eliminate the per-process context switching of MSR_GSBASE, because it should be constant for a single cpu. Instead, save/restore it during the loading of the new %gs selector for the new process. Approved by: re (amd64/* blanket)
* Regenpeter2003-05-143-18/+43
| | | | Approved by: re (amd64 blanket)
* Add BASIC i386 binary support for the amd64 kernel. This is largelypeter2003-05-1410-163/+1374
| | | | | | | | | | | | | | | | | | | | | | stolen from the ia64/ia32 code (indeed there was a repocopy), but I've redone the MD parts and added and fixed a few essential syscalls. It is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic) and p4. The ia64 code has not implemented signal delivery, so I had to do that. Before you say it, yes, this does need to go in a common place. But we're in a freeze at the moment and I didn't want to risk breaking ia64. I will sort this out after the freeze so that the common code is in a common place. On the AMD64 side, this required adding segment selector context switch support and some other support infrastructure. The %fs/%gs etc code is hairy because loading %gs will clobber the kernel's current MSR_GSBASE setting. The segment selectors are not used by the kernel, so they're only changed at context switch time or when changing modes. This still needs to be optimized. Approved by: re (amd64/* blanket)
* Regen.jhb2003-04-253-34/+3
|
* Oops, the thr_* and jail_attach() syscall entries should be NOPROTO ratherjhb2003-04-251-7/+7
| | | | than STD.
OpenPOWER on IntegriCloud