OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Apr 23, 2017 9:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: (C/C++) How can i try to use something like jc?
PostPosted: Mon Dec 26, 2016 11:27 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 275
I finally got to enable interrupts correctly (using my code and code of some other people, no errors or warnings using -Wextra/-Wall). However, my code sometimes fails to enable interrupts, and so i need something like a jc to repeat if the carry flag was set, or a rfics (repeat function if carry flag set).

How would i do this in C (or C++)? Yes, i use inline assembly to do lidt.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: (C/C++) How can i try to use something like jc?
PostPosted: Mon Dec 26, 2016 11:43 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2709
Location: Chichester, UK
What has the carry flag got to do with enabling interrupts?


Top
 Profile  
 
 Post subject: Techel
PostPosted: Mon Dec 26, 2016 11:43 am 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 213
Location: Germany
Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.


Top
 Profile  
 
 Post subject: Re: Techel
PostPosted: Mon Dec 26, 2016 11:47 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 275
Techel wrote:
Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.

My loading interrupts function fails a lot, and since i try to use the PIC right after, it triple-faults (obviously).

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: (C/C++) How can i try to use something like jc?
PostPosted: Mon Dec 26, 2016 11:50 am 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 275
iansjack wrote:
What has the carry flag got to do with enabling interrupts?


lidt can fail sometimes (and it does, it sometimes takes like 5 times until it finally does it succesfully).

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
 Post subject: Re: (C/C++) How can i try to use something like jc?
PostPosted: Mon Dec 26, 2016 11:53 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 2709
Location: Chichester, UK
NunoLava1998 wrote:
iansjack wrote:
What has the carry flag got to do with enabling interrupts?


lidt can fail sometimes (and it does, it sometimes takes like 5 times until it finally does it succesfully).

But what has that got to do with the carry flag? And what is difficult about enabling interrupts - it's a single instruction.


Top
 Profile  
 
 Post subject: Techel
PostPosted: Mon Dec 26, 2016 11:58 am 
Offline
Member
Member

Joined: Fri Jan 30, 2015 4:57 pm
Posts: 213
Location: Germany
Did you clear the interrupt enabled flag before lidt'ing the idt? If not, the pit keeps triggering interrupts, but if you're lucky, this doesn't happen until you got the interrupt part successfully set up.


Top
 Profile  
 
 Post subject: Re: Techel
PostPosted: Mon Dec 26, 2016 12:30 pm 
Offline
Member
Member

Joined: Sun Oct 09, 2016 4:38 am
Posts: 275
Techel wrote:
Did you clear the interrupt enabled flag before lidt'ing the idt? If not, the pit keeps triggering interrupts, but if you're lucky, this doesn't happen until you got the interrupt part successfully set up.

Looks like that is , sometimes i can get it for a bit before PIT screws up.

_________________
Developing TRIODIUM OS. Or call it Dixium if you want. It doesn't matter.

https://github.com/NunoLava1998/DixiumOS


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], MSNbot Media and 3 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