/* include/kernel/init.h
*
* Copyright (C) 2021, 2022 intirain.
*
* This file is part of evx.
*
* evx is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* evx is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with evx. If not, see
*/
#ifndef __INIT_H
#define __INIT_H
#ifndef __ASSEMBLER__
#include
#ifndef NULL
#define NULL ((void *) 0)
#endif
/* defines in kernel.lds */
extern void *_init_call_arch, *_init_call_kernel, *_init_call_modules;
extern void *_einit_call_arch, *_einit_call_kernel, *_einit_call_modules;
/* never use this directly. use kernel_end instead of it */
extern int _end __attribute__ ((__section__(".end")));
extern void *kernel_end;
#define STATE_INIT_CALLS 1
#define STATE_READY 2
extern int init_state;
#define arch_init(fn) \
void *__initcall1_##fn __attribute__ ((__section__ (".initcalls.arch"))) = fn;
#define kernel_init(fn) \
void *__initcall2_##fn __attribute__ ((__section__ (".initcalls.kernel"))) = fn;
#define __init __attribute__((__section__(".init.text")))
#define __init_data __attribute__((__section__(".init.data")))
#define ARRAYSIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#endif
#endif