ASSEMBLER HELP
Re:ASSEMBLER HELP
[BITS 32] is wrote...
But when I compile to BINARY format it works.
What's the problem?
But when I compile to BINARY format it works.
What's the problem?
Re:ASSEMBLER HELP
But later I linking my source with kernel to binary.
And how I call C kernel main?
And how I call C kernel main?
Re:ASSEMBLER HELP
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 ).
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 ).
Re:ASSEMBLER HELP
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?
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?