That function is not supposed to be called by old bootloader directly. Why is that needed? And why in this function?
WBR, Aleksey Bragin.
On Jul 30, 2009, at 9:54 PM, dgorbachev@svn.reactos.org wrote:
Author: dgorbachev Date: Thu Jul 30 19:54:01 2009 New Revision: 42305
URL: http://svn.reactos.org/svn/reactos?rev=42305&view=rev Log: Add a hack in KiSystemStartupReal function until Better Times.
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c
Modified: trunk/reactos/ntoskrnl/ke/i386/kiinit.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/ i386/kiinit.c?rev=42305&r1=42304&r2=42305&view=diff ====================================================================== ======== --- trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ke/i386/kiinit.c [iso-8859-1] Thu Jul 30 19:54:01 2009 @@ -712,18 +712,34 @@ Ke386SetDs(KGDT_R3_DATA | RPL_MASK); Ke386SetEs(KGDT_R3_DATA | RPL_MASK);
- /* Save NMI and double fault traps */
- RtlCopyMemory(&NmiEntry, &Idt[2], sizeof(KIDTENTRY));
- RtlCopyMemory(&DoubleFaultEntry, &Idt[8], sizeof(KIDTENTRY));
- /* Copy kernel's trap handlers */
- RtlCopyMemory(Idt,
(PVOID)KiIdtDescriptor.Base,KiIdtDescriptor.Limit + 1);- /* Restore NMI and double fault */
- RtlCopyMemory(&Idt[2], &NmiEntry, sizeof(KIDTENTRY));
- RtlCopyMemory(&Idt[8], &DoubleFaultEntry, sizeof(KIDTENTRY));
- /* HACK compensates for KiRosPrepareForSystemStartup hack */
- if ((ULONG)Idt == KiIdtDescriptor.Base)
- {
USHORT FlippedSelector;FlippedSelector = KiIdt[2].Selector;KiIdt[2].Selector = KiIdt[2].ExtendedOffset;KiIdt[2].ExtendedOffset = FlippedSelector;FlippedSelector = KiIdt[8].Selector;KiIdt[8].Selector = KiIdt[8].ExtendedOffset;KiIdt[8].ExtendedOffset = FlippedSelector;- }
- else
- {
/* Save NMI and double fault traps */RtlCopyMemory(&NmiEntry, &Idt[2], sizeof(KIDTENTRY));RtlCopyMemory(&DoubleFaultEntry, &Idt[8], sizeof(KIDTENTRY));/* Copy kernel's trap handlers */RtlCopyMemory(Idt,(PVOID)KiIdtDescriptor.Base,KiIdtDescriptor.Limit + 1);/* Restore NMI and double fault */RtlCopyMemory(&Idt[2], &NmiEntry, sizeof(KIDTENTRY));RtlCopyMemory(&Idt[8], &DoubleFaultEntry, sizeof(KIDTENTRY));- }
AppCpuInit: /* Loop until we can release the freeze lock */
That function is not supposed to be called by old bootloader directly.
It is called indirectly through KiRosPrepareForSystemStartup function, after it applies a hack (ke/freeldr.c:1272). This new hack is to fix that old hack. (Ugh!)
Why is that needed?
Otherwise, the double fault and nmi descriptors become mutilated. When these interrupts happen, it causes a (virtual or real) machine to crash / reboot. Better to be able to examine situation from kdbg.
And why in this function?
Simpler to do it here.
So you are saying that you are hacking correct code, to fix a bug in a hack, cause it's easier?
Dmitry Gorbachev wrote:
That function is not supposed to be called by old bootloader directly.
It is called indirectly through KiRosPrepareForSystemStartup function, after it applies a hack (ke/freeldr.c:1272). This new hack is to fix that old hack. (Ugh!)
Why is that needed?
Otherwise, the double fault and nmi descriptors become mutilated. When these interrupts happen, it causes a (virtual or real) machine to crash / reboot. Better to be able to examine situation from kdbg.
And why in this function?
Simpler to do it here.
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
It shouldn't be that hard to fix freeldr, otherwise you're breaking ntldr boot style, I suppose.
Should I or would you?
WBR, Aleksey Bragin.
On Aug 1, 2009, at 3:25 AM, Dmitry Gorbachev wrote:
So you are saying that you are hacking correct code, to fix a bug in a hack, cause it's easier?
Not quite so; the loader should be fixed, then these hacks will be gone.
otherwise you're breaking ntldr boot style, I suppose.
No, the new hack is applied only if the old is present.
Should I or would you?
Why to change that old style, if it is going to be replaced by the new? There are probably more important things to do.
Please apply this hack in ke/freeldr.c Best regards, Alex Ionescu
On Sat, Aug 1, 2009 at 3:55 AM, Dmitry Gorbachev d.g.gorbachev@gmail.comwrote:
otherwise you're breaking ntldr boot style, I suppose.
No, the new hack is applied only if the old is present.
Should I or would you?
Why to change that old style, if it is going to be replaced by the new? There are probably more important things to do.
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
ke/freeldr.c was designed for sh*t. It really means, translated sh/itfile.c and I was actually hoping to commit it that way. The other files are designed to be 100% compatible and as much as possible identical to 2003 SP1, so please remove that hack from there.
You can put anything you want in sh/itfile.c (oops, I mean ke/freeldr.c), including GRUB code, Wine code and Linux_kernel_functions all day long.
Best regards, Alex Ionescu
On Sat, Aug 1, 2009 at 2:27 PM, Dmitry Gorbachev d.g.gorbachev@gmail.comwrote:
Please apply this hack in ke/freeldr.c
Should I apply same sh*t to different file? :) I believe that now everything is 'right' there, nothing to change.
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
ASCII porn of RMS is also okay. Best regards, Alex Ionescu
On Sat, Aug 1, 2009 at 3:26 PM, Alex Ionescu ionucu@videotron.ca wrote:
ke/freeldr.c was designed for sh*t. It really means, translated sh/itfile.c and I was actually hoping to commit it that way. The other files are designed to be 100% compatible and as much as possible identical to 2003 SP1, so please remove that hack from there.
You can put anything you want in sh/itfile.c (oops, I mean ke/freeldr.c), including GRUB code, Wine code and Linux_kernel_functions all day long.
Best regards, Alex Ionescu
On Sat, Aug 1, 2009 at 2:27 PM, Dmitry Gorbachev d.g.gorbachev@gmail.comwrote:
Please apply this hack in ke/freeldr.c
Should I apply same sh*t to different file? :) I believe that now everything is 'right' there, nothing to change.
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev
The other files are designed to be 100% compatible and as much as possible identical to 2003 SP1, so please remove that hack from there.
All right, I will change it "because I want to stop the crying of a baby." :) This small modification receives more attention then it deserves. One fine day, these hacks will be removed, anyway.
Alex Ionescu wrote:
ASCII porn of RMS is also okay.
Thanks dad, baby Bragin and Ionescu love you. Best regards, Alex Ionescu
On Sat, Aug 1, 2009 at 5:15 PM, Dmitry Gorbachev d.g.gorbachev@gmail.comwrote:
The other files are designed to be 100% compatible and as much as
possible
identical to 2003 SP1, so please remove that hack from there.
All right, I will change it "because I want to stop the crying of a baby." :) This small modification receives more attention then it deserves. One fine day, these hacks will be removed, anyway.
Alex Ionescu wrote:
ASCII porn of RMS is also okay.
Ros-dev mailing list Ros-dev@reactos.org http://www.reactos.org/mailman/listinfo/ros-dev