You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
1.7 KiB
ArmAsm

/* Copyright (C) 2021,2022 fef <owo@fef.moe>. All rights reserved. */
#include <asm/common.h>
#include <gay/config.h>
#include <arch/multiboot.h>
#include <arch/page.h>
.code32
/* see ../config/kernel{32,64}.ld */
.extern _image_start_phys
.extern _kernel_end_phys
.extern _image_end_phys
.extern _setup /* setup{32,64}.S */
.section .multiboot.data, "a", @progbits
.align MB2_HEADER_ALIGN
.global header_start
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 << 32) - MB2_HEADER_MAGIC - MB2_ARCHITECTURE_I386 - (header_end - header_start)
#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:
.size header_start, . - header_start
/*
* So, this is weird.
* For some reason, the multiboot header is omitted in the compiled
* binary if the entry point isn't in the same file (i've tried way
* too many times). But, since the header is the same for both i386
* and amd64, we simply add this wrapper.
*/
.section .multiboot.text, "ax", @progbits
ASM_ENTRY(_start)
cli
jmp _setup
ASM_END(_start)