Code: Select all
mov al, 'A'
Code: Select all
mov al, 'A'
I'm not using a linker script at the moment ( but I tried one ), I guess I should be.. I'll try it out and post results.Tosi wrote:Loading a single character can be hardcoded into the code, such asIf you want to use strings, include the section .rodata in your linker script.Code: Select all
mov al, 'A'
Code: Select all
ENTRY (main)
SECTIONS{
. = 0x00100000;
.text :{
*(.text)
}
.rodata ALIGN (0x1000) : {
*(.rodata)
}
.data ALIGN (0x1000) : {
*(.data)
}
.bss : {
sbss = .;
*(COMMON)
*(.bss)
ebss = .;
}
}
You were loading your kernel @ 0x1000, right? So what is 0x100000 for?Davidm44 wrote:I'm not using a linker script at the moment ( but I tried one ), I guess I should be.. I'll try it out and post results.Tosi wrote:Loading a single character can be hardcoded into the code, such asIf you want to use strings, include the section .rodata in your linker script.Code: Select all
mov al, 'A'
Edit: The linker script I was using already had the .rodata section defined. I'm not sure if it's correct though, I got this from the osdev wiki.
Code: Select all
ENTRY (main) SECTIONS{ . = 0x00100000; .text :{ *(.text) } .rodata ALIGN (0x1000) : { *(.rodata) } .data ALIGN (0x1000) : { *(.data) } .bss : { sbss = .; *(COMMON) *(.bss) ebss = .; } }
Sorry for bumping & late reply, but changing 100000 to 1000 didn't do anything. Same output..Chandra wrote:You were loading your kernel @ 0x1000, right? So what is 0x100000 for?Davidm44 wrote:I'm not using a linker script at the moment ( but I tried one ), I guess I should be.. I'll try it out and post results.Tosi wrote:Loading a single character can be hardcoded into the code, such asIf you want to use strings, include the section .rodata in your linker script.Code: Select all
mov al, 'A'
Edit: The linker script I was using already had the .rodata section defined. I'm not sure if it's correct though, I got this from the osdev wiki.
Code: Select all
ENTRY (main) SECTIONS{ . = 0x00100000; .text :{ *(.text) } .rodata ALIGN (0x1000) : { *(.rodata) } .data ALIGN (0x1000) : { *(.data) } .bss : { sbss = .; *(COMMON) *(.bss) ebss = .; } }
Sorry about that, I fixed it now. I changed 10000 to 1000 as someone mentioned above and changed align to 4 instead of 1000. It was a complete shot in the dark but its working now.Chandra wrote:As far as I can hit stone in the darkness, there is some problem in the relocation. Since he is not using 'Cross Compiler', I guess one of the following might work out.
1. Change the entry point to kmain(which is your actual entry point as specified in your code) and not main(which you are using now).
2. Insert the output format "elf32-i386" in your linker script.
3. Since you are turning your kernel to flat binary anyway, you may tell the linker to do this job for you.This remove hassles for employing 'objcopy' to remove elf headers for you. And thus if the problem is relocation, this option might help.
4. Use the 'Cross Compiler'.
If none of this option helps in anyway, its time to do some debugging.