feat: reformatted driver code and linkage. Some optimizations

This commit is contained in:
2021-03-06 19:57:47 +01:00
parent 645e18018d
commit 01efc5e98a
13 changed files with 110 additions and 130 deletions

20
kernel/driver.h Normal file
View File

@@ -0,0 +1,20 @@
//
// Created by rick on 06-03-21.
//
#ifndef NEW_KERNEL_DRIVER_H
#define NEW_KERNEL_DRIVER_H
#include <attributes.h>
#ifndef STRUCT_ALIGNMENT
#define STRUCT_ALIGNMENT 16
#endif
#define DRIVER_CAT(a, b) DRIVER_DUMMY() a ## _ ## b
#define DRIVER_DUMMY()
#define GENERIC_DRIVER(drivername, data...) \
static struct drivername DRIVER_CAT(drivername, __COUNTER__) \
__attribute((__used__, __section__(#drivername))) \
= { data }
#endif //NEW_KERNEL_DRIVER_H