feat: rank drivers at compile time
This commit is contained in:
@@ -5,16 +5,18 @@
|
||||
#ifndef NEW_KERNEL_DRIVER_H
|
||||
#define NEW_KERNEL_DRIVER_H
|
||||
#include <attributes.h>
|
||||
#include <preprocessor_format_zero.h>
|
||||
|
||||
#ifndef STRUCT_ALIGNMENT
|
||||
#define STRUCT_ALIGNMENT 16
|
||||
#endif
|
||||
#define DRIVER_CAT(a, b) DRIVER_DUMMY() a ## _ ## b
|
||||
#define DRIVER_DUMMY()
|
||||
#define SECT_NAME_(a,b) "." #a "." #b
|
||||
#define SECT_NAME(a,b) SECT_NAME_(a, b)
|
||||
|
||||
#define GENERIC_DRIVER(drivername, data...) \
|
||||
static struct drivername DRIVER_CAT(drivername, __COUNTER__) \
|
||||
__attribute((__used__, __section__(#drivername))) \
|
||||
= { data }
|
||||
#define GENERIC_DRIVER(drivername, order) \
|
||||
static struct drivername DRIVER_CAT(drivername, counter) \
|
||||
__attribute((__used__, __section__(SECT_NAME(drivername, FORMAT_3_ZERO(order)))))
|
||||
|
||||
#endif //NEW_KERNEL_DRIVER_H
|
||||
|
||||
Reference in New Issue
Block a user