stage4_load.asm

The bootstrap user module

Although replacing this module with another can allow the user to run an effectively different operating system, this is currently the default.

Checks and loads all modules present in the ramdisk and starts each of them

Author

Marcel Sondaar

License

Educational purposes

Summary
stage4_load.asmThe bootstrap user module
Functions
initcombuffer
loadunittable
ELF_StartLoads an elf file and start it
ELF_LoadParses an elf file in memory
ELF_LoadsectionParses an elf section and loads it into memory
ELF_AdjustsectionParses an elf relocation section and loads it into memory
ELF_CopysectionCopies a section from an ELF file to newly allocated memory
ELF_AllocSectionParses an elf bss section header, allocates it and zeroes it
Todo’s
get task entry point and create threads for all modules
Fixmes
create a thread rather than bruteforce starting thingskernel CreateThread

Functions

initcombuffer

loadunittable

ELF_Start

Loads an elf file and start it

in

  • EBX = pointer to file in memory
  • EAX = length of file

out

none

destroyed

unknown

ELF_Load

Parses an elf file in memory

in

  • EBX = pointer to file in memory
  • EAX = length of file

out

  • EBX = address of entry point

destroyed

unknown (all but ESP)

ELF_Loadsection

Parses an elf section and loads it into memory

in

  • EBX = image offset
  • EDX = current section header offset
  • ECX = current section index

out

unknown

destroyed

unknown

ELF_Adjustsection

Parses an elf relocation section and loads it into memory

in

  • EBX = image offset
  • EDX = current section header offset

out

unknown

destroyed

unknown

ELF_Copysection

Copies a section from an ELF file to newly allocated memory

in

  • EBX = image offset
  • EDX = current section header offset
  • ECX = current section index

out

unknown

destroyed

EAX, EDI

ELF_AllocSection

Parses an elf bss section header, allocates it and zeroes it

in

  • EBX = image offset
  • EDX = current section header offset
  • ECX = current section index

out

unknown

destroyed

EAX, ECX, EDI

Todo’s

get task entry point and create threads for all modules

Fixmes

create a thread rather than bruteforce starting things

kernel CreateThread