diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 19a41e4..a0f900b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,8 @@ Common ------ * Add your name to [COPYING](/COPYING). +* **Don't** add your name to `AUTHORS` - it's for maintainers. +* Add copyright notice in the beginning of changed files except the headers. * If you change the behavior (even just fix a bug) of **libkernaux** (stable) or [libc](/libc), add a record to [ChangeLog](/ChangeLog). @@ -10,6 +12,31 @@ Common C language ---------- +* Name regular functions (*not methods*) and variables in lower snake case + (example: `foo_bar`). +* Name macros in upper snake case (example: `FOO_BAR`). +* Name types (*structures, unions, enumerations and type definitions*) in Pascal + case (example: `FooBar`). +* Name nested types in Pascal case and with the prefix of the surrounding type + in Pascal case, separate type names with underscores (example: + `FooBar_CarCdr`). +* Name methods (*functions that belong to a specific type*) in lower snake case + and with the prefix of the type name in Pascal case (example: + `FooBar_car_cdr`). + +* Name public (*defined in the headers and exported as symbols*) regular + functions (*not methods*) and variables with the prefix `kernaux_` (example: + `kernaux_foo_bar`). +* Name public (*defined in the headers*) macros with the prefix `KERNAUX_` + (example: `KERNAUX_FOO_BAR`). +* Name public (*defined in the headers*) types with the prefix `KernAux_` + (example: `KernAux_FooBar`). +* Name public (*defined in the headers*) with the prefix `KernAux_` and with the + prefix of the surrounding type, separate type names with underscore (example: + `KernAux_FooBar_CarCdr`). +* Name public (*defined in the headers*) methods with the prefix `KernAux_` and + with the prefix of the type name (example: `KernAux_FooBar_car_cdr`). + * Create `typedef`s with the names of related `struct`s. Use this name with a prefix `struct` to declare the data itself, withoth the prefix to declare a pointer or an array: diff --git a/README.md b/README.md index 40068f2..d70f1dd 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,6 @@ zero). Work-in-progress APIs can change at any time. * [ELF](/include/kernaux/elf.h) (*work in progress*) * [Master Boot Record](/include/kernaux/mbr.h) (*work in progress*) * [Multiboot 2 (GRUB 2)](/include/kernaux/multiboot2.h) (*work in progress*) - * Stivale 2 (Limine) (*planned*) * Utilities * [Measurement units utils](/include/kernaux/units.h) (*work in progress*) * [Example: To human](/examples/units_human.c) diff --git a/common/printf_orig.yml b/common/printf_orig.yml index 5a4d828..392da8d 100644 --- a/common/printf_orig.yml +++ b/common/printf_orig.yml @@ -1,6 +1,7 @@ # The code was taken from Marco Paland's printf. # Copyright (c) 2014-2019 Marco Paland +# Copyright (c) 2020-2022 Alex Kotov # TODO: add remaining tests from # https://github.com/mpaland/printf/blob/master/test/test_suite.cpp diff --git a/examples/bootloader-stivale2-limine/.gitignore b/examples/bootloader-stivale2-limine/.gitignore deleted file mode 100644 index e59723f..0000000 --- a/examples/bootloader-stivale2-limine/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/image.iso -/output.txt -/rootfs/boot/kernel -/rootfs/boot/limine-cd.bin -/rootfs/boot/limine-eltorito-efi.bin -/rootfs/boot/limine.sys diff --git a/examples/bootloader-stivale2-limine/Makefile b/examples/bootloader-stivale2-limine/Makefile deleted file mode 100644 index 1157020..0000000 --- a/examples/bootloader-stivale2-limine/Makefile +++ /dev/null @@ -1,91 +0,0 @@ -all: test - -CCPREFIX = ../../vendor/cross/root/bin/x86_64-elf- - -AS = $(CCPREFIX)as -CC = $(CCPREFIX)gcc - -LIBKERNAUX_SRC = ../.. -LIBKERNAUX_BUILD = ../../build/dev-cross-x86_64 -LIBKERNAUX_DEST = ../../dest/dev-cross-x86_64 - -DIFF = diff -LIMINE = ../../vendor/limine/build/bin -QEMU = qemu-system-x86_64 -serial stdio -display none -XORRISO = xorriso - -EXPECTED = expected.txt -IMAGE = image.iso -LINKERSCR = linker.ld -OUTPUT = output.txt -ROOTFS = rootfs - -LIMINE_CD = $(LIMINE)/limine-cd.bin -LIMINE_ELTORITO = $(LIMINE)/limine-eltorito-efi.bin -LIMINE_INSTALL = $(LIMINE)/limine-install -LIMINE_SYS = $(LIMINE)/limine.sys - -REL_KERNEL = boot/kernel -REL_LIMINE_CD = boot/limine-cd.bin -REL_LIMINE_CFG = boot/limine.cfg -REL_LIMINE_ELTORITO = boot/limine-eltorito-efi.bin -REL_LIMINE_SYS = boot/limine.sys - -FULL_KERNEL = $(ROOTFS)/$(REL_KERNEL) -FULL_LIMINE_CD = $(ROOTFS)/$(REL_LIMINE_CD) -FULL_LIMINE_CFG = $(ROOTFS)/$(REL_LIMINE_CFG) -FULL_LIMINE_ELTORITO = $(ROOTFS)/$(REL_LIMINE_ELTORITO) -FULL_LIMINE_SYS = $(ROOTFS)/$(REL_LIMINE_SYS) - -CFLAGS = \ - -std=c99 \ - -Wall \ - -Wextra \ - -Werror \ - -ffreestanding \ - -fno-stack-protector \ - -fno-pic \ - -I$(LIBKERNAUX_SRC)/include \ - -I$(LIBKERNAUX_BUILD)/include \ - -mabi=sysv \ - -mcmodel=kernel \ - -mno-80387 \ - -mno-red-zone \ - -MMD - # -pedantic \ - -OBJS = main.c.o stivale2.c.o - -test: run - $(DIFF) -a -Z $(EXPECTED) $(OUTPUT) - -run: $(IMAGE) - $(QEMU) -cdrom $< | tee $(OUTPUT) - -clean: - rm -f $(OUTPUT) $(IMAGE) $(FULL_KERNEL) $(FULL_LIMINE_CD) $(FULL_LIMINE_ELTORITO) $(FULL_LIMINE_SYS) $(OBJS) - -$(IMAGE): $(FULL_KERNEL) $(FULL_LIMINE_CD) $(FULL_LIMINE_ELTORITO) $(FULL_LIMINE_SYS) - $(XORRISO) -as mkisofs -b $(REL_LIMINE_CD) -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot $(REL_LIMINE_ELTORITO) -efi-boot-part --efi-boot-image --protective-msdos-label $(ROOTFS) -o $@ - $(LIMINE_INSTALL) $@ - -$(FULL_KERNEL): $(LINKERSCR) build-libkernaux.a $(OBJS) - $(CC) -T $(LINKERSCR) -o $@ $(OBJS) -ffreestanding -nostdlib -zmax-page-size=0x1000 -static -lkernaux -lgcc -Wl,-L$(LIBKERNAUX_DEST)/lib - -$(FULL_LIMINE_CD): - cp -f $(LIMINE_CD) $(FULL_LIMINE_CD) - -$(FULL_LIMINE_ELTORITO): - cp -f $(LIMINE_ELTORITO) $(FULL_LIMINE_ELTORITO) - -$(FULL_LIMINE_SYS): - cp -f $(LIMINE_SYS) $(FULL_LIMINE_SYS) - -build-libkernaux.a: - cd $(LIBKERNAUX_BUILD) && ./config && make install - -%.c.o: %.c - $(CC) -c $< -o $@ $(CFLAGS) - -%.S.o: %.S - $(AS) $< -o $@ diff --git a/examples/bootloader-stivale2-limine/expected.txt b/examples/bootloader-stivale2-limine/expected.txt deleted file mode 100644 index 8ab686e..0000000 --- a/examples/bootloader-stivale2-limine/expected.txt +++ /dev/null @@ -1 +0,0 @@ -Hello, World! diff --git a/examples/bootloader-stivale2-limine/linker.ld b/examples/bootloader-stivale2-limine/linker.ld deleted file mode 100644 index 0d0b547..0000000 --- a/examples/bootloader-stivale2-limine/linker.ld +++ /dev/null @@ -1,54 +0,0 @@ -/* Tell the linker that we want an x86_64 ELF64 output file */ -OUTPUT_FORMAT(elf64-x86-64) -OUTPUT_ARCH(i386:x86-64) - -/* We want the symbol _start to be our entry point */ -ENTRY(_start) - -/* Define the program headers we want so the bootloader gives us the right */ -/* MMU permissions */ -PHDRS -{ - null PT_NULL FLAGS(0) ; /* Null segment */ - text PT_LOAD FLAGS((1 << 0) | (1 << 2)) ; /* Execute + Read */ - rodata PT_LOAD FLAGS((1 << 2)) ; /* Read only */ - data PT_LOAD FLAGS((1 << 1) | (1 << 2)) ; /* Write + Read */ -} - -SECTIONS -{ - /* We wanna be placed in the topmost 2GiB of the address space, for optimisations */ - /* and because that is what the stivale2 spec mandates. */ - /* Any address in this region will do, but often 0xffffffff80000000 is chosen as */ - /* that is the beginning of the region. */ - . = 0xffffffff80000000; - - .text : { - *(.text .text.*) - } :text - - /* Move to the next memory page for .rodata */ - . += CONSTANT(MAXPAGESIZE); - - /* We place the .stivale2hdr section containing the header in its own section, */ - /* and we use the KEEP directive on it to make sure it doesn't get discarded. */ - .stivale2hdr : { - KEEP(*(.stivale2hdr)) - } :rodata - - .rodata : { - *(.rodata .rodata.*) - } :rodata - - /* Move to the next memory page for .data */ - . += CONSTANT(MAXPAGESIZE); - - .data : { - *(.data .data.*) - } :data - - .bss : { - *(COMMON) - *(.bss .bss.*) - } :data -} diff --git a/examples/bootloader-stivale2-limine/main.c b/examples/bootloader-stivale2-limine/main.c deleted file mode 100644 index c5e22ca..0000000 --- a/examples/bootloader-stivale2-limine/main.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include - -#include - -#include "stivale2.h" - -static void poweroff(); - -uint8_t stack[8192]; - -// We will now write a helper function which will allow us to scan for tags -// that we want FROM the bootloader (structure tags). -void *stivale2_get_tag(struct stivale2_struct *stivale2_struct, uint64_t id) { - struct stivale2_tag *current_tag = (void *)stivale2_struct->tags; - for (;;) { - // If the tag pointer is NULL (end of linked list), we did not find - // the tag. Return NULL to signal this. - if (current_tag == NULL) { - return NULL; - } - - // Check whether the identifier matches. If it does, return a pointer - // to the matching tag. - if (current_tag->identifier == id) { - return current_tag; - } - - // Get a pointer to the next tag in the linked list and repeat. - current_tag = (void *)current_tag->next; - } -} - -// The following will be our kernel's entry point. -void _start(struct stivale2_struct *stivale2_struct __attribute__((unused))) { - kernaux_console_puts("Hello, World!"); - poweroff(); -} - -void poweroff() -{ - const uint16_t port = 0x604; - const uint16_t value = 0x2000; - __asm__ volatile("outw %1, %0" : : "dN" (port), "a" (value)); -} diff --git a/examples/bootloader-stivale2-limine/rootfs/boot/limine.cfg b/examples/bootloader-stivale2-limine/rootfs/boot/limine.cfg deleted file mode 100644 index a422ae0..0000000 --- a/examples/bootloader-stivale2-limine/rootfs/boot/limine.cfg +++ /dev/null @@ -1,8 +0,0 @@ -DEFAULT_ENTRY=1 -TIMEOUT=0 - -:Kernel - -PROTOCOL=stivale2 -KERNEL_PATH=boot:///boot/kernel -KERNEL_CMDLINE=hello kernel diff --git a/examples/bootloader-stivale2-limine/stivale2.c b/examples/bootloader-stivale2-limine/stivale2.c deleted file mode 100644 index bcd4c1c..0000000 --- a/examples/bootloader-stivale2-limine/stivale2.c +++ /dev/null @@ -1,78 +0,0 @@ -#include - -#include "stivale2.h" - -// We need to tell the stivale bootloader where we want our stack to be. -// We are going to allocate our stack as an array in .bss. -extern uint8_t stack[8192]; - -// stivale2 uses a linked list of tags for both communicating TO the -// bootloader, or receiving info FROM it. More information about these tags -// is found in the stivale2 specification. - -// stivale2 offers a runtime terminal service which can be ditched at any -// time, but it provides an easy way to print out to graphical terminal, -// especially during early boot. -// Read the notes about the requirements for using this feature below this -// code block. -static struct stivale2_header_tag_terminal terminal_hdr_tag = { - // All tags need to begin with an identifier and a pointer to the next tag. - .tag = { - // Identification constant defined in stivale2.h and the specification. - .identifier = STIVALE2_HEADER_TAG_TERMINAL_ID, - // If next is 0, it marks the end of the linked list of header tags. - .next = 0 - }, - // The terminal header tag possesses a flags field, leave it as 0 for now - // as it is unused. - .flags = 0 -}; - -// We are now going to define a framebuffer header tag. -// This tag tells the bootloader that we want a graphical framebuffer instead -// of a CGA-compatible text mode. Omitting this tag will make the bootloader -// default to text mode, if available. -static struct stivale2_header_tag_framebuffer framebuffer_hdr_tag = { - // Same as above. - .tag = { - .identifier = STIVALE2_HEADER_TAG_FRAMEBUFFER_ID, - // Instead of 0, we now point to the previous header tag. The order in - // which header tags are linked does not matter. - .next = (uint64_t)&terminal_hdr_tag - }, - // We set all the framebuffer specifics to 0 as we want the bootloader - // to pick the best it can. - .framebuffer_width = 0, - .framebuffer_height = 0, - .framebuffer_bpp = 0 -}; - -// The stivale2 specification says we need to define a "header structure". -// This structure needs to reside in the .stivale2hdr ELF section in order -// for the bootloader to find it. We use this __attribute__ directive to -// tell the compiler to put the following structure in said section. -__attribute__((section(".stivale2hdr"), used)) -static struct stivale2_header stivale_hdr = { - // The entry_point member is used to specify an alternative entry - // point that the bootloader should jump to instead of the executable's - // ELF entry point. We do not care about that so we leave it zeroed. - .entry_point = 0, - // Let's tell the bootloader where our stack is. - // We need to add the sizeof(stack) since in x86(_64) the stack grows - // downwards. - .stack = (uintptr_t)stack + sizeof(stack), - // Bit 1, if set, causes the bootloader to return to us pointers in the - // higher half, which we likely want since this is a higher half kernel. - // Bit 2, if set, tells the bootloader to enable protected memory ranges, - // that is, to respect the ELF PHDR mandated permissions for the executable's - // segments. - // Bit 3, if set, enables fully virtual kernel mappings, which we want as - // they allow the bootloader to pick whichever *physical* memory address is - // available to load the kernel, rather than relying on us telling it where - // to load it. - // Bit 4 disables a deprecated feature and should always be set. - .flags = (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4), - // This header structure is the root of the linked list of header tags and - // points to the first one in the linked list. - .tags = (uintptr_t)&framebuffer_hdr_tag -}; diff --git a/examples/bootloader-stivale2-limine/stivale2.h b/examples/bootloader-stivale2-limine/stivale2.h deleted file mode 100644 index 690feb4..0000000 --- a/examples/bootloader-stivale2-limine/stivale2.h +++ /dev/null @@ -1,343 +0,0 @@ -#ifndef __STIVALE__STIVALE2_H__ -#define __STIVALE__STIVALE2_H__ - -#include - -#if (defined (_STIVALE2_SPLIT_64) && defined (__i386__)) || defined(_STIVALE2_SPLIT_64_FORCE) - -#define _stivale2_split64(NAME) \ - union { \ - uint32_t NAME; \ - uint32_t NAME##_lo; \ - }; \ - uint32_t NAME##_hi - -#else - -#define _stivale2_split64(NAME) \ - uint64_t NAME - -#endif - -#define STIVALE2_BOOTLOADER_BRAND_SIZE 64 -#define STIVALE2_BOOTLOADER_VERSION_SIZE 64 -#define STIVALE2_MODULE_STRING_SIZE 128 - -#define STIVALE2_HEADER_TAG_ANY_VIDEO_ID 0xc75c9fa92a44c4db -#define STIVALE2_HEADER_TAG_FRAMEBUFFER_ID 0x3ecc1bc43d0f7971 -#define STIVALE2_HEADER_TAG_FB_MTRR_ID 0x4c7bb07731282e00 -#define STIVALE2_HEADER_TAG_SLIDE_HHDM_ID 0xdc29269c2af53d1d -#define STIVALE2_HEADER_TAG_TERMINAL_ID 0xa85d499b1823be72 -#define STIVALE2_HEADER_TAG_SMP_ID 0x1ab015085f3273df -#define STIVALE2_HEADER_TAG_5LV_PAGING_ID 0x932f477032007e8f -#define STIVALE2_HEADER_TAG_UNMAP_NULL_ID 0x92919432b16fe7e7 - -#define STIVALE2_STRUCT_TAG_PMRS_ID 0x5df266a64047b6bd -#define STIVALE2_STRUCT_TAG_KERNEL_BASE_ADDRESS_ID 0x060d78874a2a8af0 -#define STIVALE2_STRUCT_TAG_CMDLINE_ID 0xe5e76a1b4597a781 -#define STIVALE2_STRUCT_TAG_MEMMAP_ID 0x2187f79e8612de07 -#define STIVALE2_STRUCT_TAG_FRAMEBUFFER_ID 0x506461d2950408fa -#define STIVALE2_STRUCT_TAG_EDID_ID 0x968609d7af96b845 -#define STIVALE2_STRUCT_TAG_TEXTMODE_ID 0x38d74c23e0dca893 -#define STIVALE2_STRUCT_TAG_FB_MTRR_ID 0x6bc1a78ebe871172 -#define STIVALE2_STRUCT_TAG_TERMINAL_ID 0xc2b3f4c3233b0974 -#define STIVALE2_STRUCT_TAG_MODULES_ID 0x4b6fe466aade04ce -#define STIVALE2_STRUCT_TAG_RSDP_ID 0x9e1786930a375e78 -#define STIVALE2_STRUCT_TAG_EPOCH_ID 0x566a7bed888e1407 -#define STIVALE2_STRUCT_TAG_FIRMWARE_ID 0x359d837855e3858c -#define STIVALE2_STRUCT_TAG_EFI_SYSTEM_TABLE_ID 0x4bc5ec15845b558e -#define STIVALE2_STRUCT_TAG_KERNEL_FILE_ID 0xe599d90c2975584a -#define STIVALE2_STRUCT_TAG_KERNEL_FILE_V2_ID 0x37c13018a02c6ea2 -#define STIVALE2_STRUCT_TAG_BOOT_VOLUME_ID 0x9b4358364c19ee62 -#define STIVALE2_STRUCT_TAG_KERNEL_SLIDE_ID 0xee80847d01506c57 -#define STIVALE2_STRUCT_TAG_SMBIOS_ID 0x274bd246c62bf7d1 -#define STIVALE2_STRUCT_TAG_SMP_ID 0x34d1d96339647025 -#define STIVALE2_STRUCT_TAG_PXE_SERVER_INFO 0x29d1e96239247032 -#define STIVALE2_STRUCT_TAG_MMIO32_UART 0xb813f9b8dbc78797 -#define STIVALE2_STRUCT_TAG_DTB 0xabb29bd49a2833fa -#define STIVALE2_STRUCT_TAG_HHDM_ID 0xb0ed257db18cb58f - -#define STIVALE2_TERM_CB_DEC 10 -#define STIVALE2_TERM_CB_BELL 20 -#define STIVALE2_TERM_CB_PRIVATE_ID 30 -#define STIVALE2_TERM_CB_STATUS_REPORT 40 -#define STIVALE2_TERM_CB_POS_REPORT 50 -#define STIVALE2_TERM_CB_KBD_LEDS 60 -#define STIVALE2_TERM_CB_MODE 70 -#define STIVALE2_TERM_CB_LINUX 80 - -#define STIVALE2_TERM_CTX_SIZE ((uint64_t)(-1)) -#define STIVALE2_TERM_CTX_SAVE ((uint64_t)(-2)) -#define STIVALE2_TERM_CTX_RESTORE ((uint64_t)(-3)) -#define STIVALE2_TERM_FULL_REFRESH ((uint64_t)(-4)) - -#define STIVALE2_PMR_EXECUTABLE ((uint64_t)1 << 0) -#define STIVALE2_PMR_WRITABLE ((uint64_t)1 << 1) -#define STIVALE2_PMR_READABLE ((uint64_t)1 << 2) - -#define STIVALE2_MMAP_USABLE 1 -#define STIVALE2_MMAP_RESERVED 2 -#define STIVALE2_MMAP_ACPI_RECLAIMABLE 3 -#define STIVALE2_MMAP_ACPI_NVS 4 -#define STIVALE2_MMAP_BAD_MEMORY 5 -#define STIVALE2_MMAP_BOOTLOADER_RECLAIMABLE 0x1000 -#define STIVALE2_MMAP_KERNEL_AND_MODULES 0x1001 -#define STIVALE2_MMAP_FRAMEBUFFER 0x1002 - -#define STIVALE2_FBUF_MMODEL_RGB 1 - -#define STIVALE2_FIRMWARE_BIOS (1 << 0) - -// Anchor for non ELF kernels -struct stivale2_anchor { - uint8_t anchor[15]; - uint8_t bits; - _stivale2_split64(phys_load_addr); - _stivale2_split64(phys_bss_start); - _stivale2_split64(phys_bss_end); - _stivale2_split64(phys_stivale2hdr); -}; - -struct stivale2_tag { - uint64_t identifier; - _stivale2_split64(next); -}; - -/* --- Header --------------------------------------------------------------- */ -/* Information passed from the kernel to the bootloader */ - -struct stivale2_header { - _stivale2_split64(entry_point); - _stivale2_split64(stack); - uint64_t flags; - _stivale2_split64(tags); -}; - -struct stivale2_header_tag_any_video { - struct stivale2_tag tag; - uint64_t preference; -}; - -struct stivale2_header_tag_framebuffer { - struct stivale2_tag tag; - uint16_t framebuffer_width; - uint16_t framebuffer_height; - uint16_t framebuffer_bpp; - uint16_t unused; -}; - -struct stivale2_header_tag_slide_hhdm { - struct stivale2_tag tag; - uint64_t flags; - _stivale2_split64(alignment); -}; - -struct stivale2_header_tag_terminal { - struct stivale2_tag tag; - uint64_t flags; - _stivale2_split64(callback); -}; - -struct stivale2_header_tag_smp { - struct stivale2_tag tag; - uint64_t flags; -}; - -/* --- Struct --------------------------------------------------------------- */ -/* Information passed from the bootloader to the kernel */ - -struct stivale2_struct { - char bootloader_brand[STIVALE2_BOOTLOADER_BRAND_SIZE]; - char bootloader_version[STIVALE2_BOOTLOADER_VERSION_SIZE]; - - uint64_t tags; -}; - -struct stivale2_pmr { - uint64_t base; - uint64_t length; - uint64_t permissions; -}; - -struct stivale2_struct_tag_pmrs { - struct stivale2_tag tag; - uint64_t entries; - struct stivale2_pmr pmrs[]; -}; - -struct stivale2_struct_tag_kernel_base_address { - struct stivale2_tag tag; - uint64_t physical_base_address; - uint64_t virtual_base_address; -}; - -struct stivale2_struct_tag_cmdline { - struct stivale2_tag tag; - uint64_t cmdline; -}; - -struct stivale2_mmap_entry { - uint64_t base; - uint64_t length; - uint32_t type; - uint32_t unused; -}; - -struct stivale2_struct_tag_memmap { - struct stivale2_tag tag; - uint64_t entries; - struct stivale2_mmap_entry memmap[]; -}; - -struct stivale2_struct_tag_framebuffer { - struct stivale2_tag tag; - uint64_t framebuffer_addr; - uint16_t framebuffer_width; - uint16_t framebuffer_height; - uint16_t framebuffer_pitch; - uint16_t framebuffer_bpp; - uint8_t memory_model; - uint8_t red_mask_size; - uint8_t red_mask_shift; - uint8_t green_mask_size; - uint8_t green_mask_shift; - uint8_t blue_mask_size; - uint8_t blue_mask_shift; - uint8_t unused; -}; - -struct stivale2_struct_tag_edid { - struct stivale2_tag tag; - uint64_t edid_size; - uint8_t edid_information[]; -}; - -struct stivale2_struct_tag_textmode { - struct stivale2_tag tag; - uint64_t address; - uint16_t unused; - uint16_t rows; - uint16_t cols; - uint16_t bytes_per_char; -}; - -struct stivale2_struct_tag_terminal { - struct stivale2_tag tag; - uint32_t flags; - uint16_t cols; - uint16_t rows; - uint64_t term_write; - uint64_t max_length; -}; - -struct stivale2_module { - uint64_t begin; - uint64_t end; - - char string[STIVALE2_MODULE_STRING_SIZE]; -}; - -struct stivale2_struct_tag_modules { - struct stivale2_tag tag; - uint64_t module_count; - struct stivale2_module modules[]; -}; - -struct stivale2_struct_tag_rsdp { - struct stivale2_tag tag; - uint64_t rsdp; -}; - -struct stivale2_struct_tag_epoch { - struct stivale2_tag tag; - uint64_t epoch; -}; - -struct stivale2_struct_tag_firmware { - struct stivale2_tag tag; - uint64_t flags; -}; - -struct stivale2_struct_tag_efi_system_table { - struct stivale2_tag tag; - uint64_t system_table; -}; - -struct stivale2_struct_tag_kernel_file { - struct stivale2_tag tag; - uint64_t kernel_file; -}; - -struct stivale2_struct_tag_kernel_file_v2 { - struct stivale2_tag tag; - uint64_t kernel_file; - uint64_t kernel_size; -}; - -struct stivale2_guid { - uint32_t a; - uint16_t b; - uint16_t c; - uint8_t d[8]; -}; - -struct stivale2_struct_tag_boot_volume { - struct stivale2_tag tag; - uint64_t flags; - struct stivale2_guid guid; - struct stivale2_guid part_guid; -}; - -struct stivale2_struct_tag_kernel_slide { - struct stivale2_tag tag; - uint64_t kernel_slide; -}; - -struct stivale2_struct_tag_smbios { - struct stivale2_tag tag; - uint64_t flags; - uint64_t smbios_entry_32; - uint64_t smbios_entry_64; -}; - -struct stivale2_smp_info { - uint32_t processor_id; - uint32_t lapic_id; - uint64_t target_stack; - uint64_t goto_address; - uint64_t extra_argument; -}; - -struct stivale2_struct_tag_smp { - struct stivale2_tag tag; - uint64_t flags; - uint32_t bsp_lapic_id; - uint32_t unused; - uint64_t cpu_count; - struct stivale2_smp_info smp_info[]; -}; - -struct stivale2_struct_tag_pxe_server_info { - struct stivale2_tag tag; - uint32_t server_ip; -}; - -struct stivale2_struct_tag_mmio32_uart { - struct stivale2_tag tag; - uint64_t addr; -}; - -struct stivale2_struct_tag_dtb { - struct stivale2_tag tag; - uint64_t addr; - uint64_t size; -}; - -struct stivale2_struct_tag_hhdm { - struct stivale2_tag tag; - uint64_t addr; -}; - -#undef _stivale2_split64 - -#endif diff --git a/libc/src/asm/i386/longjmp.S b/libc/src/asm/i386/longjmp.S index caa5340..f0439e2 100644 --- a/libc/src/asm/i386/longjmp.S +++ b/libc/src/asm/i386/longjmp.S @@ -1,8 +1,9 @@ /** * The code was taken from musl libc. * - * Copyright (c) 2011 Rich Felker - * Copyright (c) 2022 Alexander Monakov + * Copyright (c) 2011 Rich Felker + * Copyright (c) 2020-2022 Alex Kotov + * Copyright (c) 2022 Alexander Monakov */ #ifdef HAVE_CONFIG_H diff --git a/libc/src/asm/i386/setjmp.S b/libc/src/asm/i386/setjmp.S index d993619..210b171 100644 --- a/libc/src/asm/i386/setjmp.S +++ b/libc/src/asm/i386/setjmp.S @@ -2,6 +2,7 @@ * The code was taken from musl libc. * * Copyright (c) 2011-2015 Rich Felker + * Copyright (c) 2020-2022 Alex Kotov */ #ifdef HAVE_CONFIG_H diff --git a/libc/src/asm/x86_64/longjmp.S b/libc/src/asm/x86_64/longjmp.S index 3c4ff01..d978945 100644 --- a/libc/src/asm/x86_64/longjmp.S +++ b/libc/src/asm/x86_64/longjmp.S @@ -3,6 +3,7 @@ * * Copyright (c) 2011 Nicholas J. Kain * Copyright (c) 2011-2012 Rich Felker + * Copyright (c) 2020-2022 Alex Kotov * Copyright (c) 2022 Alexander Monakov */ diff --git a/libc/src/asm/x86_64/setjmp.S b/libc/src/asm/x86_64/setjmp.S index 58eed1c..6a56535 100644 --- a/libc/src/asm/x86_64/setjmp.S +++ b/libc/src/asm/x86_64/setjmp.S @@ -3,6 +3,7 @@ * * Copyright (c) 2011 Nicholas J. Kain * Copyright (c) 2011-2012 Rich Felker + * Copyright (c) 2020-2022 Alex Kotov * Copyright (c) 2022 Alexander Monakov */ diff --git a/src/alloc.c b/src/alloc.c index 7c910de..6ba1e76 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -2,6 +2,7 @@ * The code was inspired by the Embedded Artistry's libmemory. * * Copyright (c) 2017-2022 Embedded Artistry LLC + * Copyright (c) 2020-2022 Alex Kotov */ #ifdef HAVE_CONFIG_H diff --git a/src/printf.c b/src/printf.c index 79bf408..dfeacd1 100644 --- a/src/printf.c +++ b/src/printf.c @@ -2,6 +2,7 @@ * The code was taken from Marco Paland's printf. * * Copyright (c) 2014-2019 Marco Paland + * Copyright (c) 2020-2022 Alex Kotov * * Tiny [v]fprintf, sfprintf and [v]snprintf implementation, optimized for speed * on embedded systems with a very limited resources. These routines are thread diff --git a/src/printf_fmt.c b/src/printf_fmt.c index 0a2cc80..60746da 100644 --- a/src/printf_fmt.c +++ b/src/printf_fmt.c @@ -2,6 +2,7 @@ * The code was taken from Marco Paland's printf. * * Copyright (c) 2014-2019 Marco Paland + * Copyright (c) 2020-2022 Alex Kotov */ #ifdef HAVE_CONFIG_H