Page 1 of 1
i need help for interrupts..
Posted: Wed Jan 25, 2006 12:50 pm
by trashmanso
sory about my english..
i have started my first project... i have loaded my kernel but there are a lot of problems...
1. i cant use keyboard. i dont know asm and all codes are in asm about keyboard. are there any c source?
2. when i include a header to my kernel.c gcc compiles is well but my linker always creates problem. what should i do?
3.can i write irq,idt,gdt etc... codes in c? or i have to use asm?
thanks for ur help...
Re:i need help for keyboard...
Posted: Wed Jan 25, 2006 1:02 pm
by JoeKayzA
I think I'll let the first 2 points to someone else....
trashmanso wrote:
3.can i write irq,idt,gdt etc... codes in c? or i have to use asm?
The code for creating and manipulating the gdt/ldt and idt can be written in C, no problem. Just create a struct (or class, in C++) for the appropriate descriptor types, and treat the descriptor table as an array of descriptors.
For loading these tables however you'll need _at least_ a single instruction in inline-asm, since you need special opcodes for these.
cheers
Joe
Re:i need help for keyboard...
Posted: Wed Jan 25, 2006 1:06 pm
by trashmanso
thank u for ur answer. can i call an asm code from c, like a function? ( a linked *.asm code )
Re:i need help for keyboard...
Posted: Wed Jan 25, 2006 4:24 pm
by trashmanso
and also i need the first and the second questions answers.. .D
thanks.
Re:i need help for keyboard...
Posted: Wed Jan 25, 2006 4:46 pm
by Brendan
Hi,
trashmanso wrote:thank u for ur answer. can i call an asm code from c, like a function? ( a linked *.asm code )
Yes,
but the exact details might depend on which compiler you're using.
For simple/small things it's usually
much better to use inline assembly.
trashmanso wrote:
and also i need the first and the second questions answers.. .D
trashmanso wrote:1. i cant use keyboard. i dont know asm and all codes are in asm about keyboard. are there any c source?
Have you tried
this page about keyboards (which does use C examples)?
trashmanso wrote:2. when i include a header to my kernel.c gcc compiles is well but my linker always creates problem. what should i do?
That depends on what the problem is - if it's something like "
can't create file - not enough free space on disk" it shouldn't be hard to fix, but if you don't tell us what the problem is we could be guessing for months....
Cheers,
Brendan
Re:i need help for keyboard...
Posted: Thu Jan 26, 2006 1:31 am
by trashmanso
i've done a little project..
i only writes on screen in 32pmode and enables a20... and i stucked...
the problem is:
Code: Select all
start.o : file not recognized: File format not recognized
but i know there is a start.o file and also not empty..
My bıild.bat file
Code: Select all
nasm -f aout -o start.o start.asm
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o main.o main.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o scrn.o scrn.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o gdt.o gdt.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o idt.o idt.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o isrs.o isrs.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o irq.o irq.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o timer.o timer.c
d:\mingw\bin\gcc -Wall -O -fstrength-reduce -fomit-frame-pointer -finline-functions -nostdinc -fno-builtin -I./include -c -o kb.o kb.c
d:\mingw\bin\ld -T link.ld -o kernel.bin start.o main.o scrn.o gdt.o idt.o isrs.o irq.o timer.o kb.o
and i cant use Interrupt? i have searched lots of tutorials and also
http://osdever.net/tutorials/interrupts.1.php?the_id=39 but i dont understand all.
where should i add irq,isr code? (in my bootf.asm or loader.asm)
pause
Re:i need help for keyboard...
Posted: Thu Jan 26, 2006 3:13 am
by Pype.Clicker
trashmanso wrote:
i've done a little project..
i only writes on screen in 32pmode and enables a20... and i stucked...
the problem is:
Code: Select all
start.o : file not recognized: File format not recognized
but i know there is a start.o file and also not empty..
That comes from a mismatch between your linker and your assembler output format. "nasm -hf" should tell you what output formats your assembler supports. In your case, "win32" might be the one you need.
Be aware, too, that
mingw may be poorly suited to os development (though there are certainly workarounds for all the troubles you might encounter), so you might want to use
cygwin instead, and even maybe
building a cross-compiler, depending on your specific needs.
Re:i need help for keyboard...
Posted: Thu Jan 26, 2006 3:53 am
by trashmanso
i 've changed my build.bat but know the problem is
and i also installed cygwin on my pc. but i dont know how can i use it. i cant find gcc under cygwin...
thanks
Re:i need help for interrupts..
Posted: Thu Jan 26, 2006 4:11 am
by Pype.Clicker
The Root Directory for Cygwin (default C:\cygwin) will become / within your Cygwin installation. You must have write access to the parent directory, and any ACLs on the parent directory will determine access to installed files.
If you have installed gcc with cygwin, it should thus appear in "/usr/bin/gcc" once in the cygwin shell or in "c:\cygwin\usr\bin\gcc" when in the MS shell/explorer/whatever.
PE operations on non PE file.
That's
typical from an attempt to produce an ELF file with cygwin's linker...
Re:i need help for interrupts..
Posted: Thu Jan 26, 2006 4:56 am
by trashmanso
i think i should install cygwin again because there is no gcc file in usr/bin....
i need i good tutorial which i can compile easly in windows. i have downloaded lots of(about 50) but every of them gives errors while compiling. can u give me a tutorial like that. (print on screen, keyboard, irq,idt,gdt,pic etc...) maybe a need a small kernel source for learning..
can i reed "makefile"'s with cygwin with no problem
.
thanks again.
Re:i need help for interrupts..
Posted: Thu Jan 26, 2006 6:40 am
by Pype.Clicker
trashmanso wrote:
i think i should install cygwin again because there is no gcc file in usr/bin....
well, just pick more packages to install. no need to undo what's already been done.
can i reed "makefile"'s with cygwin with no problem
.
If you install "gnu make", probably ... unless the makefile contains something that's very unix-specific ... Just running "make" in the directory that contains the makefile should do the trick.
Re:i need help for interrupts..
Posted: Thu Jan 26, 2006 11:47 am
by trashmanso
where can i download gcc and how? am i have to download clibs..
Re:i need help for interrupts..
Posted: Thu Jan 26, 2006 12:16 pm
by Kemp
During the Cygwin installation you can choose a custom setup option which will let you choose what you want to install.