Higher Half x86 Bare Bones: Difference between revisions

m
Bot: Replace deprecated source tag with syntaxhighlight
[unchecked revision][unchecked revision]
(Fix higher half kernel, GRUB won't load the old one)
m (Bot: Replace deprecated source tag with syntaxhighlight)
 
(10 intermediate revisions by 4 users not shown)
Line 38:
 
# Declare a multiboot header that marks the program as a kernel.
.section .multiboot.data, "aw"
.align 4
.long MAGIC
Line 62:
 
# The kernel entry point.
.section .multiboot.text, "a"
.global _start
.type _start, @function
Line 81:
1:
# Only map the kernel.
cmpl $(_kernel_start - 0xC0000000), %esi
jl 2f
cmpl $(_kernel_end - 0xC0000000), %esi
Line 161:
SECTIONS
{
. = 0x00100000;
/* The kernel will live at 3GB + 1MB in the virtual address space, */
/* which will be mapped to 1MB in the physical address space. */
/* Note that we page-align the sections. */
 
_kernel_start = .;
.multiboot.data : {
*(.multiboot.data)
Line 174 ⟶ 175:
}
 
. += 0xC01000000xC0000000;
/* Add a symbol that indicates the start address of the kernel. */
_kernel_start = .;
.text ALIGN (4K) : AT (ADDR (.text) - 0xC0000000)
{
Line 203:
 
Use [[Bare_Bones#Writing_a_kernel_in_C|kernel.c from Bare Bones]] with the following change. In boot.s we reserved the 1024th page for the VGA text buffer. This corresponds to virtual address 0xC03FF000. Change the initialization of <tt>terminal_buffer</tt> to:
<sourcesyntaxhighlight lang="c">
terminal_buffer = (uint16_t*) 0xC03FF000;
</syntaxhighlight>
</source>
 
[[Category:Kernel]]
[[Category:Bare bones tutorials|Higher Half bare bones]]