summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include/atomic.h
Commit message (Collapse)AuthorAgeFilesLines
* Cosmetic and/or trivial sync up with i386.peter2003-11-211-4/+10
| | | | Approved by: re (rwatson)
* Initial landing of SMP support for FreeBSD/amd64.peter2003-11-171-1/+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.
* Commit MD parts of a loosely functional AMD64 port. This is based onpeter2003-05-011-67/+29
| | | | | | | | | | | | | | | | | | | | | | 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.
* Add a knob to turn on and off the CMPXCHG instruction on > i386 IA32 systems.pirzyk2002-10-141-1/+1
| | | | | | | This is most beneficial for vmware client os installs. Reviewed by: jmallet, iedowse, tlambert2@mindspring.com MFC After: never, -STABLE does not currently use this instruction
* Beautify. This has the side effect of improving portability andmarkm2002-07-181-39/+31
| | | | | | making lint work cleaner. Inspired to do this by: jhb
* Clean up the syntax WRT semicolons at the end of function-like-macros, and ↵markm2002-07-171-23/+74
| | | | protect GCCisms from non-GNU compilers and lint.
* Make MPLOCKED work again in asm files and stringify it explicitlybmilekic2002-02-281-4/+4
| | | | | | where necessary. Reviewed by: jake
* Garbage-collect the "LOCORE" version of MPLOCKED.bde2002-02-111-10/+2
|
* Allow the ATOMIC_ASM() macro to pass in the constraints on the V parameterjhb2001-12-181-23/+23
| | | | | | | since the char versions need to use either ax, bx, cx, or dx. Submitted by: Peter Jeremy (mostly) Recommended by: bde
* Use newer constraints for atomic_cmpset().jhb2001-11-121-11/+9
| | | | Requested by: bde
* Use newer constraints for inline assembly for an operand that is both anjhb2001-11-121-21/+21
| | | | | | | input and an output by using the '+' modifier rather than listing the operand in both the input and output sections. Reviwed by: bde
* Allow atomic ops to be somewhat safely used in userland. We always usejhb2001-10-081-3/+7
| | | | | lock prefixes in the userland case so that the binaries will work on both SMP and UP systems.
* RIP <machine/lock.h>.markm2001-02-111-4/+9
| | | | | | | Some things needed bits of <i386/include/lock.h> - cy.c now has its own (only) copy of the COM_(UN)LOCK() macros, and IMASK_(UN)LOCK() has been moved to <i386/include/apic.h> (AKA <machine/apic.h>). Reviewed by: jhb
* - Sort of lie and say that %eax is an output only and not an input for thejhb2001-01-171-2/+2
| | | | | | | | | | | non-386 atomic_load_acq(). %eax is an input since its value is used in the cmpxchg instruction, but we don't care what value it is, so setting it to a specific value is just wasteful. Thus, it is being used without being initialized as the warning stated, but it is ok for it to be used because its value isn't important. Thus, we are only sort of lying when we say it is an output only operand. - Add "cc" to the clobber list for atomic_load_acq() since the cmpxchgl changes ZF.
* - Fix atomic_load_* and atomic_store_* to generate functions for atomic.cjhb2001-01-161-168/+123
| | | | | | | | | that modules can call. - Remove the old gcc <= 2.8 versions of the atomic ops. - Resort the order of some things in the file so that there is only one #ifdef for KLD_MODULE, and so that all WANT_FUNCTIONS stuff is moved to the bottom of the file. - Remove ATOMIC_ACQ_REL() and just use explicit macros instead.
* Fix the atomic_load_acq() and atomic_store_rel() functions to properlyjhb2001-01-141-5/+43
| | | | | | implement memory fences for the 486+. The 386 still uses versions w/o memory fences as all operations on the 386 are not program ordered. The 386 versions are not MP safe.
* The x86 atomic operations are already locked, so they do not need anjhb2000-10-281-2/+0
| | | | | | | | additional locked instruction to guarantee a write barrier for the acquire variants. Approved by: dfr Pointy hat to: jhb
* - Add atomic_cmpset_{acq_,rel_,}_longjhb2000-10-251-0/+52
| | | | - Add in atomic operations for 8-bit, 16-bit, and 32-bit integers
* - Expand the set of atomic operations to optionally include memory barriersjhb2000-10-201-2/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | in most of the atomic operations. Now for these operations, you can use the normal atomic operation, you can use the operation with a read barrier, or you can use the operation with a write barrier. The function names follow the same semantics used in the ia64 instruction set. An atomic operation with a read barrier has the extra suffix 'acq', due to it having "acquire" semantics. An atomic operation with a write barrier has the extra suffix 'rel'. These suffixes are inserted between the name of the operation to perform and the typename. For example, the atomic_add_int() function now has 3 variants: - atomic_add_int() - this is the same as the previous function - atomic_add_acq_int() - this function combines the add operation with a read memory barrier - atomic_add_rel_int() - this function combines the add operation with a write memory barrier - Add 'ptr' to the list of types that we can perform atomic operations on. This allows one to do atomic operations on uintptr_t's. This is useful in the mutex code, for example, because the actual mutex lock is a pointer. - Add two new operations for doing loads and stores with memory barriers. The new load operations use a read barrier before the load, and the new store operations use a write barrier after the load. For example, atomic_load_acq_int() will atomically load an integer as well as enforcing a read barrier.
* Add atomic_readandclear_int and atomic_readandclear_long.jhb2000-10-051-2/+34
|
* Introduce atomic_cmpset_int() and atomic_cmpset_long() from SMPng aphk2000-09-061-0/+72
| | | | | | | | | | | few hours earlier than the rest. The next DEVFS commit needs these functions. Alpha versions by: dfr i386 versions by: jakeb Approved by: SMPng
* When using _asm{} in GCC, one must specify the operand's size if oneobrien2000-05-101-9/+9
| | | | | | specifies the instruction's operation size. GCC will default to 32-bit operands reguardless of the prototype (ie, formal parameters' type) of an inline function.
* Use the rev 1.1.2.1 code from RELENG_3 for atomic operations ratherpeter1999-10-041-19/+38
| | | | than the non-atomic C macros.
* Typo: s/__GNUC_MINOR_/__GNUC_MINOR__/peter1999-10-041-1/+1
| | | | (__GNUC_MINOR__ on egcs in -current is "91" and is going to be "95" soon)
* Allow compilation with older versions of GCC, in order to make it possibleeivind1999-10-031-0/+23
| | | | to bootstrap and work with -current from older versions of FreeBSD.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Create callable (non-inline) versions of the atomic_OP_TYPE functionsalc1999-08-181-3/+14
| | | | | | | | | | | | that are linked into the kernel. The KLD compilation options are changed to call these functions, rather than in-lining the atomic operations. This approach makes atomic operations from KLDs significantly faster on UP systems (though somewhat slower on SMP systems). PR: i386/13111 Submitted by: peter.jeremy@alcatel.com.au
* atomic.h:alc1999-07-231-4/+4
| | | | | | | | | | | | | | | | | Change "void *" to "volatile TYPE *", improving type safety and eliminating some warnings (e.g., mp_machdep.c rev 1.106). cpufunc.h: Eliminate setbits. As defined, it's not precisely correct; and it's redundant. (Use atomic_set_int instead.) ipl_funcs.c: Use atomic_set_int instead of setbits. systm.h: Include atomic.h. Reviewed by: bde
* Commit the correct patch, i.e., the one that actually correspondsalc1999-07-131-35/+55
| | | | to the rev 1.2 log entry.
* Changed the implementation of the primitives to guarantee atomicityalc1999-07-131-22/+42
| | | | | | | | | | | | | with respect to interrupts on UP systems. (The upgrade from gcc 2.7.x to egcs 1.1.2 produced at least one non-atomic code sequence in swap_pager_getpages.) In addition, the primitives are now SMP-safe, but only on SMPs. (For portability between SMPs and UPs, modules are compiled with the SMP-safe versions.) Submitted by: dillon and myself Reviewed by: bde
* Change various syscalls to use size_t arguments instead of u_int.dfr1998-08-241-0/+58
Add some overflow checks to read/write (from bde). Change all modifications to vm_page::flags, vm_page::busy, vm_object::flags and vm_object::paging_in_progress to use operations which are not interruptable. Reviewed by: Bruce Evans <bde@zeta.org.au>
OpenPOWER on IntegriCloud