Skip to content

Precompile boot? #5

Open
Open
@liamwhite

Description

@liamwhite

Since this bootloader is already non-generic, it would make sense to reduce the amount of assembler code in it by:

  • Compiling the kernel setup_sects constant into the assembler, eliminates:
  mov  ax, 1      ; one sector
  xor  bx, bx     ; offset 0
  mov  cx, 0x1000 ; seg
  call hddread

read_kernel_setup:
  mov  al, [es:0x1f1] ; # of sectors
  cmp  ax, 0
  jne  read_kernel_setup.next
  mov  ax, 4 ; default is 4
  • Performing the boot type check at compile time, eliminates:
  cmp  word [es:0x206], 0x204
  jb   err
  test byte [es:0x211], 1
  jz   err
  • Inserting the necessary values into the kernel header at compile time, eliminates:
  mov  byte  [es:0x210], 0xe1     ; type_of_loader
  mov  byte  [es:0x211], 0x81     ; CAN_USE_HEAP | LOADED_HIGH
  mov  word  [es:0x224], 0xde00   ; head_end_ptr
  mov  byte  [es:0x227], 0x1      ; ext_loader_type
  mov  dword [es:0x228], 0x1e000  ; kernel cmdline

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions