diff --git a/src/Main.cc b/src/Main.cc index 8cc41c8..cd8a93f 100644 --- a/src/Main.cc +++ b/src/Main.cc @@ -22,6 +22,9 @@ #error "This file should be compiled with an ix86-elf compiler!" #endif +extern u32 kernelStart; +extern u32 kernelEnd; + /** The beginning of the world... */ extern "C" @@ -37,6 +40,12 @@ kmain(multiboot::Information *information, auto& console = kernel.console(); + auto start = u32(&kernelStart); + auto end = u32(&kernelEnd); + console.printFormat("Kernel start: 0x%08lX\n", start); + console.printFormat("Kernel end: 0x%08lX\n", end); + console.printFormat("Kernel size: %ld bytes\n", end - start); + console.printFormat("Command line: \"%s\"\n", info->commandLine()); console.printFormat("Memory map:\n"); diff --git a/src/linker.ld b/src/linker.ld index a7cde30..1286a66 100644 --- a/src/linker.ld +++ b/src/linker.ld @@ -7,6 +7,8 @@ SECTIONS /* Begin putting sections at 1 MiB, a conventional place for kernels to be loaded at by the bootloader. */ . = 1M; + kernelStart = .; + /* First put the multiboot header, as it is required to be put very early in the image or the bootloader won't recognize the file format. Next we'll put the .text section. */ .text BLOCK(4K) : ALIGN(4K) { @@ -39,4 +41,5 @@ SECTIONS } /* The compiler may produce other sections, by default it will put them in a segment with the same name. Simply add stuff here as needed. */ + kernelEnd = ALIGN(4K); }