ASSEMBLER HELP

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.
123abc

Re:ASSEMBLER HELP

Post by 123abc »

You need [bits 32] before your IDT?
Unexpected

Re:ASSEMBLER HELP

Post by Unexpected »

[BITS 32] is wrote...
But when I compile to BINARY format it works.
What's the problem?
123abc

Re:ASSEMBLER HELP

Post by 123abc »

I read you CANNOT compile this IDT into anyother format than binary :o
Unexpected

Re:ASSEMBLER HELP

Post by Unexpected »

But later I linking my source with kernel to binary.
And how I call C kernel main?
Curufir

Re:ASSEMBLER HELP

Post by Curufir »

If you're using the example IDT I think you're using then the problems with linking it have been made clear in other threads.

To reiterate. When linking into something that isn't binary it breaks down because the relocation addresses are 32-bits, the IDT has 2 entries for the physical address of the code to be called. The example only uses the lower 16-bits and sets the upper 16-bit to be zero. The linker doesn't work because it has difficulty putting a 32-bit label into a 16-bit space (Because it doesn't know it is a 16-bit space). This is why this particular IDT example ONLY works with flat binaries. For any other format you need to split the address of the code into the lower and upper 16-bits somehow (Many thanks to Intel for not making this easy by having it as a single 32-bit value :)).
Unexpected

Re:ASSEMBLER HELP

Post by Unexpected »

Thnx for help ;)

But there is another problem.
When I compiling my asm source in flat bin format I can'y use my kernel.c functions (binary output format does not support external references)
How I can call C function from another file or create global variable?
Unexpected

Re:ASSEMBLER HELP

Post by Unexpected »

Can anyone show to me full IDT source? Please?
I need an example
Post Reply