ecomaikgolf / alma

toy kernel written in C++ for x86-64 machines with the mere purpose of learning OS development
8 stars 1 forks source link

kernel ELF binary entry point is 0x0 #17

Closed ecomaikgolf closed 3 years ago

ecomaikgolf commented 3 years ago
[ecomaikgolf@desktop ../os-dev/build]$ readelf -a kernel.elf                              (0) [18:14:32]
Encabezado ELF:
  Mágico:  7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00
  Clase:                             ELF64
  Datos:                             complemento a 2, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  Versión ABI:                       0
  Tipo:                              EXEC (Fichero ejecutable)
  Máquina:                           Advanced Micro Devices X86-64
  Versión:                           0x1
  Dirección del punto de entrada:    0x0
ecomaikgolf commented 3 years ago

I think it just doesn't matter. Normally we have upper data but here .text section starts at 0x0 as we defined in kernel.ld

Putting . = 1M; before .text section in kernel.ld adds padding and consecuently moves the entry point, as expected.