We will only work in raw character mode for now, it's probably gonna take a *lot* of time until we have an actual VGA driver qwq
124 lines
2.8 KiB
ArmAsm
124 lines
2.8 KiB
ArmAsm
/* See the end of this file for copyright and license terms. */
|
|
|
|
#include <asm/common.h>
|
|
#include <gay/config.h>
|
|
#include <multiboot.h>
|
|
|
|
/* see arch/x86/config/kernel.ld */
|
|
.extern _kernel_end
|
|
.extern _image_end
|
|
.extern _stack_end
|
|
|
|
.extern _boot
|
|
|
|
.section .multiboot
|
|
|
|
mb2_load_start:
|
|
|
|
.align MB2_HEADER_ALIGN
|
|
header_start: /* struct mb2_header */
|
|
/* magic */
|
|
.long MB2_HEADER_MAGIC
|
|
/* architecture */
|
|
.long MB2_ARCHITECTURE_I386
|
|
/* heaer_length */
|
|
.long header_end - header_start
|
|
/* checksum */
|
|
.long (1 << 33) - MB2_HEADER_MAGIC - MB2_ARCHITECTURE_I386 - (header_end - header_start)
|
|
|
|
.align MB2_TAG_ALIGN
|
|
address_tag_start: /* struct mb2_header_tag_address */
|
|
/* type */
|
|
.short MB2_HEADER_TAG_ADDRESS
|
|
/* flags */
|
|
.short MB2_HEADER_TAG_OPTIONAL
|
|
/* size */
|
|
.long address_tag_end - address_tag_start
|
|
/* header_addr */
|
|
.long header_start
|
|
/* load_addr */
|
|
.long mb2_load_start
|
|
/* load_end_addr */
|
|
.long _kernel_end
|
|
/* bss_end_addr */
|
|
.long _image_end
|
|
address_tag_end:
|
|
|
|
.align MB2_TAG_ALIGN
|
|
entry_address_tag_start: /* struct mb2_header_tag_entry_address */
|
|
/* type */
|
|
.short MB2_HEADER_TAG_ENTRY_ADDRESS
|
|
/* flags */
|
|
.short MB2_HEADER_TAG_OPTIONAL
|
|
/* size */
|
|
.long entry_address_tag_end - entry_address_tag_start
|
|
/* entry_addr */
|
|
.long _start
|
|
entry_address_tag_end:
|
|
|
|
#if 0 /* TODO: implement graphics */
|
|
.align MB2_TAG_ALIGN
|
|
framebuffer_tag_start: /* struct mb2_header_tag_framebuffer */
|
|
/* type */
|
|
.short MB2_HEADER_TAG_FRAMEBUFFER
|
|
/* flags */
|
|
.short MB2_HEADER_TAG_OPTIONAL
|
|
/* size */
|
|
.long framebuffer_tag_end - framebuffer_tag_start
|
|
/* width */
|
|
.long 1024
|
|
/* height */
|
|
.long 768
|
|
/* depth */
|
|
.long 32
|
|
framebuffer_tag_end:
|
|
#endif /* framebuffer disabled */
|
|
|
|
.align MB2_TAG_ALIGN
|
|
end_tag_start: /* struct mb2_header_tag */
|
|
/* type */
|
|
.short MB2_HEADER_TAG_END
|
|
/* flags */
|
|
.short 0
|
|
/* size */
|
|
.long end_tag_end - end_tag_start
|
|
end_tag_end:
|
|
|
|
header_end:
|
|
|
|
.text
|
|
|
|
asmfn_begin(_start)
|
|
mov $_stack_end, %esp
|
|
|
|
/* reset EFLAGS */
|
|
pushl $0
|
|
popf
|
|
|
|
/* parameter 2 for _boot() is header address */
|
|
push %ebx
|
|
/* parameter 1 for _boot() is MB2_BOOTLOADER_MAGIC */
|
|
push %eax
|
|
|
|
/* call _boot() from boot.c */
|
|
call _boot
|
|
|
|
/* this should never(TM) be reached */
|
|
halt_loop:
|
|
hlt
|
|
jmp halt_loop
|
|
asmfn_end(_start)
|
|
|
|
/*
|
|
* This file is part of GayBSD.
|
|
* Copyright (c) 2021 fef <owo@fef.moe>.
|
|
*
|
|
* GayBSD is nonviolent software: you may only use, redistribute, and/or
|
|
* modify it under the terms of the Cooperative Nonviolent Public License
|
|
* (CNPL) as found in the LICENSE file in the source code root directory
|
|
* or at <https://git.pixie.town/thufie/npl-builder>; either version 7
|
|
* of the license, or (at your option) any later version.
|
|
*
|
|
* GayBSD comes with ABSOLUTELY NO WARRANTY, to the extent
|
|
* permitted by applicable law. See the CNPL for details.
|
|
*/
|