Kernel image size calculation corrected

This commit is contained in:
Adrien Bourmault 2019-05-11 22:26:40 +02:00
parent d7abbcf608
commit 39091a44c1
3 changed files with 16 additions and 13 deletions

View File

@ -152,8 +152,9 @@
│   │   ├── strtol.d │   │   ├── strtol.d
│   │   └── strtol.o │   │   └── strtol.o
│   ├── grub.log │   ├── grub.log
│   ├── kernel.ld │   ├── kaleid32_disasm.asm
│   └── qemu.log │   ├── kaleid64_disasm.asm
│   └── kernel.ld
├── include ├── include
│   ├── base │   ├── base
│   │   ├── assert.h │   │   ├── assert.h
@ -258,4 +259,4 @@
├── ProjectTree ├── ProjectTree
└── README.md └── README.md
41 directories, 192 files 41 directories, 193 files

View File

@ -25,6 +25,7 @@
[BITS 32] [BITS 32]
extern kernelEnd extern kernelEnd
extern _bss
global newKernelEnd global newKernelEnd
global realKernelEnd global realKernelEnd
@ -32,6 +33,7 @@ global realKernelEnd
KERNEL_STACK equ kernelEnd + 4096 * 2 * 1024 ; 8MB of stack KERNEL_STACK equ kernelEnd + 4096 * 2 * 1024 ; 8MB of stack
newKernelEnd dq 0x0 newKernelEnd dq 0x0
realKernelEnd dq 0x0 realKernelEnd dq 0x0
[section .rodata] [section .rodata]
;; GDT WITH DOC ;; GDT WITH DOC
ALIGN 4096 ALIGN 4096
@ -52,7 +54,7 @@ GDT64:
dq GDT64 dq GDT64
;; EMPTY PAGE TABLES (identity of the first 1GiB) ;; EMPTY PAGE TABLES (identity of the first 4GiB)
[section .bss] [section .bss]
ALIGN 4096 ALIGN 4096
PML4_table: PML4_table:

View File

@ -29,14 +29,14 @@ ENTRY(MB_start) /* the name of the entry label */
SECTIONS { SECTIONS {
. = 0x00100000; /* the code should be loaded at 1 MB */ . = 0x00100000; /* the code should be loaded at 1 MB */
.boot ALIGN (0x1000) : /* align at 4 KB */ .boot ALIGN (0x1000) :
{ {
*(.multiboot) *(.multiboot)
} }
.text ALIGN (0x1000) : /* align at 4 KB */ .text ALIGN (0x1000) :
{ {
*(.text) /* all text sections from all files */ *(.text)
} }
.data ALIGN (0x1000) : .data ALIGN (0x1000) :
@ -51,19 +51,19 @@ SECTIONS {
*(.eh_frame) *(.eh_frame)
} }
.bss ALIGN (0x1000) : /* align at 4 KB */ .rodata ALIGN (0x1000) :
{ {
*(.bss) /* all bss sections from all files */ *(.rodata)
} }
.rodata ALIGN (0x1000) : /* align at 4 KB */ .bss ALIGN (0x1000) :
{ {
*(.rodata) /* all rodata sections from all files */ *(.bss)
} }
/DISCARD/ : /DISCARD/ :
{ {
*(.comment) *(.comment)
} }
kernelEnd = .; kernelEnd = .;