Strange problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
finarfin
Member
Member
Posts: 106
Joined: Fri Feb 23, 2007 1:41 am
Location: Italy & Ireland
Contact:

Re: Strange problem

Post by finarfin »

Surfing into the wiki, i noticed that page: http://wiki.osdev.org/Bran%27s_Known_Bugs

And the bug reported is:
As soon as I add strings, things go wrong.
So it seems to be something related to my problem, i'm not sure if my problem are the strings or not. But the fact is that every printf into a specific function, or every function call that involves a string (with variable, o simply defined with "...") i tried to use it's solution, that is to change the linker script:

Code: Select all

OUTPUT_FORMAT("binary")
ENTRY(start)
phys = 0x00100000;
SECTIONS
{
  .text phys : AT(phys) {
    code = .;
    *(.text)
    *(.rodata)
    . = ALIGN(4096);
  }
  .data : AT(phys + (data - code))
  {
    data = .;
    *(.data)
    . = ALIGN(4096);
  }
  .bss : AT(phys + (bss - code))
  {
    bss = .;
    *(.bss)
    . = ALIGN(4096);
  }
  end = .;
}
Now everything works fine, but i don't know if it is a solution because now my kernel is only 79906 bytes. And the problem usually happens at 84157 bytes.
Elen síla lúmenn' omentielvo
- DreamOS64 - My latest attempt with osdev: https://github.com/dreamos82/Dreamos64
- Osdev Notes - My notes about osdeving! https://github.com/dreamos82/Osdev-Notes
- My old Os Project: https://github.com/dreamos82/DreamOs
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: Strange problem

Post by gerryg400 »

Now everything works fine, but i don't know if it is a solution because now my kernel is only 79906 bytes. And the problem usually happens at 84157 bytes
You must inspect the generated code to find out. You will see what was wrong before and why your change fixed it.

We have a very strict rule where I work that a bug report cannot be closed until the fix is entirely explained. Even if the fix is a bi-product of another change.
If a trainstation is where trains stop, what is a workstation ?
Post Reply