Ada Bare Bones: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
m (Fix a typo, revert indentation for some comments to make the code readable.)
Line 418: Line 418:
.global startup # Make the startup entry point symbol visible to the linker
.global startup # Make the startup entry point symbol visible to the linker


# Setup the Multiboot header (see GRUB docs for details)
# Set up the Multiboot header (see GRUB docs for details)
.set ALIGN, 1<<0 # Align loaded modules on page boundaries
.set ALIGN, 1<<0 # Align loaded modules on page boundaries
.set MEMINFO, 1<<1 # Provide memory map
.set MEMINFO, 1<<1 # Provide memory map
Line 433: Line 433:
.long CHECKSUM
.long CHECKSUM


# Reserve initial kernel stack space
# Reserve initial kernel stack space
.set STACKSIZE, 0x4000 # 0x4000 being 16k.
.set STACKSIZE, 0x4000 # 0x4000 being 16k.
.lcomm stack, STACKSIZE # Reserve 16k stack on a doubleword (32bit) boundary
.lcomm stack, STACKSIZE # Reserve 16k stack on a doubleword (32bit) boundary
Line 444: Line 444:
movl $(stack + STACKSIZE), %esp # Set up the stack
movl $(stack + STACKSIZE), %esp # Set up the stack


# The following saves the contents of the registers as they will likely be
# The following saves the contents of the registers as they will likely be
# overwritten because main is not our actual entry point, Bare_Bones is. We
# overwritten because main is not our actual entry point, Bare_Bones is. We
# will use these 2 symbols inside Bare_Bones.
# will use these 2 symbols inside Bare_Bones.


movl %eax, magic # EAX indicates to the OS that it was loaded by a Multiboot-compliant boot
movl %eax, magic # EAX indicates to the OS that it was loaded by a Multiboot-compliant boot