summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/segments.h
Commit message (Collapse)AuthorAgeFilesLines
* Move userland bits (and some common kernel bits) from amd64 and i386tijl2012-03-191-150/+1
| | | | | | | segments.h to a new x86 segments.h. Add __packed attribute to some structs (just to be sure). Also make it clear that i386 GDT and LDT entries are used in ia64 code.
* Resort the IDT_DTRACE_RET constant after it was changed to be less thanjhb2012-02-271-1/+1
| | | | IDT_SYSCALL.
* Fix the DTrace pid return trap interrupt vector. Previously we were usingrstone2011-11-071-1/+1
| | | | | | | | | | 31, but that vector is reserved. Without this fix, running dtrace -p <pid> would either cause the target process to crash or the kernel to page fault. Obtained from: rpaulo MFC after: 3days
* Register an interrupt vector for DTrace return probes. There is somerpaulo2010-08-281-0/+1
| | | | | | | code missing in lapic to make sure that we don't overwrite this entry, but this will be done on a sequent commit. Sponsored by: The FreeBSD Foundation
* Fix style issues with the previous commit, namelyrpaulo2010-07-071-6/+6
| | | | | | use-tab-instead-of-space and don't use underscores in macro variables. Pointed out by: bde
* Introduce USD_{SET,GET}{BASE,LIMIT}. These help setting up the userrpaulo2010-07-061-0/+7
| | | | | | segment descriptor hi and lo values. Idea from Solaris. Reviewed by: kib
* Save and restore segment registers on amd64 when entering and leavingkib2009-04-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the kernel on amd64. Fill and read segment registers for mcontext and signals. Handle traps caused by restoration of the invalidated selectors. Implement user-mode creation and manipulation of the process-specific LDT descriptors for amd64, see sysarch(2). Implement support for TSS i/o port access permission bitmap for amd64. Context-switch LDT and TSS. Do not save and restore segment registers on the context switch, that is handled by kernel enter/leave trampolines now. Remove segment restore code from the signal trampolines for freebsd/amd64, freebsd/ia32 and linux/i386 for the same reason. Implement amd64-specific compat shims for sysarch. Linuxolator (temporary ?) switched to use gsbase for thread_area pointer. TODO: Currently, gdb is not adapted to show segment registers from struct reg. Also, no machine-depended ptrace command is added to set segment registers for debugged process. In collaboration with: pho Discussed with: peter Reviewed by: jhb Linuxolator tested by: dchagin
* Add separate gdt descriptors for %fs and %gs on amd64.kib2009-04-011-9/+13
| | | | | | | | Reorder amd64 gdt descriptors so that user-accessible selectors are the same as on i386. At least Wine hard-codes this into the binary. In collaboration with: pho Reviewed by: jhb
* Provide convenient definition of the union descriptor, similar to thekib2009-04-011-0/+17
| | | | | | | i386 one. Fully enumerate system segments and gate types. In collaboration with: pho Reviewed by: jhb
* Fix inconsistencies in the comments.kib2008-09-081-1/+1
| | | | MFC after: 1 week
* MFP4: Linux set_thread_area syscall (aka TLS) support for amd64.jkim2007-03-301-2/+3
| | | | | | Initial version was submitted by Divacky Roman and mostly rewritten by me. Tested by: emulation
* Remove advertising clause from University of California Regent's license,imp2004-04-051-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core
* Initial landing of SMP support for FreeBSD/amd64.peter2003-11-171-0/+3
| | | | | | | | | | | | | | | | - 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.
* MFi386 by jhb: use symbolic constants for the IDT entries.peter2003-09-221-0/+24
|
* Add BASIC i386 binary support for the amd64 kernel. This is largelypeter2003-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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)
* Commit MD parts of a loosely functional AMD64 port. This is based onpeter2003-05-011-108/+75
| | | | | | | | | | | | | | | | | | | | | | a heavily stripped down FreeBSD/i386 (brutally stripped down actually) to attempt to get a stable base to start from. There is a lot missing still. Worth noting: - The kernel runs at 1GB in order to cheat with the pmap code. pmap uses a variation of the PAE code in order to avoid having to worry about 4 levels of page tables yet. - It boots in 64 bit "long mode" with a tiny trampoline embedded in the i386 loader. This simplifies locore.s greatly. - There are still quite a few fragments of i386-specific code that have not been translated yet, and some that I cheated and wrote dumb C versions of (bcopy etc). - It has both int 0x80 for syscalls (but using registers for argument passing, as is native on the amd64 ABI), and the 'syscall' instruction for syscalls. int 0x80 preserves all registers, 'syscall' does not. - I have tried to minimize looking at the NetBSD code, except in a couple of places (eg: to find which register they use to replace the trashed %rcx register in the syscall instruction). As a result, there is not a lot of similarity. I did look at NetBSD a few times while debugging to get some ideas about what I might have done wrong in my first attempt.
* Remove BDE_DEBUGGER.jake2003-01-281-4/+0
| | | | Discussed with: bde
* ISMEMSDP(), IS286GDP(), IS386GDP(), ISGDP(), ISSDP() and ISSYSSDP() arepeter2002-09-261-20/+0
| | | | not used anywhere anymore.
* use __packed, rather than __attribute__((packed)).peter2002-09-231-4/+3
|
* Create inlines for ltr(sel), lldt(sel), lidt(addr) rather thanpeter2002-09-221-2/+0
| | | | functions that have one instruction.
* Fixed some style bugs in the removal of __P(()). The main ones werebde2002-03-231-7/+7
| | | | | | not removing tabs before "__P((", and not outdenting continuation lines to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting and/or rewrap the whole prototype in some cases.
* Remove __P.alfred2002-03-201-7/+7
|
* Add a missing open paren to a macro that's been broken (and apparentlyjhb2001-12-041-1/+1
| | | | | | unused) since rev 1.1 so it is at least correct. Submitted by: Maxime Henrion <mux@qualys.com>
* Declare or #define per-cpu globals in <machine/globals.h> in all cases.bde2000-10-271-2/+0
| | | | The i386 UP case was messily different.
* currentldt is now a "special" global-data variable, and as such, therejhb2000-10-061-3/+0
| | | | | is no actual currentldt integer variable directly. Thus, don't claim that there is.
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-2/+2
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Mindbogglingly, many BIOS vendors expect to be able to load %ds withmsmith1999-08-171-8/+9
| | | | | | | | | | 0x40 and then access data stored in real-mode segment 0x40, even when called in protected mode. Microsoft unfortunately coddle these individuals, and so must we if we want to run their code. This change works around GPFs in some APM and PnP BIOS implementations. Obtained from: Linux
* Major update to the kernel's BIOS-calling ability.msmith1999-07-291-5/+7
| | | | | | | | | - Add support for calling 32-bit code in other segments - Add support for calling 16-bit protected mode code Update APM to use this facility. Submitted by: jlemon
* Changed the global `idt' from an array to a pointer so that npx.cbde1999-06-181-2/+2
| | | | | | | | | | | | | automatically hacks on the active copy of the IDT if f00f_hack() has changed it. This also allows simplifications in setidt(). This fixes breakage of FP exception handling by rev.1.55 of sys/kernel.h. FP exceptions were sent to npx.c's probe handlers because npx.c "restored" the old handlers to the wrong copy of the IDT. The SYSINIT for f00f_hack() was purposely run quite late to avoid problems like this, but it is bogusly associated with the SYSINIT for proc0 so it was moved with the latter. Problem reported and fix tested by: Martin Cracauer <cracauer@cons.org>
* Enable vmspace sharing on SMP. Major changes are,luoqi1999-04-281-10/+15
| | | | | | | | | | | | | | | | | - %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>
* Sun Bug ID 1251858 (on http://sunsolve1.sun.com) discusses the way thatnewton1999-01-281-2/+3
| | | | | | | | | | | | Sun implemented iBCS2 compatibility on Solaris >= 2.6: The emulator runs in user-mode, patching the LDT so that client programs making syscalls through the old iBCS2 call gate get handled by the emulator process. Unemulated syscalls therefore need their own call-gate that bypasses the emulator. Sun chose LDT entry 4 to implement this, which is what we've been using as LUDATA_SEL, so we need to change LUDATA_SEL if we want to run Solaris executables. Discussed with: Mike Smith
* Revert my previous commit about using CS_SECURE macro.charnier1997-08-211-3/+1
| | | | Requested by: Bruce.
* Use CS_SECURE macro.charnier1997-08-181-1/+3
| | | | Reviewed by: John Dyson
* Increased NIDT to 256 for case of SMP or APIC_IO.fsmp1997-07-191-1/+5
|
* Man the liferafts! Here comes the long awaited SMP -> -current merge!peter1997-04-261-2/+2
| | | | | | | | | | | | | | | | There are various options documented in i386/conf/LINT, there is more to come over the next few days. The kernel should run pretty much "as before" without the options to activate SMP mode. There are a handful of known "loose ends" that need to be fixed, but have been put off since the SMP kernel is in a moderately good condition at the moment. This commit is the result of the tinkering and testing over the last 14 months by many people. A special thanks to Steve Passe for implementing the APIC code!
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | 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.
* Apparently, BSDI have a new system call gate. I was experimentingpeter1996-09-271-2/+3
| | | | | | with this quite a while ago when somebody reported a BSD/OS 2.1 binary that wouldn't run. I'm pretty sure they tried it and I'm pretty sure they mentioned to me that the patch worked.
* Fix a bunch of spelling errors in the comment fields ofmpp1996-01-301-3/+3
| | | | a bunch of system include files.
* Remove trailing whitespace.rgrimes1995-05-301-4/+4
|
* First attempt to run linux binaries. This is only the changes needed tosos1995-02-141-2/+2
| | | | | | the generic kernel. The actual emulator is a separate LKM. (not finished yet, sorry). Submitted by: sos@freebsd.org & sef@kithrup.com
* Make gdt_segs[] public again for APM.bde1994-11-151-2/+6
| | | | | Make ldt[] public again and restore currentldt and _default_ldt for USER_LDT.
* Remove 1.5+K of bloat for unused idt entries.bde1994-11-141-13/+20
| | | | | | | | | | | | | Partly support BDE_DEBUGGER. Still broken by conflict with APM. Does nothing if BDE_DEBUGGER is not defined. Clean up prototypes and data declarations. Declare most of the segment functions that are implemented in support.s. Make data private in machdep.c if possible. Parenthesize expressions in macros properly! ${Uniformize idempotency ifdef}.
* Laptop Advanced Power Management support by HOSOKAWA Tatsumi.dg1994-10-011-2/+6
| | | | Submitted by: HOSOKAWA Tatsumi
* WINE/user LDT support from John Brezak, ported to FreeBSD by Jeffrey Hsudg1994-01-311-4/+38
| | | | <hsu@soda.berkeley.edu>.
* Made all header files idempotent and moved incorrect common data fromwollman1993-11-071-1/+5
| | | | | headers into a related source file. Added cons.h as first step towards moving i386/i386/cons.h to machine/cons.h where it belongs.
* Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, somergrimes1993-10-161-1/+2
| | | | minor cleanup. Added $Id$ to files that did not have any version info, etc
* Initial import, 0.1 + pk 0.2.4-B1rgrimes1993-06-121-0/+196
OpenPOWER on IntegriCloud