Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
atomic.h
Go to the documentation of this file.
1
#ifndef __LIBK__ATOMIC_H__
2
#define __LIBK__ATOMIC_H__
3
4
#include <
type.h
>
5
6
static
inline
uint64_t
7
atomic_fetch_add_u64
(
volatile
uint64_t
*
addr
,
uint64_t
val)
8
{
9
__asm__
volatile
(
"lock; xaddq %0, %1"
:
"+r"
(val),
"+m"
(*addr) : :
"memory"
);
10
return
val;
11
}
12
13
#endif
// __LIBK__ATOMIC_H__
atomic_fetch_add_u64
static uint64_t atomic_fetch_add_u64(volatile uint64_t *addr, uint64_t val)
Definition
atomic.h:7
addr
volatile uint64_t addr
Definition
e1000.hpp:0
type.h
uint64_t
unsigned long uint64_t
Definition
type.h:25
kernel
libk
atomic.h
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2