arch/x86/lib/atomic64_386_32.S

Source file repositories/reference/linux-study-clean/arch/x86/lib/atomic64_386_32.S

File Facts

System
Linux kernel
Corpus path
arch/x86/lib/atomic64_386_32.S
Extension
.S
Size
2668 bytes
Lines
196
Domain
Architecture Layer
Bucket
arch/x86
Inferred role
Architecture Layer: arch/x86
Status
atlas-only

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

#include <linux/linkage.h>
#include <asm/alternative.h>

/* if you want SMP support, implement these with real spinlocks */
.macro IRQ_SAVE reg
	pushfl
	cli
.endm

.macro IRQ_RESTORE reg
	popfl
.endm

#define BEGIN_IRQ_SAVE(op) \
.macro endp; \
SYM_FUNC_END(atomic64_##op##_386); \
.purgem endp; \
.endm; \
SYM_FUNC_START(atomic64_##op##_386); \
	IRQ_SAVE v;

#define ENDP endp

#define RET_IRQ_RESTORE \
	IRQ_RESTORE v; \
	RET

#define v %ecx
BEGIN_IRQ_SAVE(read)
	movl  (v), %eax
	movl 4(v), %edx
	RET_IRQ_RESTORE
ENDP
#undef v

#define v %esi
BEGIN_IRQ_SAVE(set)
	movl %ebx,  (v)
	movl %ecx, 4(v)
	RET_IRQ_RESTORE
ENDP
#undef v

#define v  %esi
BEGIN_IRQ_SAVE(xchg)
	movl  (v), %eax
	movl 4(v), %edx
	movl %ebx,  (v)
	movl %ecx, 4(v)
	RET_IRQ_RESTORE
ENDP
#undef v

#define v %ecx
BEGIN_IRQ_SAVE(add)
	addl %eax,  (v)
	adcl %edx, 4(v)
	RET_IRQ_RESTORE
ENDP
#undef v

#define v %ecx
BEGIN_IRQ_SAVE(add_return)
	addl  (v), %eax
	adcl 4(v), %edx
	movl %eax,  (v)
	movl %edx, 4(v)
	RET_IRQ_RESTORE
ENDP
#undef v

Annotation

Implementation Notes