x86 asm bios interrupts in C
Re: x86 asm bios interrupts in C
You have to initialize GDT and TSS exactly as in my boot.asm because the rest of the code expects it to be exactly as it is. Otherwhise Triple fault of doom It was not supposed to be copypaste solution. It is just a demo.
And about that multiple definitions. You have kmain function somewhere in your code and you try to link in another one from my code. And you can't have two symbols with the same name in the same program.
And about that multiple definitions. You have kmain function somewhere in your code and you try to link in another one from my code. And you can't have two symbols with the same name in the same program.
Re: x86 asm bios interrupts in C
only for trying i've copied your boot.asm to my boot.asm so bootloader isn't the problem. i don't have a reference to kmain, 'cause i don't have any functions with that name excepting yours
Re: x86 asm bios interrupts in C
ok. i know why it fails. i don't know why, but if i try to call asm functions from c, the OS crashes
Re: x86 asm bios interrupts in C
Keep trying. Failing over and over again is integral part of learning process. But one time it will all come together
Re: x86 asm bios interrupts in C
i'm trying, but with my dad hurrying me, it's a little crazy XD
Re: x86 asm bios interrupts in C
ok, now it still crashig but dont make any compiling error. thats an advance. i've copied the main.c to my kernel.c
Re: x86 asm bios interrupts in C
I am going to sleep for today but here is a little tip for you (maybe you know it already).
and ctrl+alt+2 then 'info registers' command in QEMU will let you know if your code reached the spot you put that snippet in. Of course you can use any easily recognizable pattern. It should show up in EAX register and halt the system. (Won't work that way for SMP)
Code: Select all
asm("cli\nhlt":: "a"(0xB16B00B2));
Re: x86 asm bios interrupts in C
i have a problem. LD makes a undefined reference to idtInitialize() when i call it also to vm86Initialize(). the proble is that if i quit the function and i compile the code. it still making error until for some reason the error dissapears. i've included idt.h and vm86.h so it shouldn't be needed to link them with the kernel(i think). So i don't know, but i'll keep trying, can anyone help me?
Re: x86 asm bios interrupts in C
.h files are just declarations. You have to compile in .c files.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: x86 asm bios interrupts in C
I'm puzzled by this comment. Do you mean you had to go do something else when you posted this, or was this regarding either your access to the computer (e.g., you are sharing the PC, and you only get to use it part of the time), or something to do with the project itself?alberinfo wrote:i'm trying, but with my dad hurrying me, it's a little crazy XD
I have a sense that there is something we're missing about this that may be relevant.
What is your testing environment, that is to say, are you running the tests in an emulator/simulator such as QEMU, Bochs, or VirtualBox, or are you booting from live hardware?
Some more details about your development host environment might help as well. Are you developing under Windows, Mac OS X, Linux, FreeBSD, or something else? Have you set up a GCC Cross Compiler, and if not, would you be able to do so? Is this your personal system, or are you sharing it with someone (a possibility I mentioned above)? Are you using the same system for both development and testing?
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Re: x86 asm bios interrupts in C
it was something to help my dad, nothing special. the computer is only mine. i'm using linux in Virtual Box(my hard drive isn't enough for dual booting). it's the same for compiling and testing, but sometimes i test it in a real machine. i'm using gcc for compile it
Re: x86 asm bios interrupts in C
hi,
the ld problem continues.i've included idt.c and vm86.c instead idt.h and vm86.h. but now in idt.c ld does not found asm isr, and gives me an undefined reference to each ISR(the total are 255). could be that they arent declared with global?. also in isrs.asm i didnt found the function 'isr' so, it can also be that. any idea?
Thanks!
the ld problem continues.i've included idt.c and vm86.c instead idt.h and vm86.h. but now in idt.c ld does not found asm isr, and gives me an undefined reference to each ISR(the total are 255). could be that they arent declared with global?. also in isrs.asm i didnt found the function 'isr' so, it can also be that. any idea?
Thanks!
Re: x86 asm bios interrupts in C
isr0 to isr255 are defined in isrs.asm. They are defined using ISR_NOERRCODE and ISR_ERRCODE macros. You have to compile it using YASM (NASM should work too) and link in .o file it makes.
Re: x86 asm bios interrupts in C
good. then i'll try
Re: x86 asm bios interrupts in C
i'm almost to do it. only ld(again ) gives me: undefined reference to '__stack_chk_fail', it comes out with -shared and -fno-stack-protector, but with it, the os crashes.why it comes?
PD: it comes from the function 'vm86EnterHandlerCallback'
PD: it comes from the function 'vm86EnterHandlerCallback'