Hi,
I am writing a new kernel and is at very early stage of development.
I have attached the MY.img file as a reference for the help that i am seeking.
after puts("LILLYPUTS Loading I/O system...\r\n"); is called i supposed the to execute monitor_clear();
But it is not executing the same. [ pasted below is code sequence ]
while i have debugged on what is happening.., i have observed is the corresponding call instruction is branching just 2 bytes before where monitor_clear() corresponding object is resided in the object file.
In essence,
(0) [0x000400e4] 4000:00e4 (unk. ctxt): call .+0x02c2 (0x000403a9) ; e8c202 --> this referring to an offset of 5a9, but the monitor_clear code is at 5ab.
because of that my monitor_clear() is not picking up.
any suggetions or help is greatly appreciated.
The corresponding source code is :
void setup(void)
{
puts("-----LILLYPUTS Kernel Setup -----\r\n");
puts("LILLYPUTS krnl_level=1\r\n");
puts("LILLYPUTS Loading I/O system...\r\n");
//ch=sayhi();
//ch=getch();
>>>> monitor_clear(); <<<<<<<<<<<<<<<<<<<<<<<
monitor_write("Hello, world!");
puts("LILLYPUTS - DEBUG: HALT\r\n");
/* developing and error goes here... */
here:
goto here;
return;
}
(0) [0x000400d7] 4000:00d7 (unk. ctxt): push 0x0064 ; 686400
<bochs:58> n
Next at t=14419105
(0) [0x000400da] 4000:00da (unk. ctxt): add byte ptr ds:[bx+si], al ; 0000
<bochs:59>
Next at t=14419106
(0) [0x000400dc] 4000:00dc (unk. ctxt): call .+0x036f (0x0004044e) ; e86f03
<bochs:60>
Next at t=14449555
(0) [0x000400df] 4000:00df (unk. ctxt): add byte ptr ds:[bx+si], al ; 0000
<bochs:61>
Next at t=14449556
(0) [0x000400e1] 4000:00e1 (unk. ctxt): add sp, 0x0010 ; 83c410
<bochs:62>
Next at t=14449557
(0) [0x000400e4] 4000:00e4 (unk. ctxt): call .+0x02c2 (0x000403a9) ; e8c202
<bochs:63> s
Next at t=14449558
(0) [0x000403a9] 4000:03a9 (unk. ctxt): leave ; c9
<bochs:64>
LD not giving correct references to the function
-
- Posts: 7
- Joined: Tue Nov 20, 2012 8:25 am
LD not giving correct references to the function
- Attachments
-
- file_to_wikidev.zip
- My Imge file and consistuent binaries
- (5.37 KiB) Downloaded 21 times
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: LD not giving correct references to the function
You forgot a switch to protected mode.
-
- Posts: 7
- Joined: Tue Nov 20, 2012 8:25 am
Re: LD not giving correct references to the function
i value your comment.
But , to understand more on that, how can the protected mode change can bring in the correct relocation of symbols by LD?
Thanks
Regards,
-Raveendra
But , to understand more on that, how can the protected mode change can bring in the correct relocation of symbols by LD?
Thanks
Regards,
-Raveendra
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: LD not giving correct references to the function
Your key mistake is that you blame the tools in the first place. For instance:
In other words, as long as the CPU is in the wrong mode, it will not execute the code you think you created, but something looking something vaguely similar.
Is actually the 16-bit interpretation of the following 32-bit code the compiler actually created:(0) [0x000400d7] 4000:00d7 (unk. ctxt): push 0x0064 ; 686400
(0) [0x000400da] 4000:00da (unk. ctxt): add byte ptr ds:[bx+si], al ; 0000
Code: Select all
push dword 0x64 ; 6864000000