Page 1 of 2

few questions

Posted: Fri Jul 13, 2007 6:42 am
by davidv1992
I have a few questions

first of all, when i have paging enabled, and an interupt occurs, is the address in the IDT a virtual one or a physical one?, and if it is a physical one, what happens if it's physical page doesn't correspond with the virtual page, or if it isn't in the virtual address space at all?

second, i think the windows xp dos prompt has a limit with how long your commands can be, cause it doesn't want to execute this

Code: Select all

ld -e _kentry -Ttext 0x1000 -o kernel.o Main\kentry.o Main\kmain.o "Interupt  Service System\cexception.o" "Interupt Service System\exception.o" "Interupt Service System\dummy.o" "Interupt Service System\IDT.o" "Interupt Service System\LIDT.o" "Interupt Service System\pic.o" "BSOD System\BSOD.o" "Shared\iflag.o" "Shared\string.o" "Shared\port.o"
is this normal behavior??

Posted: Fri Jul 13, 2007 6:55 am
by AndrewAPrice
Copy your objects all into a folder (e.g. obj for objects). And get your assembler to output to another extension (e.g. .ao) so your linker will link it first. Then call something like:

Code: Select all

ld -e _kentry -Ttext 0x1000 -o kernel.o kstart.ao obj/*.o

Posted: Fri Jul 13, 2007 7:04 am
by davidv1992
yay, that atleast makes my kernel compile again

Posted: Fri Jul 13, 2007 7:41 am
by XCHG
The CPU will ONLY fetch the start address of the handler procedure for a specific interrupt when that interrupt occurs, from the IDT. Then it will just JUMP to it (with/without some parameters). Now it is up to your paging mechanisms to determine if that address is virtual or not.

Posted: Fri Jul 13, 2007 10:33 am
by davidv1992
huh?

if i just have paging turned on, is the address translated by the mmu or not?

and i have some new questions

this gives an linker error (unresolved label: eax) (c code)

Code: Select all

__asm__ ("lidt eax" : : "a" (desc));
and i can't get my linker see labels i globalled in my assembler code
using nasm (outputting in coff) and dgjpp (whereas dgjpp's linker is used)

Posted: Fri Jul 13, 2007 12:57 pm
by frank
davidv1992 wrote:huh?

if i just have paging turned on, is the address translated by the mmu or not?
Yes
davidv1992 wrote: and i have some new questions

this gives an linker error (unresolved label: eax) (c code)

Code: Select all

__asm__ ("lidt eax" : : "a" (desc));
maybe try

Code: Select all

__asm__("lidt %%eax" : : "a" (desc)); 
or

Code: Select all

__asm__("lidt (%%eax)" : : "a" (desc)); 
You need the percent signs to separate the registers from labels that could be defined with the same name.
davidv1992 wrote: and i can't get my linker see labels i globalled in my assembler code
using nasm (outputting in coff) and dgjpp (whereas dgjpp's linker is used)
dgjpp automatically adds a underscore to all functions. Have you tried adding an underscore to all of the assembly functions/labels you are trying to export?

Posted: Fri Jul 13, 2007 1:08 pm
by davidv1992
yep, both don't work at all. this is the kind of error i get:

Code: Select all

IDT.o:IDT.c(.text+0x0) undefined reference to 'isrDummy'

Posted: Fri Jul 13, 2007 6:32 pm
by Brynet-Inc
Using local variables within inline-assembly will be problematic.. :wink:

You can access them via the stack pointer though.. I prefer not to give an example of this.

If isrDummy is global, your compiler may be emitting an underscore in front of it..

Try _isrDummy or simply use -fno-leading-underscore..

Posted: Fri Jul 13, 2007 8:56 pm
by frank
Is IsrDummy in your c files or your assembly files?

Posted: Fri Jul 13, 2007 11:21 pm
by davidv1992
isrDummy is in my assembler file. My linker only gives errors on labels exported from assembler files, not on those imported, meaning he eather resolves them or just does not recognize.

Posted: Sat Jul 14, 2007 9:22 am
by frank
You have

Code: Select all

global isrDummy
somewhere in your assembly file and you are included the assembly object (.o) file in the command to link the kernel right?

Posted: Sat Jul 14, 2007 11:42 am
by davidv1992
I have.

Decided to do a litle test just to see if dgjpp sees any of the unresolved or globaled labels in my assembled files.

Posted: Sat Jul 14, 2007 12:00 pm
by Brynet-Inc
Alright.. Do you have:

Code: Select all

extern typehere isrDummy;
..in your C file? lol..

Posted: Sat Jul 14, 2007 1:26 pm
by davidv1992
no i have void isrDummy(); in my c file.

just for further reference, i'll add my whole kernel source to this post.

compiling just by executing the .bat files in the sub directories, then executing the .bat file in the root directory. this'll also show the linker errors i get.

tools used:
nasm
dgjpp (or djgpp, which one is it?)

Posted: Sat Jul 14, 2007 4:44 pm
by pcmattman
Add to you LD command

Code: Select all

-Map link.map
And then post the contents of that file here.