modify file names and create directories
This commit is contained in:
86
arch/x86/kernel/include/ihk/atomic.h
Normal file
86
arch/x86/kernel/include/ihk/atomic.h
Normal file
@ -0,0 +1,86 @@
|
||||
#ifndef HEADER_X86_COMMON_AAL_ATOMIC_H
|
||||
#define HEADER_X86_COMMON_AAL_ATOMIC_H
|
||||
|
||||
typedef struct {
|
||||
int counter;
|
||||
} aal_atomic_t;
|
||||
|
||||
#define AAL_ATOMIC_INIT(i) { (i) }
|
||||
|
||||
|
||||
static inline int aal_atomic_read(const aal_atomic_t *v)
|
||||
{
|
||||
return (*(volatile int *)&(v)->counter);
|
||||
}
|
||||
|
||||
static inline void aal_atomic_set(aal_atomic_t *v, int i)
|
||||
{
|
||||
v->counter = i;
|
||||
}
|
||||
|
||||
static inline void aal_atomic_add(int i, aal_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock addl %1,%0"
|
||||
: "+m" (v->counter)
|
||||
: "ir" (i));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_sub(int i, aal_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock subl %1,%0"
|
||||
: "+m" (v->counter)
|
||||
: "ir" (i));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_inc(aal_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock incl %0"
|
||||
: "+m" (v->counter));
|
||||
}
|
||||
|
||||
static inline void aal_atomic_dec(aal_atomic_t *v)
|
||||
{
|
||||
asm volatile("lock decl %0"
|
||||
: "+m" (v->counter));
|
||||
}
|
||||
|
||||
static inline int aal_atomic_dec_and_test(aal_atomic_t *v)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
asm volatile("lock decl %0; sete %1"
|
||||
: "+m" (v->counter), "=qm" (c)
|
||||
: : "memory");
|
||||
return c != 0;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_inc_and_test(aal_atomic_t *v)
|
||||
{
|
||||
unsigned char c;
|
||||
|
||||
asm volatile("lock incl %0; sete %1"
|
||||
: "+m" (v->counter), "=qm" (c)
|
||||
: : "memory");
|
||||
return c != 0;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_add_return(int i, aal_atomic_t *v)
|
||||
{
|
||||
int __i;
|
||||
|
||||
__i = i;
|
||||
asm volatile("lock xaddl %0, %1"
|
||||
: "+r" (i), "+m" (v->counter)
|
||||
: : "memory");
|
||||
return i + __i;
|
||||
}
|
||||
|
||||
static inline int aal_atomic_sub_return(int i, aal_atomic_t *v)
|
||||
{
|
||||
return aal_atomic_add_return(-i, v);
|
||||
}
|
||||
|
||||
#define aal_atomic_inc_return(v) (aal_atomic_add_return(1, v))
|
||||
#define aal_atomic_dec_return(v) (aal_atomic_sub_return(1, v))
|
||||
|
||||
#endif
|
||||
27
arch/x86/kernel/include/ihk/context.h
Normal file
27
arch/x86/kernel/include/ihk/context.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef __HEADER_X86_COMMON_CONTEXT_H
|
||||
#define __HEADER_X86_COMMON_CONTEXT_H
|
||||
|
||||
#include <registers.h>
|
||||
|
||||
struct x86_kregs {
|
||||
unsigned long rsp, rbp, rbx, rsi, rdi, r12, r13, r14, r15, rflags;
|
||||
unsigned long rsp0;
|
||||
};
|
||||
|
||||
typedef struct x86_kregs aal_mc_kernel_context_t;
|
||||
/* XXX: User context should contain floating point registers */
|
||||
typedef struct x86_regs aal_mc_user_context_t;
|
||||
|
||||
#define aal_mc_syscall_arg0(uc) (uc)->rdi
|
||||
#define aal_mc_syscall_arg1(uc) (uc)->rsi
|
||||
#define aal_mc_syscall_arg2(uc) (uc)->rdx
|
||||
#define aal_mc_syscall_arg3(uc) (uc)->r10
|
||||
#define aal_mc_syscall_arg4(uc) (uc)->r8
|
||||
#define aal_mc_syscall_arg5(uc) (uc)->r9
|
||||
|
||||
#define aal_mc_syscall_ret(uc) (uc)->rax
|
||||
|
||||
#define aal_mc_syscall_pc(uc) (uc)->rip
|
||||
#define aal_mc_syscall_sp(uc) (uc)->rsp
|
||||
|
||||
#endif
|
||||
11
arch/x86/kernel/include/ihk/ikc.h
Normal file
11
arch/x86/kernel/include/ihk/ikc.h
Normal file
@ -0,0 +1,11 @@
|
||||
#ifndef HEADER_X86_COMMON_AAL_IKC_H
|
||||
#define HEADER_X86_COMMON_AAL_IKC_H
|
||||
|
||||
#include <ikc/aal.h>
|
||||
|
||||
/* manycore side */
|
||||
int aal_mc_ikc_init_first(struct aal_ikc_channel_desc *,
|
||||
aal_ikc_ph_t handler);
|
||||
|
||||
#endif
|
||||
|
||||
20
arch/x86/kernel/include/ihk/types.h
Normal file
20
arch/x86/kernel/include/ihk/types.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef X86_COMMON_TYPES_H
|
||||
#define X86_COMMON_TYPES_H
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef char int8_t;
|
||||
typedef short int16_t;
|
||||
typedef int int32_t;
|
||||
typedef long long int64_t;
|
||||
|
||||
typedef long long ptrdiff_t;
|
||||
typedef unsigned long long size_t;
|
||||
typedef long long ssize_t;
|
||||
|
||||
#define NULL ((void *)0)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user