kernel: add c++ support

This commit is contained in:
2023-03-20 20:41:39 +00:00
parent a4d850cc03
commit 2bfb6bcd78
41 changed files with 333 additions and 38 deletions

View File

@@ -1,6 +1,10 @@
#ifndef SOCKS_USER_CPU_H_
#define SOCKS_USER_CPU_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ml_cpu_block {
int cpu_reserved;
} ml_cpu_block;
@@ -12,4 +16,8 @@ extern int ml_cpu_block_use(ml_cpu_block *p);
extern void ml_halt_cpu(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -3,6 +3,10 @@
#define ML_HWLOCK_INIT (0)
#ifdef __cplusplus
extern "C" {
#endif
typedef int ml_hwlock_t;
extern void ml_hwlock_lock(ml_hwlock_t *lck);
@@ -11,4 +15,8 @@ extern void ml_hwlock_unlock(ml_hwlock_t *lck);
extern void ml_hwlock_lock_irqsave(ml_hwlock_t *lck, unsigned long *flags);
extern void ml_hwlock_unlock_irqrestore(ml_hwlock_t *lck, unsigned long flags);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -3,6 +3,10 @@
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#define __X2(x) #x
#define __X(x) __X2(x)
@@ -18,4 +22,8 @@
extern int ml_init(uintptr_t arg);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -3,6 +3,10 @@
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
extern uintptr_t __pagemap_base(void);
extern uintptr_t __pagemap_limit(void);
@@ -23,4 +27,8 @@ extern uintptr_t __pagemap_limit(void);
#define VM_PAGE_MIN_ORDER VM_PAGE_4K
#define VM_PAGE_MAX_ORDER VM_PAGE_8M
#ifdef __cplusplus
}
#endif
#endif