OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 1:34 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
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.


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 1:50 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
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


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 2:00 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
ok. i know why it fails. i don't know why, but if i try to call asm functions from c, the OS crashes


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 2:07 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
Keep trying. Failing over and over again is integral part of learning process. But one time it will all come together :)


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 2:13 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
i'm trying, but with my dad hurrying me, it's a little crazy XD


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 2:19 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
ok, now it still crashig but dont make any compiling error. thats an advance. i've copied the main.c to my kernel.c


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Wed Sep 12, 2018 2:32 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
I am going to sleep for today but here is a little tip for you (maybe you know it already).
Code:
asm("cli\nhlt":: "a"(0xB16B00B2));
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)


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Thu Sep 13, 2018 7:45 am 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
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?


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Thu Sep 13, 2018 7:58 am 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
.h files are just declarations. You have to compile in .c files.


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Thu Sep 13, 2018 11:34 am 
Offline
Member
Member
User avatar

Joined: Fri Oct 27, 2006 9:42 am
Posts: 1925
Location: Athens, GA, USA
alberinfo wrote:
i'm trying, but with my dad hurrying me, it's a little crazy XD


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?

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.


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Thu Sep 13, 2018 12:03 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
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


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Fri Sep 14, 2018 9:50 am 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
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!


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Fri Sep 14, 2018 10:19 am 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
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.


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Fri Sep 14, 2018 12:02 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
good. then i'll try


Top
 Profile  
 
 Post subject: Re: x86 asm bios interrupts in C
PostPosted: Fri Sep 14, 2018 1:19 pm 
Offline
Member
Member

Joined: Wed Aug 29, 2018 4:42 pm
Posts: 122
i'm almost to do it. only ld(again :cry: ) 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'


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 184 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group