[docs] Commenting...

This commit is contained in:
Kevin Lange 2011-03-04 18:18:14 -06:00
parent 0b3ecfd4e4
commit e26c53dfc0
3 changed files with 56 additions and 25 deletions

View File

@ -1,27 +1,45 @@
/*
* Kernel linker script for x86
*/
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
/*
* Actual code
*/
.text phys : AT(phys) {
code = .;
*(.text)
*(.rodata)
. = ALIGN(4096);
}
/*
* Kernel data
*/
.data : AT(phys + (data - code))
{
data = .;
*(.data)
. = ALIGN(4096);
}
/*
* Statically defined, uninitialized values
*/
.bss : AT(phys + (bss - code))
{
bss = .;
*(.bss)
. = ALIGN(4096);
}
/*
* End of kernel.
*/
end = .;
/*
* Get rid of unnecessary GCC bits.
*/
/DISCARD/ :
{
*(.comment)

View File

@ -62,15 +62,26 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
enum BOOTMODE boot_mode = unknown; /* Boot Mode */
char * ramdisk = NULL;
if (mboot_mag == MULTIBOOT_EAX_MAGIC) {
/*
* Multiboot (GRUB, native QEMU, PXE)
*/
boot_mode = multiboot;
/* Realign memory to the end of the multiboot modules */
/*
* Realign memory to the end of the multiboot modules
*/
kmalloc_startat(0x200000);
if (mboot_ptr->flags & (1 << 3)) {
/*
* Mboot modules are available.
*/
if (mboot_ptr->mods_count > 0) {
uint32_t module_start = *((uint32_t *) mboot_ptr->mods_addr);
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4);
ramdisk = (char *)kmalloc(module_end - module_start);
memcpy(ramdisk, (char *)module_start, module_end - module_start);
/*
* Ramdisk image was provided. (hopefully)
*/
uint32_t module_start = *((uint32_t *) mboot_ptr->mods_addr); /* Start address */
uint32_t module_end = *(uint32_t *) (mboot_ptr->mods_addr + 4); /* End address */
ramdisk = (char *)kmalloc(module_end - module_start); /* New chunk of ram for it. */
memcpy(ramdisk, (char *)module_start, module_end - module_start); /* Copy it over. */
}
}
} else {
@ -89,14 +100,14 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
init_video(); /* VGA driver */
/* Hardware drivers */
timer_install();
keyboard_install();
serial_install();
timer_install(); /* PIC driver */
keyboard_install(); /* Keyboard interrupt handler */
serial_install(); /* Serial console */
/* Memory management */
paging_install(mboot_ptr->mem_upper);
heap_install();
tasking_install();
paging_install(mboot_ptr->mem_upper); /* Paging */
heap_install(); /* Kernel heap */
tasking_install(); /* Multi-tasking */
/* Kernel Version */
settextcolor(12, 0);
@ -109,6 +120,9 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
dump_multiboot(mboot_ptr);
if (mboot_ptr->flags & (1 << 3)) {
/*
* If we have an initial ramdisk, mount it.
*/
if (mboot_ptr->mods_count > 0) {
initrd_mount((uintptr_t)ramdisk, 0);
}
@ -121,17 +135,8 @@ int main(struct multiboot *mboot_ptr, uint32_t mboot_mag, uintptr_t esp)
/*
* Aw man...
*/
fork();
#if 0
if (child == 0) {
kprintf("Hello world.\n");
} else {
kprintf("child: %d\tme: %d\n", child, getpid());
}
#endif
while (1) {
putch(48 + getpid());
}

View File

@ -1,27 +1,35 @@
; ToAruOS Start Up / Entry Point
; vim:syntax=nasm
; vim:tabstop=4
;
; Copyright 2011 ToAruOS Kernel Development Group
; See main.c for licensing terms (NCSA)
;
[BITS 32]
BITS 32
ALIGN 4
; Kernel Multiboot Headers
mboot:
; Multiboot headers:
; Page aligned loading, please
MULTIBOOT_PAGE_ALIGN equ 1<<0
; We require memory information
MULTIBOOT_MEMORY_INFO equ 1<<1
; We are multiboot compatible!
MULTIBOOT_HEADER_MAGIC equ 0x1BADB002
; Load up those flags.
MULTIBOOT_HEADER_FLAGS equ MULTIBOOT_PAGE_ALIGN | MULTIBOOT_MEMORY_INFO
; Checksum the result
MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
EXTERN code, bss, end
; GRUB Multiboot header, boot signature
; Load the headers into the binary image.
dd MULTIBOOT_HEADER_MAGIC
dd MULTIBOOT_HEADER_FLAGS
dd MULTIBOOT_CHECKSUM
; Some external references.
extern code, bss, end
; Main entrypoint
global start
start: