few questions

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.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

few questions

Post 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??
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post 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
My OS is Perception.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post by davidv1992 »

yay, that atleast makes my kernel compile again
User avatar
XCHG
Member
Member
Posts: 416
Joined: Sat Nov 25, 2006 3:55 am
Location: Wisconsin
Contact:

Post 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.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post 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)
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post 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?
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post 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'
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post 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..
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

Is IsrDummy in your c files or your assembly files?
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post 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.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post 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?
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post 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.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Alright.. Do you have:

Code: Select all

extern typehere isrDummy;
..in your C file? lol..
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
davidv1992
Member
Member
Posts: 223
Joined: Thu Jul 05, 2007 8:58 am

Post 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?)
Attachments
Mini OS.zip
source of OS
(23.01 KiB) Downloaded 17 times
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post by pcmattman »

Add to you LD command

Code: Select all

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