Hallo,
ich habe ein Problem mit meinem Linker.
Ich habe mir zwei eigene Sektionen definiert (preboot und boot) und möchte in die boot-Sektion den Multiboot-Header geladen haben.
Leider funktioniert das nicht so ganz und ich weiß nicht warum.
Hier mein Linker-Skript:
Hier meine Multiboot-Datei:
Wenn ich mir nun meine boot-Sektion mir readelf oder objdump anschaue, steht dort nur sinnloses Zeug.
Ausgabe von objdump:
mbchk sagt natürlich, dass es keine Multiboot-Header finden konnte.
Woran kann das Problem liegen?
Danke.
Gruß
rizor
ich habe ein Problem mit meinem Linker.
Ich habe mir zwei eigene Sektionen definiert (preboot und boot) und möchte in die boot-Sektion den Multiboot-Header geladen haben.
Leider funktioniert das nicht so ganz und ich weiß nicht warum.
Hier mein Linker-Skript:
Code: [Auswählen]
/* the linker script to link the kernel */
ENTRY(_start) /* the entry-point of the kernel */
OUTPUT_FORMAT(elf32-i386) /* the output-format */
/* some constants to link the code correctly */
ALIGNMENT = 0x1000; /* the alignment of the sections */
PHYS_ADDRESS = 0x100000; /* the physical address of the kernel */
VIRT_ADDRESS = 0x100000; /* the virtual address of the kernel */
REMAP_OFFSET = VIRT_ADDRESS - PHYS_ADDRESS; /* the offset between physical and virtual addresses */
/* define the different sections of the kernel */
SECTIONS
{
. = VIRT_ADDRESS; /* move the kernel to the correct start-address */
__kernel_virt_entry = .; /* the beginning with virtual addresses */
__kernel_phys_entry = . - REMAP_OFFSET; /* the beginning with physical addresses */
.preboot : AT(ADDR(.preboot) - (REMAP_OFFSET + 0x1000))
{
__preboot_entry = .; /* the entry-symbol to get the space of the preboot-section */
*(.preboot)
__preboot_end = .; /* the end-symbol to get the space of the preboot-section */
}
. = ALIGN(ALIGNMENT);
.boot : AT(ADDR(.boot) - REMAP_OFFSET)
{
__boot_entry = .; /* the entry-symbol of the boot-section */
*(.boot)
__boot_end = .; /* the end-symbol of the boot-section */
}
. = ALIGN(ALIGNMENT);
.init : AT(ADDR(.init) - REMAP_OFFSET)
{
__init_entry = .; /* the entry-symbol of the init-section */
*(.init)
__init_end = .; /* the end-symbol of the init-section */
}
. = ALIGN(ALIGNMENT);
.text : AT(ADDR(.text) - REMAP_OFFSET)
{
__ro_data_entry = .; /* the entry-symbol of the read-only-section */
*(.text)
*(.rodata)
__ro_data_end = .; /* the end-symbol of the read-only-section */
}
. = ALIGN(ALIGNMENT);
.data : AT(ADDR(.data) - REMAP_OFFSET)
{
__rw_data_entry = .; /* the entry-symbol of the read-write-sections */
*(.data)
*(.bss)
__rw_data_end = .; /* the end-symbol of the read-write-sections */
}
. = ALIGN(ALIGNMENT);
__kernel_phys_end = . - REMAP_OFFSET; /* the end of the physical addresses */
__kernel_virt_end = .; /* the end of the virtual addresses */
}
Hier meine Multiboot-Datei:
Code: [Auswählen]
.section .boot
// the following flags are every time set
#define MB_MAGIC 0x1badb002
/*
* MB_FLAGS[0] == load modules 4k-aligned
* MB_FLAGS[1] == calculate mbs_mem_lower,mbs_mem_upper and mbs_mmap_length, mbs_mmap_addr if possible
* MB_FLAGS[2] == load some informations about the video-mode into the multiboot-structure
* MB_FLAGS[16] == calculates some informations about the kernel-image
*/
#define MB_FLAGS 0x8007
#define MB_CHECKSUM -(MB_MAGIC + MB_FLAGS)
// the following flags are defined, if MB_FLAGS[16] is set
#define MB_HEADER_ADDR 0x0
#define MB_LOAD_ADDR 0x0
#define MB_LOAD_END_ADDR 0x0
#define MB_BSS_END_ADDR 0x0
#define MB_ENTRY_ADDR 0x0
// the following flags are defined, if MB_FLAGS[2] is set
#define MB_MODE_TYPE 0x0
#define MB_MODE_WIDTH 0x0
#define MB_MODE_HEIGHT 0x0
#define MB_MODE_DEPTH 0x0
.align 4
.int MB_MAGIC
.int MB_FLAGS
.int MB_CHECKSUM
.int MB_HEADER_ADDR
.int MB_LOAD_ADDR
.int MB_LOAD_END_ADDR
.int MB_BSS_END_ADDR
.int MB_ENTRY_ADDR
.int MB_MODE_TYPE
.int MB_MODE_WIDTH
.int MB_MODE_HEIGHT
.int MB_MODE_DEPTH
Wenn ich mir nun meine boot-Sektion mir readelf oder objdump anschaue, steht dort nur sinnloses Zeug.
Ausgabe von objdump:
Code: [Auswählen]
Disassembly of section .boot:
00100000 <__boot_entry>:
100000: 02 b0 ad 1b 07 80 add -0x7ff8e453(%eax),%dh
100006: 00 00 add %al,(%eax)
100008: f7 (bad)
100009: cf iret
10000a: 51 push %ecx
10000b: e4 00 in $0x0,%al
mbchk sagt natürlich, dass es keine Multiboot-Header finden konnte.
Woran kann das Problem liegen?
Danke.
Gruß
rizor

Übersicht
Wiki
Hilfe
Suche
Einloggen
Registrieren
Drucken

Gespeichert
