Can´t do reset! [Solved]

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.
Post Reply
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Can´t do reset! [Solved]

Post by digo_rp »

Hi all,

when I setup APIC mode, disable pic, start smp, OS Kernel goes ok! but I can´t do Reset...

I have been trying keyboard reset, idt with 0 size triple fault reset, and nothing...

my OS just freeze...

does anyone got an idea? just some start please!

thanks so much...
Last edited by digo_rp on Thu Jan 14, 2016 7:05 am, edited 1 time in total.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Can´t do reset!

Post by BrightLight »

TBH, I don't know much about SMP. But you can try ACPI reset. It's very simple, even simpler than ACPI shutdown.
EDIT: Forgot to say this, ACPI reset isn't supported on Bochs and QEMU, and appears to be broken in VirtualBox. It seems, you'll have to test it on real hardware.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Can´t do reset!

Post by digo_rp »

thank you so much.
I´ll check these out!
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Can´t do reset!

Post by onlyonemac »

I have used the triple fault reset before; I'm not sure why it's not working for you. I used to do it with interrupts enabled - not sure if that matters.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Can´t do reset!

Post by digo_rp »

thanks... it is a kind of odd stuff...
I can´t figure out why it doesn´t Works.!!!
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Can´t do reset!

Post by BrightLight »

Did you try ACPI reset?
You know your OS is advanced when you stop using the Intel programming guide as a reference.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Can´t do reset!

Post by onlyonemac »

Maybe post the code that you're using for your triple-fault reset?
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Can´t do reset!

Post by digo_rp »

At some of my pcs is not supported!
I don´t understand why that happens...

when I use PIC 8259 Works ok! triple fault, keyboard reset, everything... when I change to APIC, nothing Works....
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Can´t do reset!

Post by BrightLight »

Why not try something like this?

Code: Select all

void reset()
{
	disable_apic();
	enable_pic();
	disable_smp();

	outportb(0x64,0xFE);		// keyboard reset
	while(1);
}
You know your OS is advanced when you stop using the Intel programming guide as a reference.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Can´t do reset!

Post by digo_rp »

hum... cool thanks.. I´ll try this...

thanks so much...
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Can´t do reset!

Post by onlyonemac »

omarrx024 wrote:Why not try something like this?

Code: Select all

void reset()
{
	disable_apic();
	enable_pic();
	disable_smp();

	outportb(0x64,0xFE);		// keyboard reset
	while(1);
}
Sounds good, replace the keyboard reset with your preferred reset method (or try each in turn, from order of most supported to least supported, for maximum compatibility). I was going to suggest something similar to this since he mentioned that the issue occurs only when using the APIC but it is OK when using the PIC.
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: Can´t do reset!

Post by BrightLight »

Of course, you should try ACPI reset first. If that doesn't work, then try the keyboard reset. If all doesn't work, then a triple fault should be a last resort, as it doesn't reset some PCs.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Can´t do reset!

Post by onlyonemac »

omarrx024 wrote:If all doesn't work, then a triple fault should be a last resort, as it doesn't reset some PCs.
Really??? I thought that a reset after an unhandled triple-fault was the one constant in os-dev...
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing
User avatar
Kazinsal
Member
Member
Posts: 559
Joined: Wed Jul 13, 2011 7:38 pm
Libera.chat IRC: Kazinsal
Location: Vancouver
Contact:

Re: Can´t do reset!

Post by Kazinsal »

onlyonemac wrote:
omarrx024 wrote:If all doesn't work, then a triple fault should be a last resort, as it doesn't reset some PCs.
Really??? I thought that a reset after an unhandled triple-fault was the one constant in os-dev...
The triple fault was introduced in the 286, whose programming manual says that it puts the CPU into a shutdown cycle. Most chipsets interpret the shutdown cycle being initiated to mean "the processor needs to be reset", so they pull the reset pin high (or maybe it's low, I can't remember and I don't have a CPU manual on hand) and the CPU resets.

Technically, if this behaviour has not changed (and it likely hasn't, backwards compatibility being Intel's best friend), it would be a valid option for the shutdown cycle to lead to a power-off or simply a hang.
digo_rp
Member
Member
Posts: 233
Joined: Sun Jun 05, 2005 11:00 pm

Re: Can´t do reset!

Post by digo_rp »

Hi all, I´m glad to say that now I can do reset!

the problem was at my setup_pic code

thanks so much guys. a lot ...

:D
Post Reply