oops
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#define __section(x) gnu::section(x)
|
||||
#define __aligned(x) gnu::aligned(x)
|
||||
#define __packed gnu::packed
|
||||
#define __may_alias gnu::may_alias
|
||||
#define __naked gnu::naked
|
||||
|
||||
// These hints may improve code generation.
|
||||
@@ -12,7 +13,7 @@
|
||||
#define __used gnu::used
|
||||
#define __unused gnu::unused
|
||||
#define __format(like, ...) gnu::format(like, __VA_ARGS__)
|
||||
#define __always_inline gnu::always_inline
|
||||
#define __force_inline gnu::always_inline
|
||||
#define __visibility gnu::visibility
|
||||
#define __pure gnu::pure
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <stdatomic.h>
|
||||
|
||||
struct dpc {
|
||||
void (*const callback)(struct dpc* dpc, void* data);
|
||||
void (*callback)(struct dpc* dpc, void* data);
|
||||
void* data;
|
||||
atomic_bool inserted;
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
struct file_desc {};
|
||||
+13
-1
@@ -17,6 +17,17 @@ struct boot_file {
|
||||
char path[128];
|
||||
};
|
||||
|
||||
struct boot_color {
|
||||
uint8_t shift, size;
|
||||
};
|
||||
|
||||
struct boot_framebuffer {
|
||||
phys_t base;
|
||||
size_t width, height, pitch;
|
||||
uint8_t bytes_per_pixel;
|
||||
struct boot_color red, green, blue;
|
||||
};
|
||||
|
||||
struct boot_info {
|
||||
char* cmdline;
|
||||
struct phys_mem* mem_map;
|
||||
@@ -26,8 +37,9 @@ struct boot_info {
|
||||
uintptr_t hhdm_base;
|
||||
struct boot_file* files;
|
||||
size_t num_files;
|
||||
|
||||
struct boot_framebuffer fb;
|
||||
void* dtb;
|
||||
size_t dtb_size;
|
||||
#if CONFIG_ACPI
|
||||
phys_t rsdp;
|
||||
#endif
|
||||
|
||||
@@ -7,8 +7,10 @@
|
||||
#include <stddef.h>
|
||||
#include <uapi/uio.h>
|
||||
|
||||
typedef struct __iovec iovec_t;
|
||||
|
||||
struct iovec_iter {
|
||||
struct __iovec* iovecs;
|
||||
iovec_t* iovecs;
|
||||
size_t iovecs_len;
|
||||
size_t total_len;
|
||||
size_t total_offset;
|
||||
@@ -21,7 +23,7 @@ static inline size_t iovec_iter_len(struct iovec_iter* iter) {
|
||||
}
|
||||
|
||||
// Creates an iovec iterator over kernel memory.
|
||||
static inline struct iovec_iter iovec_iter_kernel(struct __iovec* iovecs, size_t count) {
|
||||
static inline struct iovec_iter iovec_iter_kernel(iovec_t* iovecs, size_t count) {
|
||||
size_t total = 0;
|
||||
for (size_t i = 0; i < count; i++)
|
||||
total += iovecs[i].len;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#define MODULE_VERSION(version) MODULE_PROPERTY("version", version)
|
||||
#define MODULE_LICENSE(license) MODULE_PROPERTY("license", license)
|
||||
|
||||
#ifdef IN_MODULE
|
||||
#define MODULE_ENTRY(func) \
|
||||
[[__used]] \
|
||||
errno_t __module_entry(struct module* __module) { \
|
||||
@@ -28,6 +29,15 @@
|
||||
} \
|
||||
[[__used, __section(".mod.exit")]] \
|
||||
static const void* __exit_fn = &__module_exit
|
||||
#else
|
||||
#define MODULE_ENTRY(func) \
|
||||
[[__used, __section(".mod.entry")]] \
|
||||
static const void* UNIQUE_IDENT(module_entry) = &(func)
|
||||
|
||||
#define MODULE_EXIT(func) \
|
||||
[[__used, __section(".mod.exit")]] \
|
||||
static const void* UNIQUE_IDENT(module_exit) = &(func)
|
||||
#endif
|
||||
|
||||
struct module {
|
||||
const char* name;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//
|
||||
// Defining variables with `[[__percpu]]` will put them in a special section.
|
||||
// This section is unique for every CPU. To access the correct memory of the
|
||||
// caller's CPU, use `percpu_ref`.
|
||||
// caller's CPU, use `percpu_ref`. To access another CPU's copy, use `percpu_ref_on`.
|
||||
//
|
||||
// ## Example
|
||||
//
|
||||
@@ -22,8 +22,9 @@
|
||||
// }
|
||||
// ```
|
||||
|
||||
#define __percpu __used, __section(".percpu.data")
|
||||
#define percpu_ref(x) ((typeof(&(x)))((void*)percpu_get() + ((void*)&(x) - (void*)&percpu_bsp)))
|
||||
#define __percpu __used, __section(".percpu.data")
|
||||
#define percpu_ref_on(cpu, x) ((typeof(&(x)))((void*)(cpu) + ((void*)&(x) - (void*)&percpu_bsp)))
|
||||
#define percpu_ref(x) percpu_ref_on(percpu_get(), x)
|
||||
|
||||
// CPU-relative information.
|
||||
struct percpu {
|
||||
|
||||
Reference in New Issue
Block a user