OSDev.org
https://forum.osdev.org/

(C/C++) How can i try to use something like jc?
https://forum.osdev.org/viewtopic.php?f=13&t=31122
Page 1 of 1

Author:  NunoLava1998 [ Mon Dec 26, 2016 11:27 am ]
Post subject:  (C/C++) How can i try to use something like jc?

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.

Author:  iansjack [ Mon Dec 26, 2016 11:43 am ]
Post subject:  Re: (C/C++) How can i try to use something like jc?

What has the carry flag got to do with enabling interrupts?

Author:  Techel [ Mon Dec 26, 2016 11:43 am ]
Post subject:  Techel

Why would you want to check the carry flag?
Simply use the jc instruction with a destination label.

Author:  NunoLava1998 [ Mon Dec 26, 2016 11:47 am ]
Post subject:  Re: Techel

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).

Author:  NunoLava1998 [ Mon Dec 26, 2016 11:50 am ]
Post subject:  Re: (C/C++) How can i try to use something like jc?

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).

Author:  iansjack [ Mon Dec 26, 2016 11:53 am ]
Post subject:  Re: (C/C++) How can i try to use something like jc?

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.

Author:  Techel [ Mon Dec 26, 2016 11:58 am ]
Post subject:  Techel

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.

Author:  NunoLava1998 [ Mon Dec 26, 2016 12:30 pm ]
Post subject:  Re: Techel

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.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/