include + update old linux targets/host.c

This commit is contained in:
2026-03-05 19:16:03 +01:00
parent 6ab17c98e9
commit e6237cc06e
10 changed files with 241 additions and 125 deletions

View File

@ -13,20 +13,41 @@
# checksum: -(magic+flags)
.long -(0x1BADB002 + 0x3)
# the initial kernel stack
.section .kernel_stack
.global os_stack
.size os_stack, 4096
# NOTE: New Start
# .section .gdt
# gdt_start:
# .quad 0x0000000000000000 # null descriptor
# .quad 0x00cf9a000000ffff # code segment descriptor: base=0, limit=4GB, 32-bit code
# .quad 0x00cf92000000ffff # data segment descriptor: base=0, limit=4GB, 32-bit data
# gdt_end:
#
# gdt_descriptor:
# .word gdt_end - gdt_start - 1 # limit
# .long gdt_start # base
#
# .section .idt
# idt_table:
# .space 256*8 # 256 entries x 8 bytes each
# idt_descriptor:
# .word 256*8-1 # limit
# .long idt_table # base
# NOTE: New End
#.Lstack_bottom:
os_stack:
.byte 0
#.skip 16384 # 16 KiB
.skip 4094 # 4 KiB
.byte 0
.Lstack_top:
.byte 0
.skip 65565 # 64 KiB
# .skip 16384 # 16 KiB
# .skip 4094 # 4 KiB
.byte 0
.Lstack_top:
# The linker script specifies _start as the entry point to the kernel and the
@ -36,7 +57,9 @@ os_stack:
.global _start
.type _start, @function
_start:
# Welcome to kernel mode!
# NOTE: Old Start
# Welcome to kernel mode!
# To set up a stack, we simply set the esp register to point to the top of
# our stack (as it grows downwards).
movl $.Lstack_top, %esp
@ -54,6 +77,34 @@ _start:
.Lhang:
jmp .Lhang
# NOTE: Old End
# NOTE: New Start
# cli
#
# lgdt gdt_descriptor # GDT
# lidt idt_descriptor # IDT Stub
#
# # set up segment registers (flat 32-bit)
# movw $0x10, %ax
# movw %ax, %ds
# movw %ax, %es
# movw %ax, %fs
# movw %ax, %gs
# movw %ax, %ss
# movl $.Lstack_top, %esp # set stack
#
# # call main C function
# call os_main
#
# cli
# hlt
# .Lhang:
# jmp .Lhang
# NOTE: New End
# Set the size of the _start symbol to the current location '.' minus its start.
# This is useful when debugging or when you implement call tracing.
.size _start, . - _start