Help with sti

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Locked
Sv9toi
Posts: 3
Joined: Wed Apr 14, 2010 11:45 am

Help with sti

Post by Sv9toi »

I try use asm("sti") and run in qemu.

and if i select my OS in grub all stopped
if I remove asm("sti") all work

Who may help me?

Sorry for my bad English I'm from Russia.
User avatar
Coty
Member
Member
Posts: 286
Joined: Thu Feb 12, 2009 5:12 pm

Re: Help with sti

Post by Coty »

STI, re-enables interrupts, are you using it in a place that you need to have interrupts
disabled? If so that could cause a crash and reboot. Also make sure you disable interrupts
before re-enabling them (CLI) other wise the system may crash if they are already
enabled.

Kinda need more information than that. even a snippet code will help of where the code is
going faulty.
My hero, is Mel.
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: Help with sti

Post by neon »

Hello,

When GRUB passes control to your system it is running in protected mode with interrupts disabled. You need to re-initialize the PIC or APIC with your IDT before enabling hardware interrupts (sti).

If these are already set up perhaps posting some code and providing more information can help.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Help with sti

Post by Owen »

Coddy wrote:Also make sure you disable interrupts before re-enabling them (CLI) other wise the system may crash if they are already enabled.
Sorry, but this is patently wrong.
User avatar
quanganht
Member
Member
Posts: 301
Joined: Fri May 16, 2008 7:13 pm
Location: Hanoi, Vietnam

Re: Help with sti

Post by quanganht »

Where did you put you 'sti' ?
"Programmers are tools for converting caffeine into code."
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Help with sti

Post by jal »

Sv9toi wrote:Sorry for my bad English I'm from Russia.
Why do people appologize for their shoddy English, but not for their shoddy knowledge of the subject?


JAL
User avatar
-m32
Member
Member
Posts: 120
Joined: Thu Feb 21, 2008 5:59 am
Location: Ottawa, Canada

Re: Help with sti

Post by -m32 »

jal wrote:
Sv9toi wrote:Sorry for my bad English I'm from Russia.
Why do people appologize for their shoddy English, but not for their shoddy knowledge of the subject?
No one should have to apologize for NOT knowing something. Anyone who expects them to is an @$$.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Help with sti

Post by jal »

-m32 wrote:No one should have to apologize for NOT knowing something. Anyone who expects them to is an @$$.
You are aware that we have a certain "required knowledge" at this forum, right?


JAL
Sv9toi
Posts: 3
Joined: Wed Apr 14, 2010 11:45 am

Re: Help with sti

Post by Sv9toi »

neon wrote:Hello,

When GRUB passes control to your system it is running in protected mode with interrupts disabled. You need to re-initialize the PIC or APIC with your IDT before enabling hardware interrupts (sti).

If these are already set up perhaps posting some code and providing more information can help.

OK) It's work :D .


Ps I'm 12 yo. my father S.O. programmer and he learn me. If you want say, that you have big brain, you may do it in other places.
Last edited by Sv9toi on Thu Apr 15, 2010 8:10 am, edited 1 time in total.
jal
Member
Member
Posts: 1385
Joined: Wed Oct 31, 2007 9:09 am

Re: Help with sti

Post by jal »

Sv9toi wrote:Ps I'm 12 yo. my father S.O. programmer and he learn me. If you want say, that you have big brain, you may do it in other places.
Knowing you're that young, and non-native English speaker, I applaud you for trying, but please, read the wiki on getting started, and the forum rules if you haven't done so yet. We are not here to teach youngsters.


JAL
Locked