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.
__shutdown.o(.text+0x1e):__shutdown.o: relocation truncated to fit: 16 .text
ld doesn't do 16-bit relocations. Now you're in a tough situation, but at least it's the good situation.
Other side of the summary, I personally think LD does do 16-bit relocations, but you relocate above 0xFFFF, which doesn't fit. If your segment (real-mode) ends in 000, the truncation doesn't matter. For instance, if this code is at 0x20000, the relocation would go to 0x20357, which is now truncated to 0x0357 because the 2 cannot fit in. Since you jump to 0x357:0x2000, you do get the right place. That's truncating.
what should / could i do? should i convert the address of the jumpmark: real_mode, to a splittet address? Do you have a complete sample code how I can return to real mode in this situation?
ich_will wrote:
what should / could i do? should i convert the address of the jumpmark: real_mode, to a splittet address? Do you have a complete sample code how I can return to real mode in this situation?
You're doing the right thing. The only thing is that you try to jump outside of the 16-bit realmode segment you can jump to, and LD indicates that it kicks out the upper part of the offset. If your link & load address(es) are on 64k boundaries, you are all set, but LD complains that it is still losing the top half. You can load the code to 0x0000???? where LD would not lose anything. I /THINK/ that fixes it.
And Candy, could he use inline assembly, or not ?
He could use (because he's in p.mode) the 66h prefix, or am I missing something ?
(I don't know the code, but I THINK it works)
that means if my kernel is loaded to 0x100000 than i've to load this few functions to an address between 0x0000 and 0xFFFF and jump to this address. am I right?
if your 16 bits code is self-sufficient, i suggest you assemble it apart as a binary file and then include raw bits of it at the proper place in your kernel (that must be the %incbin directive of nasm, or something alike
Pseudo-instructions are things which, though not real x86 machine instructions, are used in the instruction field anyway because that's the most convenient place to put them. The current pseudo-instructions are DB, DW, DD, DQ and DT, their uninitialised counterparts RESB, RESW, RESD, RESQ and REST, the INCBIN command, the EQU command, and the TIMES prefix.
Hmm, be sure you jump correctly, because it's assigned to 0x18.
And for some reason the base is 0x180, why that ?
Do you change your IDT ? (supposed to be a GDT)
And please be sure you change the SS and SP (which isn't done by you )
<edit: There's a fault here, post the right answer /edit>