diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-08-17 21:47:38 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-08-17 21:49:16 +0300 |
| commit | 565724db3b73ee67fa996dab511dc52df586cee1 (patch) | |
| tree | d3bd77006c2c57aa961f85c4fc677bd72f6251ae | |
| download | kmi-565724db3b73ee67fa996dab511dc52df586cee1.tar.gz kmi-565724db3b73ee67fa996dab511dc52df586cee1.zip | |
Garbage
| -rw-r--r-- | Makefile | 41 | ||||
| -rw-r--r-- | arch/riscv/include/csr.h | 6 | ||||
| -rw-r--r-- | arch/riscv/include/pages.h | 47 | ||||
| -rw-r--r-- | arch/riscv/include/sbi.h | 12 | ||||
| -rw-r--r-- | arch/riscv/include/vmap.h | 19 | ||||
| -rw-r--r-- | arch/riscv/init/head.S | 10 | ||||
| -rw-r--r-- | arch/riscv/init/init.c | 111 | ||||
| -rw-r--r-- | arch/riscv/main.c | 13 | ||||
| -rw-r--r-- | arch/riscv/riscv-link.S | 20 | ||||
| -rw-r--r-- | arch/riscv/sbi.c | 27 | ||||
| -rw-r--r-- | arch/riscv/source.mk | 5 | ||||
| -rw-r--r-- | arch/source.mk | 3 | ||||
| -rw-r--r-- | fs/kernel.itb | bin | 0 -> 2340 bytes | |||
| -rw-r--r-- | include/apos/compiler_attributes.h | 6 | ||||
| -rw-r--r-- | include/apos/init.h | 9 | ||||
| -rw-r--r-- | include/apos/link.lds.h | 45 | ||||
| -rw-r--r-- | include/apos/main.h | 8 | ||||
| -rw-r--r-- | include/apos/sizes.h | 59 | ||||
| -rw-r--r-- | init.a | bin | 0 -> 20856 bytes | |||
| -rw-r--r-- | init.c | 389 | ||||
| -rw-r--r-- | init.debug | bin | 0 -> 5712 bytes | |||
| -rw-r--r-- | kernel.a | bin | 0 -> 7734 bytes | |||
| -rw-r--r-- | kernel.its | 34 |
23 files changed, 864 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..56369f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,41 @@ +CFLAGS := -fno-pie -g -ffreestanding -nostdlib +INCLUDE_DIRS := include + +all: kernel.bin + +KERNEL_SOURCES := +INIT_SOURCES := +LINKER_SOURCE := +TARGET ?= riscv +CROSS_COMPILER ?= riscv64-unknown-elf- +CC := gcc +AR := ar +CPP := cpp +OBJCOPY := objcopy +OBJCOPY_FLAGS := -Obinary + +include arch/source.mk + +INCLUDE_FLAGS := $(addprefix -I,$(INCLUDE_DIRS)) +KERNEL_OBJECTS := $(patsubst %.c,%.o,$(KERNEL_SOURCES)) +KERNEL_OBJECTS := $(patsubst %.S,%.o,$(KERNEL_OBJECTS)) + +LINKER_FILE := $(patsubst %.S,%.ld,$(LINKER_SOURCE)) + +kernel.bin: kernel.elf + $(CROSS_COMPILER)$(OBJCOPY) $(OBJCOPY_FLAGS) $< $@ + +kernel.elf: $(KERNEL_OBJECTS) | $(LINKER_FILE) + $(CROSS_COMPILER)$(CC) -T$(LINKER_FILE) $(CFLAGS) $(INCLUDE_FLAGS) $^ -o $@ + +%.o: %.c + $(CROSS_COMPILER)$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -c $< -o $@ + +%.o: %.S + $(CROSS_COMPILER)$(CC) $(CFLAGS) $(INCLUDE_FLAGS) -c $< -o $@ + +$(LINKER_FILE): $(LINKER_SOURCE) + $(CROSS_COMPILER)$(CPP) $(INCLUDE_FLAGS) $< | sed -n '/^[^#]/p' > $@ + +clean: + rm $(KERNEL_OBJECTS) $(INIT_OBJECTS) $(LINKER_FILE) kernel.bin kernel.elf diff --git a/arch/riscv/include/csr.h b/arch/riscv/include/csr.h new file mode 100644 index 0000000..13f96cb --- /dev/null +++ b/arch/riscv/include/csr.h @@ -0,0 +1,6 @@ +#ifndef APOS_CSR_H +#define APOS_CSR_H + +#define csr_write(csr, val) + +#endif /* APOS_CSR_H */ diff --git a/arch/riscv/include/pages.h b/arch/riscv/include/pages.h new file mode 100644 index 0000000..4ae2ab9 --- /dev/null +++ b/arch/riscv/include/pages.h @@ -0,0 +1,47 @@ +#ifndef APOS_RISCV_PAGES_H +#define APOS_RISCV_PAGES_H + +typedef char pagemask_t; +typedef char lockbit_t; + +struct kilopages { + pagemask_t page[64]; +}; + +struct megapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct kilopages kilo[512]; +}; + +/* Sv39 */ +struct gigapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct megapages mega[512]; +}; + +struct terapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct gigapages giga[512]; +}; + +struct mm_pagearr_info { + short tera_num; + struct terapages *tera_top; + + short giga_num; + struct gigapages *giga_top; + + short mega_num; + struct megapages *mega_top; + + short kilo_num; + struct kilopages *kilo_top; +}; + +#endif /* APOS_RISCV_PAGES_H */ diff --git a/arch/riscv/include/sbi.h b/arch/riscv/include/sbi.h new file mode 100644 index 0000000..609849d --- /dev/null +++ b/arch/riscv/include/sbi.h @@ -0,0 +1,12 @@ +#ifndef APOS_RISCV_SBI_H + +struct sbiret { + long error; + long value; +}; + +struct sbiret sbi_ecall(int ext, int fid, + unsigned long arg0, unsigned long arg1, unsigned long arg2, + unsigned long arg3, unsigned long arg4, unsigned long arg5); + +#endif /* APOS_RISCV_SBI_H */ diff --git a/arch/riscv/include/vmap.h b/arch/riscv/include/vmap.h new file mode 100644 index 0000000..3dac3a1 --- /dev/null +++ b/arch/riscv/include/vmap.h @@ -0,0 +1,19 @@ +#ifndef APOS_RISCV_VMAP_H +#define APOS_RISCV_VMAP_H + +#include <apos/sizes.h> + +#define VM_V (1 << 1) +#define VM_R (1 << 2) +#define VM_W (1 << 3) +#define VM_X (1 << 4) +#define VM_U (1 << 5) +#define VM_G (1 << 6) +#define VM_A (1 << 7) +#define VM_D (1 << 8) +#define VM_AL 0xff + +#define VM_TOP (-1) +#define VM_KERN (VM_TOP - SZ_1G) + +#endif /* APOS_RISCV_VMAP_H */ diff --git a/arch/riscv/init/head.S b/arch/riscv/init/head.S new file mode 100644 index 0000000..703d265 --- /dev/null +++ b/arch/riscv/init/head.S @@ -0,0 +1,10 @@ +.section .init.start +.global _start +.type _start, @function +_start: + /* store kernel load address */ + auipc a4, 0 + /* stack grows downward */ + mv sp, a4 + /* go to proper init */ + j init diff --git a/arch/riscv/init/init.c b/arch/riscv/init/init.c new file mode 100644 index 0000000..cdcfbb7 --- /dev/null +++ b/arch/riscv/init/init.c @@ -0,0 +1,111 @@ +#include <stddef.h> +#include <apos/init.h> +#include <apos/sizes.h> +#include <pages.h> +#include <vmap.h> + +struct page_ret { + size_t left; + size_t num; + void *top; +}; + +extern void main(struct mm_pagearr_info *pageinfo); + +void __init init_zero(void *ptr, size_t bytes) +{ + char *byte_ptr = ptr; + + /* Not entirely sure if it would be faster to use a larget type than + * char, Linux seems to have memset16/32/64 but I guess I should check + * the generated assembly. + */ + while(bytes--) + *byte_ptr++ = 0; +} + +struct page_ret __init init_pages(size_t ram_size, void *ram_top, + size_t page_size, size_t struct_size) +{ + size_t num_pages = ram_size / page_size; + size_t size_pages = num_pages * struct_size; + + struct page_ret pageret; + pageret.top = ram_top - size_pages; + pageret.num = num_pages; + pageret.left = ram_size - (size_pages * page_size); + + init_zero(pageret.top, size_pages); + + return pageret; +}; + +size_t __init init_align_down(size_t num, size_t a) +{ + size_t rem = num % a; + return num - rem; +} + +size_t __init init_align_up(size_t num, size_t a) +{ + return init_align_down(num, a) + a; +} + +void __init init_enter_vm(unsigned long *root_page) +{ + asm volatile ("csrw 0x180, %0\n" "sfence.vma\n" + : + : "rK" (root_page) + : "memory"); +} + +void call_main() +{ +} + +void __init init(void *ram_base, void *ram_top, void *initrd, void *fdt, void *boot) +{ + size_t ram_size = ram_top - ram_base; + + struct mm_pagearr_info pagearr; + struct page_ret pageret; + + /* create crude page status map at the top of physical RAM */ + pageret = init_pages(ram_size, ram_top, + SZ_512G, sizeof(struct terapages)); + pagearr.tera_num = pageret.num; + pagearr.tera_top = pageret.top; + + pageret = init_pages(pageret.left, pageret.top, + SZ_1G, sizeof(struct gigapages)); + pagearr.giga_num = pageret.num; + pagearr.giga_top = pageret.top; + + pageret = init_pages(pageret.left, pageret.top, + SZ_2M, sizeof(struct megapages)); + pagearr.mega_num = pageret.num; + pagearr.mega_top = pageret.top; + + pageret = init_pages(pageret.left, pageret.top, + SZ_4K, sizeof(struct kilopages)); + pagearr.kilo_num = pageret.num; + pagearr.kilo_top = pageret.top; + + unsigned long *root_page = (unsigned long *) + (init_align_down((size_t)pagearr.kilo_top, SZ_4K) - SZ_4K); + + /* TODO: should init insert page data into the created arrays? */ + + /* map .text.* into top part of RAM */ + root_page[511] = ((unsigned long)&main & VM_AL) | VM_V | VM_R | VM_W | VM_X; + + /* temporarily map .init.* so that our current physical address matches + * the virtual address */ + root_page[0] = 0 | VM_V | VM_R | VM_W | VM_X; + + /* enter virtual memory */ + init_enter_vm(root_page); + + /* enter main */ + call_main(); +} diff --git a/arch/riscv/main.c b/arch/riscv/main.c new file mode 100644 index 0000000..382f311 --- /dev/null +++ b/arch/riscv/main.c @@ -0,0 +1,13 @@ +#include <pages.h> +#include <apos/main.h> + +void yeet() +{ + int a = 23; +} + +void __main main(struct mm_pagearr_info *pageinfo) +{ + yeet(); + while(1){}; +} diff --git a/arch/riscv/riscv-link.S b/arch/riscv/riscv-link.S new file mode 100644 index 0000000..ffdf590 --- /dev/null +++ b/arch/riscv/riscv-link.S @@ -0,0 +1,20 @@ +#include <vmap.h> + +OUTPUT_ARCH(riscv) +ENTRY(_start) + +SECTIONS { + . = 0; /* no offset */ + .init : { + *(.init.start); + *(.init.text); + *(.init.data); + . = ALIGN(4K); + } + + .text ALIGN(VM_KERN) : AT(ADDR(.init) + SIZEOF(.init)) { + *(.init.start); + *(.text.start); + *(.text); + } +} diff --git a/arch/riscv/sbi.c b/arch/riscv/sbi.c new file mode 100644 index 0000000..e255ecf --- /dev/null +++ b/arch/riscv/sbi.c @@ -0,0 +1,27 @@ +#include <sbi.h> + +struct sbiret sbi_ecall(int ext, int fid, + unsigned long arg0, unsigned long arg1, unsigned long arg2, + unsigned long arg3, unsigned long arg4, unsigned long arg5) +{ + struct sbiret ret; + + register unsigned long a0 asm("a0") = arg0; + register unsigned long a1 asm("a1") = arg1; + register unsigned long a2 asm("a2") = arg2; + register unsigned long a3 asm("a3") = arg3; + register unsigned long a4 asm("a4") = arg4; + register unsigned long a5 asm("a5") = arg5; + register unsigned long a6 asm("a6") = fid; + register unsigned long a7 asm("a7") = ext; + + asm volatile ("ecall" + : "+r" (a0), "+r" (a1) + : "r" (a2), "r" (a3), "r" (a4), "r" (a5), "r" (a6), "r" (a7) + : "memory"); + + ret.error = a0; + ret.value = a1; + + return ret; +} diff --git a/arch/riscv/source.mk b/arch/riscv/source.mk new file mode 100644 index 0000000..f52750c --- /dev/null +++ b/arch/riscv/source.mk @@ -0,0 +1,5 @@ +LOCAL_KERNEL_SOURCES := main.c init/head.S init/init.c +KERNEL_SOURCES += $(addprefix arch/riscv/,$(LOCAL_KERNEL_SOURCES)) + +INCLUDE_DIRS += arch/riscv/include +LINKER_SOURCE := arch/riscv/riscv-link.S diff --git a/arch/source.mk b/arch/source.mk new file mode 100644 index 0000000..1b21b56 --- /dev/null +++ b/arch/source.mk @@ -0,0 +1,3 @@ +ifeq ($(TARGET),riscv) +include arch/riscv/source.mk +endif diff --git a/fs/kernel.itb b/fs/kernel.itb Binary files differnew file mode 100644 index 0000000..0d9f740 --- /dev/null +++ b/fs/kernel.itb diff --git a/include/apos/compiler_attributes.h b/include/apos/compiler_attributes.h new file mode 100644 index 0000000..45b7ac3 --- /dev/null +++ b/include/apos/compiler_attributes.h @@ -0,0 +1,6 @@ +#ifndef APOS_COMPILER_ATTRIBUTES_H + +#define __section(section) __attribute__((__section__(section))) +#define __noinline __attribute__((noinline)) + +#endif /* APOS_COMPILER_ATTRIBUTES_H */ diff --git a/include/apos/init.h b/include/apos/init.h new file mode 100644 index 0000000..1c4bc9d --- /dev/null +++ b/include/apos/init.h @@ -0,0 +1,9 @@ +#ifndef APOS_INIT_H +#define APOS_INIT_H + +#include <apos/compiler_attributes.h> + +#define __init __section(".init.text") +#define __initdata __section(".init.data") + +#endif /* APOS_INIT_H */ diff --git a/include/apos/link.lds.h b/include/apos/link.lds.h new file mode 100644 index 0000000..aa9f2e2 --- /dev/null +++ b/include/apos/link.lds.h @@ -0,0 +1,45 @@ +#ifndef APOS_LINK_LDS_H +#define APOS_LINK_LDS_H + +#define DWARF_DEBUG \ + /* DWARF 1 */ \ + .debug 0 : { *(.debug) } \ + .line 0 : { *(.line) } \ + /* GNU DWARF 1 extensions */ \ + .debug_srcinfo 0 : { *(.debug_srcinfo) } \ + .debug_sfnames 0 : { *(.debug_sfnames) } \ + /* DWARF 1.1 and DWARF 2 */ \ + .debug_aranges 0 : { *(.debug_aranges) } \ + .debug_pubnames 0 : { *(.debug_pubnames) } \ + /* DWARF 2 */ \ + .debug_info 0 : { *(.debug_info \ + .gnu.linkonce.wi.*) } \ + .debug_abbrev 0 : { *(.debug_abbrev) } \ + .debug_line 0 : { *(.debug_line) } \ + .debug_frame 0 : { *(.debug_frame) } \ + .debug_str 0 : { *(.debug_str) } \ + .debug_loc 0 : { *(.debug_loc) } \ + .debug_macinfo 0 : { *(.debug_macinfo) } \ + .debug_pubtypes 0 : { *(.debug_pubtypes) } \ + /* DWARF 3 */ \ + .debug_ranges 0 : { *(.debug_ranges) } \ + /* SGI/MIPS DWARF 2 extensions */ \ + .debug_weaknames 0 : { *(.debug_weaknames) } \ + .debug_funcnames 0 : { *(.debug_funcnames) } \ + .debug_typenames 0 : { *(.debug_typenames) } \ + .debug_varnames 0 : { *(.debug_varnames) } \ + /* GNU DWARF 2 extensions */ \ + .debug_gnu_pubnames 0 : { *(.debug_gnu_pubnames) } \ + .debug_gnu_pubtypes 0 : { *(.debug_gnu_pubtypes) } \ + /* DWARF 4 */ \ + .debug_types 0 : { *(.debug_types) } \ + /* DWARF 5 */ \ + .debug_addr 0 : { *(.debug_addr) } \ + .debug_line_str 0 : { *(.debug_line_str) } \ + .debug_loclists 0 : { *(.debug_loclists) } \ + .debug_macro 0 : { *(.debug_macro) } \ + .debug_names 0 : { *(.debug_names) } \ + .debug_rnglists 0 : { *(.debug_rnglists) } \ + .debug_str_offsets 0 : { *(.debug_str_offsets) } + +#endif /* APOS_LINK_LDS_H */ diff --git a/include/apos/main.h b/include/apos/main.h new file mode 100644 index 0000000..1cea533 --- /dev/null +++ b/include/apos/main.h @@ -0,0 +1,8 @@ +#ifndef APOS_MAIN_H +#define APOS_MAIN_H + +#include <apos/compiler_attributes.h> + +#define __main __section(".text.start") __noinline + +#endif /* APOS_MAIN_H */ diff --git a/include/apos/sizes.h b/include/apos/sizes.h new file mode 100644 index 0000000..58a68bc --- /dev/null +++ b/include/apos/sizes.h @@ -0,0 +1,59 @@ +#ifndef APOS_SIZES_H +#define APOS_SIZES_H + +#define SZ_1 0x000000000001 +#define SZ_2 0x000000000002 +#define SZ_4 0x000000000004 +#define SZ_8 0x000000000008 +#define SZ_16 0x000000000010 +#define SZ_32 0x000000000020 +#define SZ_64 0x000000000040 +#define SZ_128 0x000000000080 +#define SZ_256 0x000000000100 +#define SZ_512 0x000000000200 + +#define SZ_1K 0x000000000400 +#define SZ_2K 0x000000000800 +#define SZ_4K 0x000000001000 +#define SZ_8K 0x000000002000 +#define SZ_16K 0x000000004000 +#define SZ_32K 0x000000008000 +#define SZ_64K 0x000000010000 +#define SZ_128K 0x000000020000 +#define SZ_256K 0x000000040000 +#define SZ_512K 0x000000080000 + +#define SZ_1M 0x000000100000 +#define SZ_2M 0x000000200000 +#define SZ_4M 0x000000400000 +#define SZ_8M 0x000000800000 +#define SZ_16M 0x000001000000 +#define SZ_32M 0x000002000000 +#define SZ_64M 0x000004000000 +#define SZ_128M 0x000008000000 +#define SZ_256M 0x000010000000 +#define SZ_512M 0x000020000000 + +#define SZ_1G 0x000040000000 +#define SZ_2G 0x000080000000 +#define SZ_4G 0x000100000000 +#define SZ_8G 0x000200000000 +#define SZ_16G 0x000400000000 +#define SZ_32G 0x000800000000 +#define SZ_64G 0x000400000000 +#define SZ_128G 0x000800000000 +#define SZ_256G 0x001000000000 +#define SZ_512G 0x002000000000 + +#define SZ_1T 0x004000000000 +#define SZ_2T 0x008000000000 +#define SZ_4T 0x010000000000 +#define SZ_8T 0x020000000000 +#define SZ_16T 0x040000000000 +#define SZ_32T 0x080000000000 +#define SZ_64T 0x100000000000 +#define SZ_128T 0x200000000000 +#define SZ_256T 0x400000000000 +#define SZ_512T 0x800000000000 + +#endif /* APOS_SIZES_H */ Binary files differ@@ -0,0 +1,389 @@ + +Symtab for file arch/riscv/init/head.S at 0x55d5c1168a50 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: asm + +Line table: + + line 6 at 0x83800000 (stmt) + line 8 at 0x83800004 (stmt) + line 10 at 0x83800006 (stmt) + line 0 at 0x8380000a (stmt) + +Blockvector: + +block #000, object at 0x55d5c1168ae0, 0 syms/buckets in 0x83800000..0x8380000a + block #001, object at 0x55d5c1168a80 under 0x55d5c1168ae0, 0 syms/buckets in 0x83800000..0x8380000a + + +Symtab for file arch/riscv/init/init.c at 0x55d5c113f9f0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector: + +block #000, object at 0x55d5c1168880, 0 syms/buckets in 0x83800000..0x83800000 + block #001, object at 0x55d5c11687c0 under 0x55d5c1168880, 4 syms/buckets in 0x83800000..0x83800000 + typedef char pagemask_t; + typedef long unsigned int long unsigned int; + typedef long double long double; + struct megapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct kilopages kilo[512]; + }; + + struct mm_pagearr_info { + short int tera_num; + struct terapages *tera_top; + short int giga_num; + struct gigapages *giga_top; + short int mega_num; + struct megapages *mega_top; + short int kilo_num; + struct kilopages *kilo_top; + }; + + struct page_ret { + size_t left; + size_t num; + void *top; + }; + + typedef long int long int; + typedef long unsigned int size_t; + typedef int int; + typedef long long int long long int; + typedef char char; + typedef char lockbit_t; + struct kilopages { + pagemask_t page[64]; + }; + + struct gigapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct megapages mega[512]; + }; + + struct terapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct gigapages giga[512]; + }; + + typedef short int short int; + +Compunit user: 0x55d5c115e2e0 + +Symtab for file /usr/lib/gcc/riscv64-unknown-elf/8.3.0/include/stddef.h at 0x55d5c113f990 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file arch/riscv/include/pages.h at 0x55d5c113f9c0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file include/apos/init.h at 0x55d5c113fa20 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file include/apos/compiler_attributes.h at 0x55d5c113fa50 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file include/apos/sizes.h at 0x55d5c113fa80 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file arch/riscv/include/vmap.h at 0x55d5c113fab0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/init/init.c + + +Symtab for file arch/riscv/main.c at 0x55d5c115e3f0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector: + +block #000, object at 0x55d5c113f860, 0 syms/buckets in 0x83800000..0x83800000 + block #001, object at 0x55d5c113f7a0 under 0x55d5c113f860, 3 syms/buckets in 0x83800000..0x83800000 + struct kilopages { + pagemask_t page[64]; + }; + + struct gigapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct megapages mega[512]; + }; + + struct terapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct gigapages giga[512]; + }; + + typedef char lockbit_t; + struct megapages { + lockbit_t lockbit[64]; + pagemask_t empty[64]; + pagemask_t full[64]; + struct kilopages kilo[512]; + }; + + struct mm_pagearr_info { + short int tera_num; + struct terapages *tera_top; + short int giga_num; + struct gigapages *giga_top; + short int mega_num; + struct megapages *mega_top; + short int kilo_num; + struct kilopages *kilo_top; + }; + + typedef short int short int; + typedef char pagemask_t; + typedef char char; + typedef long unsigned int long unsigned int; + +Compunit user: 0x55d5c115e2e0 + +Symtab for file arch/riscv/include/pages.h at 0x55d5c115e3c0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/main.c + + +Symtab for file include/apos/main.h at 0x55d5c115e420 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/main.c + + +Symtab for file include/apos/compiler_attributes.h at 0x55d5c115e450 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector same as owning compunit: arch/riscv/main.c + + +Symtab for file <artificial> at 0x55d5c115e2e0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Blockvector: + +block #000, object at 0x55d5c115dc10, 2 syms/buckets in 0x8380000a..0x8380000a + void init(void *, void *, void *, void *, void *); block object 0x55d5c1158ff0, 0x83800160..0x838002f4 section .init + void init_enter_vm(long unsigned int *); block object 0x55d5c115c820, 0x83800144..0x83800160 + long unsigned int init_align_down(size_t, size_t); block object 0x55d5c115cf00, 0x838000e4..0x83800116 + void init_zero(void *, size_t); block object 0x55d5c115da60, 0x8380000a..0x83800046 + void main(struct mm_pagearr_info *); block object 0x55d5c1159400, 0x43800000..0x4380000c section .init + void call_main(); block object 0x55d5c11595f0, 0x4380000c..0x43800018 section .init + long unsigned int init_align_up(size_t, size_t); block object 0x55d5c115cb50, 0x83800116..0x83800144 + struct page_ret { + size_t left; + size_t num; + void *top; + } init_pages(size_t, void *, size_t, size_t); block object 0x55d5c115d500, 0x83800046..0x838000e4 + block #001, object at 0x55d5c115db20 under 0x55d5c115dc10, 0 syms/buckets in 0x8380000a..0x8380000a + block #002, object at 0x55d5c1159400 under 0x55d5c115db20, 1 syms/buckets in 0x43800000..0x4380000c, function main + struct mm_pagearr_info { + short int tera_num; + struct terapages *tera_top; + short int giga_num; + struct gigapages *giga_top; + short int mega_num; + struct megapages *mega_top; + short int kilo_num; + struct kilopages *kilo_top; + } *pageinfo; computed at runtime + block #003, object at 0x55d5c11595f0 under 0x55d5c115db20, 0 syms/buckets in 0x4380000c..0x43800018, function call_main + block #004, object at 0x55d5c115da60 under 0x55d5c115db20, 3 syms/buckets in 0x8380000a..0x83800046, function init_zero + void *ptr; computed at runtime + long unsigned int bytes; computed at runtime + char *byte_ptr; computed at runtime + block #005, object at 0x55d5c115d500 under 0x55d5c115db20, 7 syms/buckets in 0x83800046..0x838000e4, function init_pages + long unsigned int ram_size; computed at runtime + void *ram_top; computed at runtime + long unsigned int page_size; computed at runtime + long unsigned int struct_size; computed at runtime + long unsigned int num_pages; computed at runtime + long unsigned int size_pages; computed at runtime + struct page_ret { + size_t left; + size_t num; + void *top; + } pageret; computed at runtime + block #006, object at 0x55d5c115cf00 under 0x55d5c115db20, 3 syms/buckets in 0x838000e4..0x83800116, function init_align_down + long unsigned int num; computed at runtime + long unsigned int a; computed at runtime + long unsigned int rem; computed at runtime + block #007, object at 0x55d5c115cb50 under 0x55d5c115db20, 2 syms/buckets in 0x83800116..0x83800144, function init_align_up + long unsigned int num; computed at runtime + long unsigned int a; computed at runtime + block #008, object at 0x55d5c115c820 under 0x55d5c115db20, 1 syms/buckets in 0x83800144..0x83800160, function init_enter_vm + long unsigned int *root_page; computed at runtime + block #009, object at 0x55d5c1158ff0 under 0x55d5c115db20, 9 syms/buckets in 0x83800160..0x838002f4, function init + void *ram_base; computed at runtime + void *ram_top; computed at runtime + void *initrd; computed at runtime + void *fdt; computed at runtime + void *boot; computed at runtime + long unsigned int ram_size; computed at runtime + struct mm_pagearr_info { + short int tera_num; + struct terapages *tera_top; + short int giga_num; + struct gigapages *giga_top; + short int mega_num; + struct megapages *mega_top; + short int kilo_num; + struct kilopages *kilo_top; + } pagearr; computed at runtime + struct page_ret { + size_t left; + size_t num; + void *top; + } pageret; computed at runtime + long unsigned int *root_page; computed at runtime + +Compunit include: 0x55d5c115e3f0 +Compunit include: 0x55d5c113f9f0 + +Symtab for file arch/riscv/main.c at 0x55d5c11185d0 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Line table: + + line 5 at 0x43800000 (stmt) + line 0 at 0x4380000c (stmt) + line 0 at 0x4380000c (stmt) + line 0 at 0x8380000a (stmt) + +Blockvector same as owning compunit: <artificial> + + +Symtab for file arch/riscv/init/init.c at 0x55d5c1118600 +Compilation directory is /home/kimi/Documents/Projects/aposkern +Read from object file /home/kimi/Documents/Projects/aposkern/kernel.debug (0x55d5c11488f0) +Language: c + +Line table: + + line 63 at 0x4380000c (stmt) + line 64 at 0x43800012 (stmt) + line 0 at 0x43800018 (stmt) + line 16 at 0x8380000a (stmt) + line 16 at 0x8380000a (stmt) + line 17 at 0x83800018 (stmt) + line 24 at 0x83800022 (stmt) + line 24 at 0x8380002e (stmt) + line 23 at 0x83800032 (stmt) + line 23 at 0x8380003e (stmt) + line 25 at 0x83800040 (stmt) + line 29 at 0x83800046 (stmt) + line 30 at 0x83800062 (stmt) + line 31 at 0x83800072 (stmt) + line 34 at 0x83800082 (stmt) + line 34 at 0x83800090 (stmt) + line 35 at 0x83800094 (stmt) + line 36 at 0x8380009c (stmt) + line 36 at 0x838000a8 (stmt) + line 36 at 0x838000b0 (stmt) + line 38 at 0x838000b4 (stmt) + line 40 at 0x838000c2 (stmt) + line 41 at 0x838000d8 (stmt) + line 44 at 0x838000e4 (stmt) + line 45 at 0x838000f2 (stmt) + line 46 at 0x83800102 (stmt) + line 47 at 0x8380010e (stmt) + line 50 at 0x83800116 (stmt) + line 51 at 0x83800126 (stmt) + line 51 at 0x83800134 (stmt) + line 52 at 0x8380013a (stmt) + line 55 at 0x83800144 (stmt) + line 56 at 0x8380014e (stmt) + line 60 at 0x8380015a (stmt) + line 67 at 0x83800160 (stmt) + line 68 at 0x8380017c (stmt) + line 68 at 0x83800188 (stmt) + line 74 at 0x8380018c (stmt) + line 76 at 0x838001ac (stmt) + line 76 at 0x838001b0 (stmt) + line 77 at 0x838001bc (stmt) + line 77 at 0x838001c0 (stmt) + line 79 at 0x838001c4 (stmt) + line 81 at 0x838001f8 (stmt) + line 81 at 0x838001fc (stmt) + line 82 at 0x83800208 (stmt) + line 82 at 0x8380020c (stmt) + line 84 at 0x83800210 (stmt) + line 86 at 0x83800242 (stmt) + line 86 at 0x83800246 (stmt) + line 87 at 0x83800252 (stmt) + line 87 at 0x83800256 (stmt) + line 89 at 0x8380025a (stmt) + line 91 at 0x8380028a (stmt) + line 91 at 0x8380028e (stmt) + line 92 at 0x8380029a (stmt) + line 92 at 0x8380029e (stmt) + line 95 at 0x838002a2 (stmt) + line 95 at 0x838002a6 (stmt) + line 95 at 0x838002b0 (stmt) + line 94 at 0x838002b4 (stmt) + line 100 at 0x838002b8 (stmt) + line 100 at 0x838002c0 (stmt) + line 100 at 0x838002c4 (stmt) + line 100 at 0x838002ce (stmt) + line 100 at 0x838002d2 (stmt) + line 104 at 0x838002d4 (stmt) + line 107 at 0x838002dc (stmt) + line 110 at 0x838002e4 (stmt) + line 111 at 0x838002ec (stmt) + line 0 at 0x838002f4 (stmt) + +Blockvector same as owning compunit: <artificial> + diff --git a/init.debug b/init.debug Binary files differnew file mode 100644 index 0000000..fb09633 --- /dev/null +++ b/init.debug diff --git a/kernel.a b/kernel.a Binary files differnew file mode 100644 index 0000000..30b9249 --- /dev/null +++ b/kernel.a diff --git a/kernel.its b/kernel.its new file mode 100644 index 0000000..f984d40 --- /dev/null +++ b/kernel.its @@ -0,0 +1,34 @@ +/dts-v1/; + +/ { + description = "FUCK"; +#address-cells = <1>; + + images { + kernel { + description = "My default kenel"; + data = /incbin/("kernel.bin"); + type = "kernel"; + arch = "riscv"; + os = "apos"; + compression = "none"; + load = <0x83800000>; + entry = <0x83800000>; + hash-1 { + algo = "md5"; + }; + }; + + }; + + configurations { + default = "config"; + + config { + description = "Default configuration"; + kernel = "kernel"; + }; + + + }; +}; |
