mirror of
https://github.com/tailix/libkernaux.git
synced 2025-04-14 17:32:55 -04:00
Maintenance (#125)
This commit is contained in:
parent
8025bd1f60
commit
e93d08ee70
49 changed files with 161 additions and 176 deletions
12
.github/workflows/main.yml
vendored
12
.github/workflows/main.yml
vendored
|
@ -17,8 +17,8 @@ jobs:
|
|||
run: ./autogen.sh
|
||||
- name: configure
|
||||
run: ./configure --enable-checks-cppcheck
|
||||
- name: cppcheck
|
||||
run: make check-cppcheck
|
||||
- name: check
|
||||
run: make check
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
@ -38,7 +38,7 @@ jobs:
|
|||
- name: make
|
||||
run: make
|
||||
- name: check
|
||||
run: make check || (./test-suite-log && false)
|
||||
run: make check || (./make/test-suite-log && false)
|
||||
- name: install
|
||||
run: sudo make install
|
||||
|
||||
|
@ -80,7 +80,7 @@ jobs:
|
|||
- name: make
|
||||
run: make
|
||||
- name: check
|
||||
run: make check || (./test-suite-log && false)
|
||||
run: make check || (./make/test-suite-log && false)
|
||||
- name: install
|
||||
run: sudo make install
|
||||
|
||||
|
@ -103,7 +103,7 @@ jobs:
|
|||
- name: make
|
||||
run: make
|
||||
- name: check
|
||||
run: make check || (./test-suite-log && false)
|
||||
run: make check || (./make/test-suite-log && false)
|
||||
- name: install
|
||||
run: sudo make install
|
||||
|
||||
|
@ -140,6 +140,6 @@ jobs:
|
|||
- name: make
|
||||
run: cd "libkernaux-$(cat VERSION)" && make
|
||||
- name: check
|
||||
run: cd "libkernaux-$(cat VERSION)" && make check || (./test-suite-log && false)
|
||||
run: cd "libkernaux-$(cat VERSION)" && make check || (./make/test-suite-log && false)
|
||||
- name: install
|
||||
run: cd "libkernaux-$(cat VERSION)" && sudo make install
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2022-12-03 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* include/kernaux/macro.h: Add macros "KERNAUX_ALIGNED", "KERNAUX_PRINTF",
|
||||
"KERNAUX_USED", "KERNAUX_SECTION"
|
||||
|
||||
2022-12-02 Alex Kotov <kotovalexarian@gmail.com>
|
||||
|
||||
* configure.ac: Rename args "--enable-tests*" to "--enable-checks*"
|
||||
|
|
22
Makefile.am
22
Makefile.am
|
@ -1,4 +1,5 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
include $(top_srcdir)/make/shared.am
|
||||
include $(top_srcdir)/make/checks.am
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt
|
||||
|
@ -23,22 +24,6 @@ AM_CFLAGS += -DKERNAUX_ACCESS_PRIVATE
|
|||
|
||||
lib_LTLIBRARIES = libkernaux.la
|
||||
|
||||
##########
|
||||
# Checks #
|
||||
##########
|
||||
|
||||
MY_CHECKS =
|
||||
check: $(MY_CHECKS)
|
||||
|
||||
if ENABLE_CHECKS_CPPCHECK
|
||||
MY_CHECKS += check-cppcheck
|
||||
check-cppcheck:
|
||||
$(CPPCHECK) $(CPPCHECK_ARGS) $(CPPCHECK_PATHS)
|
||||
|
||||
CPPCHECK_ARGS = --quiet --error-exitcode=1 --std=c99 --inline-suppr --enable=warning,style,performance,portability
|
||||
CPPCHECK_PATHS = examples/ include/ libc/ src/ tests/
|
||||
endif
|
||||
|
||||
##################
|
||||
# Required files #
|
||||
##################
|
||||
|
@ -135,8 +120,7 @@ if WITH_DRIVERS
|
|||
libkernaux_la_SOURCES += \
|
||||
src/drivers/console.c \
|
||||
src/drivers/framebuffer.c \
|
||||
src/drivers/shutdown.c \
|
||||
src/drivers/qemu.c
|
||||
src/drivers/shutdown.c
|
||||
|
||||
# Intel 8253-compatible programmable interval timer
|
||||
|
||||
|
|
|
@ -138,6 +138,7 @@ stable options.
|
|||
|
||||
* `--enable-checks` - enable usual tests and examples
|
||||
* `--enable-checks-all` - enable all tests
|
||||
* `--enable-checks-cppcheck` - enable cppcheck
|
||||
* `--enable-checks-python` - enable tests that require Python 3 with YAML and
|
||||
Jinja2
|
||||
|
||||
|
|
16
configure.ac
16
configure.ac
|
@ -7,9 +7,9 @@ LT_PREREQ([2.4.6])
|
|||
|
||||
|
||||
|
||||
#######################
|
||||
# Initialize Autoconf #
|
||||
#######################
|
||||
##################################
|
||||
# Initialize Autoconf & Automake #
|
||||
##################################
|
||||
|
||||
AC_INIT([libkernaux],
|
||||
m4_normalize(m4_include([VERSION])),
|
||||
|
@ -36,6 +36,8 @@ AC_CONFIG_FILES([
|
|||
tests/Makefile
|
||||
])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.16 subdir-objects])
|
||||
|
||||
|
||||
|
||||
###############
|
||||
|
@ -316,14 +318,6 @@ AS_IF([test "$enable_freestanding" = yes],
|
|||
|
||||
|
||||
|
||||
#######################
|
||||
# Initialize Automake #
|
||||
#######################
|
||||
|
||||
AM_INIT_AUTOMAKE([1.16 subdir-objects])
|
||||
|
||||
|
||||
|
||||
##############
|
||||
# Run checks #
|
||||
##############
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
include $(top_srcdir)/make/shared.am
|
||||
|
||||
TESTS =
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
all: test
|
||||
|
||||
CCPREFIX = ../../vendor/cross/root/bin/i386-elf-
|
||||
REPO = ../../..
|
||||
|
||||
CCPREFIX = $(REPO)/vendor/cross/root/bin/i386-elf-
|
||||
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
|
||||
LIBKERNAUX_SRC = ../..
|
||||
LIBKERNAUX_BUILD = ../../build/dev-cross-i386
|
||||
LIBKERNAUX_DEST = ../../dest/dev-cross-i386
|
||||
LIBKERNAUX_BUILD = $(REPO)/build/dev-cross-i386
|
||||
LIBKERNAUX_DEST = $(REPO)/dest/dev-cross-i386
|
||||
|
||||
DIFF = diff
|
||||
GRUB_FILE = grub-file
|
||||
|
@ -24,15 +25,14 @@ GRUBCFG = $(ROOTFS)/boot/grub/grub.cfg
|
|||
KERNEL = $(ROOTFS)/boot/kernel
|
||||
|
||||
CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-I$(LIBKERNAUX_SRC)/include \
|
||||
-I$(LIBKERNAUX_BUILD)/include
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-I$(LIBKERNAUX_DEST)/include
|
||||
|
||||
OBJS = main.c.o multiboot2.c.o start.S.o
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <kernaux/asm/i386.h>
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
void poweroff();
|
||||
|
||||
extern const struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
|
||||
static void panic(const char *str);
|
||||
|
@ -46,13 +44,8 @@ void main(
|
|||
);
|
||||
}
|
||||
|
||||
void poweroff()
|
||||
{
|
||||
kernaux_asm_i386_outportw(0x604, 0x2000);
|
||||
}
|
||||
|
||||
void panic(const char *const str)
|
||||
{
|
||||
kernaux_drivers_console_printf("panic: %s\n", str);
|
||||
poweroff();
|
||||
kernaux_drivers_shutdown_poweroff();
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
// TODO: add more tags
|
||||
__attribute__((section(".multiboot2"), used))
|
||||
__attribute__((aligned(KERNAUX_MULTIBOOT2_HEADER_ALIGN)))
|
||||
KERNAUX_SECTION(".multiboot2")
|
||||
KERNAUX_USED
|
||||
KERNAUX_ALIGNED(KERNAUX_MULTIBOOT2_HEADER_ALIGN)
|
||||
const struct {
|
||||
struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
struct KernAux_Multiboot2_HTag_None tag_none;
|
||||
}
|
||||
__attribute__((packed))
|
||||
KERNAUX_PACKED
|
||||
multiboot2_header = {
|
||||
.multiboot2_header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
|
@ -26,3 +29,5 @@ multiboot2_header = {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
|
@ -14,9 +14,7 @@ _kernel_stack_end:
|
|||
|
||||
.global _start
|
||||
|
||||
.type _start, @function
|
||||
.type main, @function
|
||||
.type poweroff, @function
|
||||
.type _start, @function
|
||||
|
||||
_start:
|
||||
mov $_kernel_stack_end, %esp // Initialize stack
|
||||
|
@ -24,7 +22,6 @@ _start:
|
|||
push %ebx // Multiboot information pointer
|
||||
push %eax // Multiboot magic number
|
||||
call main
|
||||
|
||||
call poweroff
|
||||
call kernaux_drivers_shutdown_poweroff
|
||||
|
||||
.size _start, . - _start
|
|
@ -1,17 +1,18 @@
|
|||
all: test
|
||||
|
||||
CCPREFIX = ../../vendor/cross/root/bin/i386-elf-
|
||||
REPO = ../../..
|
||||
|
||||
CCPREFIX = $(REPO)/vendor/cross/root/bin/i386-elf-
|
||||
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
|
||||
LIBKERNAUX_SRC = ../..
|
||||
LIBKERNAUX_BUILD = ../../build/dev-cross-i386
|
||||
LIBKERNAUX_DEST = ../../dest/dev-cross-i386
|
||||
LIBKERNAUX_BUILD = $(REPO)/build/dev-cross-i386
|
||||
LIBKERNAUX_DEST = $(REPO)/dest/dev-cross-i386
|
||||
|
||||
DIFF = diff
|
||||
GRUB_FILE = grub-file
|
||||
LIMINE = ../../vendor/limine/build/bin
|
||||
LIMINE = $(REPO)/vendor/limine/build/bin
|
||||
QEMU = qemu-system-x86_64 -serial stdio -display none
|
||||
XORRISO = xorriso
|
||||
|
||||
|
@ -39,15 +40,14 @@ FULL_LIMINE_ELTORITO = $(ROOTFS)/$(REL_LIMINE_ELTORITO)
|
|||
FULL_LIMINE_SYS = $(ROOTFS)/$(REL_LIMINE_SYS)
|
||||
|
||||
CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-I$(LIBKERNAUX_SRC)/include \
|
||||
-I$(LIBKERNAUX_BUILD)/include
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-fno-stack-protector \
|
||||
-I$(LIBKERNAUX_DEST)/include
|
||||
|
||||
OBJS = main.c.o multiboot2.c.o start.S.o
|
||||
|
|
@ -1,12 +1,10 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <kernaux/asm/i386.h>
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
#include <kernaux/multiboot2.h>
|
||||
|
||||
void poweroff();
|
||||
|
||||
extern const struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
|
||||
static void panic(const char *str);
|
||||
|
@ -46,13 +44,8 @@ void main(
|
|||
);
|
||||
}
|
||||
|
||||
void poweroff()
|
||||
{
|
||||
kernaux_asm_i386_outportw(0x604, 0x2000);
|
||||
}
|
||||
|
||||
void panic(const char *const str)
|
||||
{
|
||||
kernaux_drivers_console_printf("panic: %s\n", str);
|
||||
poweroff();
|
||||
kernaux_drivers_shutdown_poweroff();
|
||||
}
|
|
@ -1,13 +1,16 @@
|
|||
#include <kernaux/multiboot2.h>
|
||||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
// TODO: add more tags
|
||||
__attribute__((section(".multiboot2"), used))
|
||||
__attribute__((aligned(KERNAUX_MULTIBOOT2_HEADER_ALIGN)))
|
||||
KERNAUX_SECTION(".multiboot2")
|
||||
KERNAUX_USED
|
||||
KERNAUX_ALIGNED(KERNAUX_MULTIBOOT2_HEADER_ALIGN)
|
||||
const struct {
|
||||
struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
struct KernAux_Multiboot2_HTag_None tag_none;
|
||||
}
|
||||
__attribute__((packed))
|
||||
KERNAUX_PACKED
|
||||
multiboot2_header = {
|
||||
.multiboot2_header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
|
@ -26,3 +29,5 @@ multiboot2_header = {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
|
@ -14,9 +14,7 @@ _kernel_stack_end:
|
|||
|
||||
.global _start
|
||||
|
||||
.type _start, @function
|
||||
.type main, @function
|
||||
.type poweroff, @function
|
||||
.type _start, @function
|
||||
|
||||
_start:
|
||||
mov $_kernel_stack_end, %esp // Initialize stack
|
||||
|
@ -24,7 +22,6 @@ _start:
|
|||
push %ebx // Multiboot information pointer
|
||||
push %eax // Multiboot magic number
|
||||
call main
|
||||
|
||||
call poweroff
|
||||
call kernaux_drivers_shutdown_poweroff
|
||||
|
||||
.size _start, . - _start
|
|
@ -1,12 +1,14 @@
|
|||
all: run
|
||||
|
||||
CCPREFIX = ../../vendor/cross/root/bin/riscv64-elf-
|
||||
REPO = ../../..
|
||||
|
||||
CCPREFIX = $(REPO)/vendor/cross/root/bin/riscv64-elf-
|
||||
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
|
||||
LIBKERNAUX_BUILD = ../../build/dev-cross-riscv64
|
||||
LIBKERNAUX_DEST = ../../dest/dev-cross-riscv64
|
||||
LIBKERNAUX_BUILD = $(REPO)/build/dev-cross-riscv64
|
||||
LIBKERNAUX_DEST = $(REPO)/dest/dev-cross-riscv64
|
||||
|
||||
QEMU = qemu-system-riscv64 -serial stdio -display none
|
||||
|
||||
|
@ -14,13 +16,14 @@ KERNEL = kernel.elf
|
|||
LINKERSCR = linker.ld
|
||||
|
||||
CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-mcmodel=medany
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-Werror \
|
||||
-ffreestanding \
|
||||
-mcmodel=medany \
|
||||
-I$(LIBKERNAUX_DEST)/include
|
||||
|
||||
OBJS = main.c.o start.S.o
|
||||
|
||||
|
@ -30,7 +33,7 @@ run: $(KERNEL)
|
|||
clean:
|
||||
rm -f $(KERNEL) $(OBJS)
|
||||
|
||||
$(KERNEL): $(LINKERSCR) $(OBJS) build-libkernaux.a
|
||||
$(KERNEL): $(LINKERSCR) build-libkernaux.a $(OBJS)
|
||||
$(CC) -T $(LINKERSCR) -o $@ $(OBJS) -nostdlib -lkernaux -lgcc -Wl,-L$(LIBKERNAUX_DEST)/lib
|
||||
|
||||
build-libkernaux.a:
|
|
@ -1,6 +1,8 @@
|
|||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
|
||||
static unsigned char *const uart = (unsigned char*)0x10000000;
|
||||
|
||||
static void putchar(char c) {
|
||||
|
@ -16,4 +18,5 @@ static void print(const char * str) {
|
|||
|
||||
void main() {
|
||||
print("Hello world!\r\n");
|
||||
kernaux_drivers_shutdown_poweroff();
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
__attribute__((aligned(KERNAUX_MULTIBOOT2_HEADER_ALIGN)))
|
||||
KERNAUX_ALIGNED(KERNAUX_MULTIBOOT2_HEADER_ALIGN)
|
||||
static const struct {
|
||||
struct KernAux_Multiboot2_Header header;
|
||||
// This macro may be used to create the tag
|
||||
|
|
|
@ -98,8 +98,7 @@ if WITH_DRIVERS
|
|||
nobase_include_HEADERS += \
|
||||
kernaux/drivers/console.h \
|
||||
kernaux/drivers/framebuffer.h \
|
||||
kernaux/drivers/shutdown.h \
|
||||
kernaux/drivers/qemu.h
|
||||
kernaux/drivers/shutdown.h
|
||||
|
||||
# Intel 8253-compatible programmable interval timer
|
||||
|
||||
|
|
|
@ -5,13 +5,15 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void kernaux_drivers_console_putc(char c);
|
||||
|
||||
void kernaux_drivers_console_print(const char *s);
|
||||
@comment_line_printf@void kernaux_drivers_console_printf(const char *format, ...)
|
||||
@comment_line_printf@__attribute__((format(printf, 1, 2)));
|
||||
@comment_line_printf@KERNAUX_PRINTF(1, 2)
|
||||
@comment_line_printf@void kernaux_drivers_console_printf(const char *format, ...);
|
||||
void kernaux_drivers_console_puts(const char *s);
|
||||
void kernaux_drivers_console_write(const char *data, size_t size);
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
#ifndef KERNAUX_INCLUDED_DRIVERS_QEMU
|
||||
#define KERNAUX_INCLUDED_DRIVERS_QEMU
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void kernaux_drivers_qemu_poweroff();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -12,9 +12,14 @@ extern "C" {
|
|||
* Language features *
|
||||
*********************/
|
||||
|
||||
#define KERNAUX_UNUSED __attribute__((unused))
|
||||
#define KERNAUX_NORETURN __attribute__((noreturn))
|
||||
#define KERNAUX_RETURNS_TWICE __attribute__((returns_twice))
|
||||
#define KERNAUX_UNUSED __attribute__((unused))
|
||||
#define KERNAUX_USED __attribute__((used))
|
||||
|
||||
#define KERNAUX_ALIGNED(num) __attribute__((aligned(num)))
|
||||
#define KERNAUX_PRINTF(fmt, rest) __attribute__((format(printf, fmt, rest)))
|
||||
#define KERNAUX_SECTION(name) __attribute__((section(name)))
|
||||
|
||||
#ifdef __TINYC__
|
||||
# define KERNAUX_PACKED
|
||||
|
|
|
@ -789,14 +789,12 @@ bool KernAux_Multiboot2_ITag_ImageLoadBasePhysAddr_is_valid(
|
|||
|
||||
void KernAux_Multiboot2_Header_print(
|
||||
const struct KernAux_Multiboot2_Header *multiboot2_header,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_HTagBase_print(
|
||||
const struct KernAux_Multiboot2_HTagBase *tag_base,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
/*******************************
|
||||
|
@ -805,38 +803,32 @@ void KernAux_Multiboot2_HTagBase_print(
|
|||
|
||||
void KernAux_Multiboot2_Info_print(
|
||||
const struct KernAux_Multiboot2_Info *multiboot2_info,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_ITagBase_print(
|
||||
const struct KernAux_Multiboot2_ITagBase *tag_base,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_ITag_BootCmdLine_print(
|
||||
const struct KernAux_Multiboot2_ITag_BootCmdLine *tag,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_ITag_BootLoaderName_print(
|
||||
const struct KernAux_Multiboot2_ITag_BootLoaderName *tag,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_ITag_MemoryMap_print(
|
||||
const struct KernAux_Multiboot2_ITag_MemoryMap *tag,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
void KernAux_Multiboot2_ITag_ELFSymbols_print(
|
||||
const struct KernAux_Multiboot2_ITag_ELFSymbols *tag,
|
||||
void (*printf)(const char *format, ...)
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void (*printf)(const char *format, ...) KERNAUX_PRINTF(1, 2)
|
||||
);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
include $(top_srcdir)/make/shared.am
|
||||
|
||||
SUBDIRS = include
|
||||
|
||||
|
|
16
make/checks.am
Normal file
16
make/checks.am
Normal file
|
@ -0,0 +1,16 @@
|
|||
# vim: set syntax=automake:
|
||||
|
||||
MY_CHECKS =
|
||||
check: $(MY_CHECKS)
|
||||
|
||||
if ENABLE_CHECKS_CPPCHECK
|
||||
MY_CHECKS += check-cppcheck
|
||||
check-cppcheck:
|
||||
$(CPPCHECK) $(CPPCHECK_ARGS) $(CPPCHECK_INC) $(CPPCHECK_SUPPRESS) $(CPPCHECK_PATHS)
|
||||
|
||||
CPPCHECK_ARGS = --quiet --error-exitcode=1 --std=c99 --inline-suppr --enable=warning,style,performance,portability
|
||||
CPPCHECK_INC = -I$(top_builddir)/include -I$(top_srcdir)/include
|
||||
CPPCHECK_SUPPRESS = --suppress='unusedStructMember:examples/multiboot2_header_macro.c'
|
||||
CPPCHECK_SUPPRESS += --suppress='unusedStructMember:tests/test_multiboot2_info_*.c'
|
||||
CPPCHECK_PATHS = examples/ include/ libc/ src/ tests/
|
||||
endif
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include <kernaux/assert.h>
|
||||
#include <kernaux/drivers/console.h>
|
||||
#include <kernaux/macro.h>
|
||||
|
||||
#ifdef ASM_I386
|
||||
#include <kernaux/asm/i386.h>
|
||||
|
@ -22,10 +23,12 @@
|
|||
static void file_putc(char c, void *arg);
|
||||
#endif
|
||||
|
||||
void kernaux_drivers_console_putc(const char c KERNAUX_UNUSED)
|
||||
void kernaux_drivers_console_putc(const char c)
|
||||
{
|
||||
#ifdef ASM_X86
|
||||
#if defined(ASM_X86)
|
||||
kernaux_asm_x86_outportb(0x3f8, c);
|
||||
#else
|
||||
(void)c;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <kernaux/drivers/qemu.h>
|
||||
|
||||
#ifdef ASM_X86
|
||||
#include <kernaux/asm/x86.h>
|
||||
#endif
|
||||
|
||||
void kernaux_drivers_qemu_poweroff()
|
||||
{
|
||||
#ifdef ASM_X86
|
||||
// QEMU >= 2.0
|
||||
kernaux_asm_x86_outportw(0x604, 0x2000);
|
||||
// QEMU < 2.0
|
||||
kernaux_asm_x86_outportw(0xB004, 0x2000);
|
||||
#endif
|
||||
}
|
|
@ -3,7 +3,10 @@
|
|||
#endif
|
||||
|
||||
#include <kernaux/drivers/shutdown.h>
|
||||
#include <kernaux/drivers/qemu.h>
|
||||
|
||||
#ifdef ASM_X86
|
||||
#include <kernaux/asm/x86.h>
|
||||
#endif
|
||||
|
||||
void kernaux_drivers_shutdown_halt()
|
||||
{
|
||||
|
@ -18,7 +21,12 @@ void kernaux_drivers_shutdown_halt()
|
|||
|
||||
void kernaux_drivers_shutdown_poweroff()
|
||||
{
|
||||
kernaux_drivers_qemu_poweroff();
|
||||
#ifdef ASM_X86
|
||||
// QEMU >= 2.0
|
||||
kernaux_asm_x86_outportw(0x604, 0x2000);
|
||||
// QEMU < 2.0
|
||||
kernaux_asm_x86_outportw(0xB004, 0x2000);
|
||||
#endif
|
||||
|
||||
// If we can't poweroff then we halt
|
||||
kernaux_drivers_shutdown_halt();
|
||||
|
|
|
@ -12,6 +12,7 @@ char *kernaux_utoa(uint64_t value, char *buffer, int base, const char *prefix)
|
|||
KERNAUX_ASSERT(buffer);
|
||||
|
||||
// Protect caller from invalid state in case of future assertions
|
||||
// cppcheck-suppress ctunullpointer
|
||||
*buffer = '\0';
|
||||
|
||||
switch (base) {
|
||||
|
|
|
@ -42,6 +42,7 @@ static void KernAux_PFA_mark(
|
|||
void KernAux_PFA_initialize(const KernAux_PFA pfa)
|
||||
{
|
||||
KERNAUX_ASSERT(pfa);
|
||||
// cppcheck-suppress ctunullpointer
|
||||
memset(pfa->flags, 0, sizeof(pfa->flags));
|
||||
}
|
||||
|
||||
|
@ -50,6 +51,7 @@ bool KernAux_PFA_is_available(const KernAux_PFA pfa, const size_t page_addr)
|
|||
KERNAUX_ASSERT(pfa);
|
||||
KERNAUX_ASSERT(page_addr % KERNAUX_PFA_PAGE_SIZE == 0);
|
||||
|
||||
// cppcheck-suppress ctunullpointer
|
||||
return GET_FLAG_FROM_ADDR(pfa, page_addr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
include $(top_srcdir)/make/shared.am
|
||||
|
||||
CLEANFILES =
|
||||
TESTS =
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
#include <kernaux/macro/packing_start.run>
|
||||
|
||||
static const struct {
|
||||
struct KernAux_Multiboot2_Header multiboot2_header;
|
||||
struct KernAux_Multiboot2_HTag_None tag_none;
|
||||
} multiboot2_header_example1 = {
|
||||
}
|
||||
KERNAUX_PACKED
|
||||
multiboot2_header_example1 = {
|
||||
.multiboot2_header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
.arch = KERNAUX_MULTIBOOT2_HEADER_ARCH_MIPS32,
|
||||
|
@ -19,3 +23,5 @@ static const struct {
|
|||
},
|
||||
},
|
||||
};
|
||||
|
||||
#include <kernaux/macro/packing_end.run>
|
||||
|
|
|
@ -34,7 +34,9 @@ static const struct {
|
|||
struct KernAux_Multiboot2_HTag_RelocatableHeader tag_relocatable_header;
|
||||
|
||||
struct KernAux_Multiboot2_HTag_None tag_none;
|
||||
} KERNAUX_PACKED multiboot2_header_example2 = {
|
||||
}
|
||||
KERNAUX_PACKED
|
||||
multiboot2_header_example2 = {
|
||||
.multiboot2_header = {
|
||||
.magic = KERNAUX_MULTIBOOT2_HEADER_MAGIC,
|
||||
.arch = KERNAUX_MULTIBOOT2_HEADER_ARCH_I386,
|
||||
|
|
|
@ -105,7 +105,9 @@ static const struct {
|
|||
uint8_t _align11[4];
|
||||
|
||||
struct KernAux_Multiboot2_ITag_None tag_none;
|
||||
} KERNAUX_PACKED multiboot2_info_example2 = {
|
||||
}
|
||||
KERNAUX_PACKED
|
||||
multiboot2_info_example2 = {
|
||||
.multiboot2_info = {
|
||||
.total_size = sizeof(multiboot2_info_example2),
|
||||
.reserved1 = 0,
|
||||
|
|
|
@ -20,7 +20,7 @@ static const char *const data = "foobar";
|
|||
static char buffer[BUFFER_SIZE];
|
||||
static size_t buffer_index;
|
||||
|
||||
static void test_putc(char c, KERNAUX_UNUSED void *arg)
|
||||
static void test_putc(char c, void *arg KERNAUX_UNUSED)
|
||||
{
|
||||
if (buffer_index >= BUFFER_SIZE) {
|
||||
printf("Buffer overflow!\n");
|
||||
|
|
2
vendor/opensbi
vendored
2
vendor/opensbi
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 6dde43584f185f71a8dd713deb438d7c724a9ad5
|
||||
Subproject commit 4489876e933d8ba0d8bc6c64bae71e295d45faac
|
2
vendor/u-boot
vendored
2
vendor/u-boot
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 0962da92a1dfb210eef8c936e33862812fa1b208
|
||||
Subproject commit 4debc57a3da6c3f4d3f89a637e99206f4cea0a96
|
Loading…
Add table
Reference in a new issue