mirror of
https://github.com/reactos/reactos.git
synced 2025-08-08 10:43:01 +00:00
- Implement KiApcInterrupt -- ACPs now work!
- Change some infinite loops to ASSERTs since bugchecks now work and we can better differentiate stubs versus loops versus unimplemented code. - Add back the system call debug prints -- total hack to make the stack work. - Add support for the ARC Disk Information/Signature in FreeLDR. - We've reached a major, major milestone here folks -- the kernel bugchecks because no boot device was found (since we don't have any working drivers yet). - We have a lot of stuff to fix before continuing, and code review will take some time. svn path=/trunk/; revision=34121
This commit is contained in:
parent
7675e2b8be
commit
445028acf9
4 changed files with 141 additions and 31 deletions
|
@ -1056,6 +1056,11 @@ ArmPrepareForReactOS(IN BOOLEAN Setup)
|
||||||
ULONG Dummy, i;
|
ULONG Dummy, i;
|
||||||
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
PLDR_DATA_TABLE_ENTRY LdrEntry;
|
||||||
PLIST_ENTRY NextEntry, OldEntry;
|
PLIST_ENTRY NextEntry, OldEntry;
|
||||||
|
PARC_DISK_INFORMATION ArcDiskInformation;
|
||||||
|
PARC_DISK_SIGNATURE ArcDiskSignature;
|
||||||
|
ULONG ArcDiskCount = 0, Checksum = 0;
|
||||||
|
PMASTER_BOOT_RECORD Mbr;
|
||||||
|
PULONG Buffer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Allocate the ARM Shared Heap
|
// Allocate the ARM Shared Heap
|
||||||
|
@ -1240,10 +1245,6 @@ ArmPrepareForReactOS(IN BOOLEAN Setup)
|
||||||
LdrEntry->BaseDllName.Buffer = (PVOID)((ULONG_PTR)LdrEntry->BaseDllName.Buffer | KSEG0_BASE);
|
LdrEntry->BaseDllName.Buffer = (PVOID)((ULONG_PTR)LdrEntry->BaseDllName.Buffer | KSEG0_BASE);
|
||||||
InsertTailList(&ArmLoaderBlock->LoadOrderListHead, &LdrEntry->InLoadOrderLinks);
|
InsertTailList(&ArmLoaderBlock->LoadOrderListHead, &LdrEntry->InLoadOrderLinks);
|
||||||
|
|
||||||
//
|
|
||||||
// TODO: Setup boot-driver data
|
|
||||||
//
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Build descriptors for the drivers loaded
|
// Build descriptors for the drivers loaded
|
||||||
//
|
//
|
||||||
|
@ -1261,7 +1262,6 @@ ArmPrepareForReactOS(IN BOOLEAN Setup)
|
||||||
if (Status != STATUS_SUCCESS) return;
|
if (Status != STATUS_SUCCESS) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Loop driver list
|
// Loop driver list
|
||||||
//
|
//
|
||||||
|
@ -1488,6 +1488,75 @@ ArmPrepareForReactOS(IN BOOLEAN Setup)
|
||||||
//
|
//
|
||||||
NextEntry->Flink = (PVOID)((ULONG_PTR)NextEntry->Flink | KSEG0_BASE);
|
NextEntry->Flink = (PVOID)((ULONG_PTR)NextEntry->Flink | KSEG0_BASE);
|
||||||
NextEntry->Blink = (PVOID)((ULONG_PTR)NextEntry->Blink | KSEG0_BASE);
|
NextEntry->Blink = (PVOID)((ULONG_PTR)NextEntry->Blink | KSEG0_BASE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate ARC disk structure
|
||||||
|
//
|
||||||
|
ArcDiskInformation = ArmAllocateFromSharedHeap(sizeof(ARC_DISK_INFORMATION));
|
||||||
|
InitializeListHead(&ArcDiskInformation->DiskSignatureListHead);
|
||||||
|
ArmLoaderBlock->ArcDiskInformation = (PVOID)((ULONG_PTR)ArcDiskInformation | KSEG0_BASE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Read the MBR
|
||||||
|
//
|
||||||
|
MachDiskReadLogicalSectors(0x49, 0ULL, 1, (PVOID)DISKREADBUFFER);
|
||||||
|
Buffer = (ULONG*)DISKREADBUFFER;
|
||||||
|
Mbr = (PMASTER_BOOT_RECORD)DISKREADBUFFER;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Calculate the MBR checksum
|
||||||
|
//
|
||||||
|
for (i = 0; i < 128; i++) Checksum += Buffer[i];
|
||||||
|
Checksum = ~Checksum + 1;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocate a disk signature and fill it out
|
||||||
|
//
|
||||||
|
ArcDiskSignature = ArmAllocateFromSharedHeap(sizeof(ARC_DISK_SIGNATURE));
|
||||||
|
ArcDiskSignature->Signature = Mbr->Signature;
|
||||||
|
ArcDiskSignature->CheckSum = Checksum;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Allocare a string for the name and fill it out
|
||||||
|
//
|
||||||
|
ArcDiskSignature->ArcName = ArmAllocateFromSharedHeap(256);
|
||||||
|
sprintf(ArcDiskSignature->ArcName, "multi(0)disk(0)rdisk(%lu)", ArcDiskCount++);
|
||||||
|
ArcDiskSignature->ArcName = (PVOID)((ULONG_PTR)ArcDiskSignature->ArcName | KSEG0_BASE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Insert the descriptor into the list
|
||||||
|
//
|
||||||
|
InsertTailList(&ArcDiskInformation->DiskSignatureListHead,
|
||||||
|
&ArcDiskSignature->ListEntry);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Loop ARC disk list
|
||||||
|
//
|
||||||
|
NextEntry = ArcDiskInformation->DiskSignatureListHead.Flink;
|
||||||
|
while (NextEntry != &ArcDiskInformation->DiskSignatureListHead)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Remember the physical entry
|
||||||
|
//
|
||||||
|
OldEntry = NextEntry->Flink;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Edit the data
|
||||||
|
//
|
||||||
|
NextEntry->Flink = (PVOID)((ULONG_PTR)NextEntry->Flink | KSEG0_BASE);
|
||||||
|
NextEntry->Blink = (PVOID)((ULONG_PTR)NextEntry->Blink | KSEG0_BASE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Keep looping
|
||||||
|
//
|
||||||
|
NextEntry = OldEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Now edit the root itself
|
||||||
|
//
|
||||||
|
NextEntry->Flink = (PVOID)((ULONG_PTR)NextEntry->Flink | KSEG0_BASE);
|
||||||
|
NextEntry->Blink = (PVOID)((ULONG_PTR)NextEntry->Blink | KSEG0_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
|
|
@ -23,8 +23,13 @@ extern PVOID KiArmVectorTable;
|
||||||
|
|
||||||
/* FUNCTIONS ******************************************************************/
|
/* FUNCTIONS ******************************************************************/
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIXME: Header cleanup
|
||||||
|
//
|
||||||
VOID
|
VOID
|
||||||
KiIdleLoop(VOID);
|
KiIdleLoop(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
DebugService(IN ULONG ServiceType,
|
DebugService(IN ULONG ServiceType,
|
||||||
|
@ -34,7 +39,7 @@ DebugService(IN ULONG ServiceType,
|
||||||
IN ULONG Level)
|
IN ULONG Level)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// ARM Bring-up Hack
|
// FIXME: ARM Bring-up Hack
|
||||||
//
|
//
|
||||||
void arm_kprintf(const char *fmt, ...);
|
void arm_kprintf(const char *fmt, ...);
|
||||||
arm_kprintf("%s", Buffer);
|
arm_kprintf("%s", Buffer);
|
||||||
|
@ -230,7 +235,7 @@ KiInitializeKernel(IN PKPROCESS InitProcess,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// FIXME
|
// FIXME: No MP Support
|
||||||
//
|
//
|
||||||
DPRINT1("ARM MPCore not supported\n");
|
DPRINT1("ARM MPCore not supported\n");
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,6 @@ GENERATE_ARM_STUB KeSwitchKernelStack
|
||||||
//
|
//
|
||||||
// Traps, Debugging and Execeptions
|
// Traps, Debugging and Execeptions
|
||||||
//
|
//
|
||||||
GENERATE_ARM_STUB KiApcInterrupt
|
|
||||||
GENERATE_ARM_STUB KiPassiveRelease
|
GENERATE_ARM_STUB KiPassiveRelease
|
||||||
GENERATE_ARM_STUB KiInterruptTemplate
|
GENERATE_ARM_STUB KiInterruptTemplate
|
||||||
GENERATE_ARM_STUB KiUnexpectedInterrupt
|
GENERATE_ARM_STUB KiUnexpectedInterrupt
|
||||||
|
|
|
@ -102,7 +102,7 @@ KiIdleLoop(VOID)
|
||||||
DPRINT1("Swapping context!\n");
|
DPRINT1("Swapping context!\n");
|
||||||
KiSwapContext(OldThread, NewThread);
|
KiSwapContext(OldThread, NewThread);
|
||||||
DPRINT1("Back\n");
|
DPRINT1("Back\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -160,7 +160,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// FIXME: TODO
|
// FIXME: TODO
|
||||||
//
|
//
|
||||||
DPRINT1("WMI Tracing not supported\n");
|
DPRINT1("WMI Tracing not supported\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -180,7 +180,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// FIXME: TODO
|
// FIXME: TODO
|
||||||
//
|
//
|
||||||
DPRINT1("Address space switch not implemented\n");
|
DPRINT1("Address space switch not implemented\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// FIXME: FAIL
|
// FIXME: FAIL
|
||||||
//
|
//
|
||||||
DPRINT1("DPCS ACTIVE!!!\n");
|
DPRINT1("DPCS ACTIVE!!!\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -222,7 +222,7 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
// FIXME: TODO
|
// FIXME: TODO
|
||||||
//
|
//
|
||||||
DPRINT1("APCs pending!\n");
|
DPRINT1("APCs pending!\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -231,6 +231,45 @@ KiSwapContextInternal(IN PKTHREAD OldThread,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
KiApcInterrupt(VOID)
|
||||||
|
{
|
||||||
|
KPROCESSOR_MODE PreviousMode;
|
||||||
|
KEXCEPTION_FRAME ExceptionFrame;
|
||||||
|
PKTRAP_FRAME TrapFrame = KeGetCurrentThread()->TrapFrame;
|
||||||
|
DPRINT1("[APC]\n");
|
||||||
|
|
||||||
|
//
|
||||||
|
// Isolate previous mode
|
||||||
|
//
|
||||||
|
PreviousMode = KiGetPreviousMode(TrapFrame);
|
||||||
|
|
||||||
|
//
|
||||||
|
// FIXME No use-mode support
|
||||||
|
//
|
||||||
|
if (PreviousMode == UserMode) ASSERT(FALSE);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Disable interrupts
|
||||||
|
//
|
||||||
|
_disable();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear APC interrupt
|
||||||
|
//
|
||||||
|
HalClearSoftwareInterrupt(APC_LEVEL);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Re-enable interrupts
|
||||||
|
//
|
||||||
|
_enable();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Deliver APCs
|
||||||
|
//
|
||||||
|
KiDeliverApc(PreviousMode, &ExceptionFrame, TrapFrame);
|
||||||
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
KiDispatchInterrupt(VOID)
|
KiDispatchInterrupt(VOID)
|
||||||
{
|
{
|
||||||
|
@ -309,7 +348,7 @@ KiDispatchInterrupt(VOID)
|
||||||
DPRINT1("Swapping context!\n");
|
DPRINT1("Swapping context!\n");
|
||||||
KiSwapContext(OldThread, NewThread);
|
KiSwapContext(OldThread, NewThread);
|
||||||
DPRINT1("Back\n");
|
DPRINT1("Back\n");
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,21 +441,17 @@ KiDataAbortHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
//
|
//
|
||||||
// Check if this is a page fault
|
// Check if this is a page fault
|
||||||
//
|
//
|
||||||
if ((KeArmFaultStatusRegisterGet() == 21) ||
|
if (KeArmFaultStatusRegisterGet() == 21 || KeArmFaultStatusRegisterGet() == 23)
|
||||||
(KeArmFaultStatusRegisterGet() == 23))
|
|
||||||
{
|
{
|
||||||
//
|
Status = MmAccessFault(FALSE,
|
||||||
// Handle the fault
|
Address,
|
||||||
//
|
KernelMode,
|
||||||
Status = MmAccessFault(FALSE, Address, KernelMode, TrapFrame);
|
TrapFrame);
|
||||||
if (Status == STATUS_SUCCESS) return Status;
|
if (Status == STATUS_SUCCESS) return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// We don't handle this yet
|
|
||||||
//
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +478,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
// Get the system call ID
|
// Get the system call ID
|
||||||
//
|
//
|
||||||
Id = Instruction & 0xFFFFF;
|
Id = Instruction & 0xFFFFF;
|
||||||
//DPRINT1("[SWI] (%x) %p (%d) \n", Id, Thread, Thread->PreviousMode);
|
DPRINT1("[SWI] (%x) %p (%d) \n", Id, Thread, Thread->PreviousMode);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the descriptor table
|
// Get the descriptor table
|
||||||
|
@ -463,7 +498,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
// Check if this is a GUI call
|
// Check if this is a GUI call
|
||||||
//
|
//
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -480,7 +515,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
// TODO
|
// TODO
|
||||||
//
|
//
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
while (TRUE);
|
ASSERT(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -499,6 +534,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
//
|
//
|
||||||
// Copy them into the kernel stack
|
// Copy them into the kernel stack
|
||||||
//
|
//
|
||||||
|
DPRINT1("Argument: %p\n", *Argument);
|
||||||
Arguments[i] = *Argument;
|
Arguments[i] = *Argument;
|
||||||
Argument++;
|
Argument++;
|
||||||
}
|
}
|
||||||
|
@ -539,6 +575,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
//
|
//
|
||||||
// Copy into kernel stack
|
// Copy into kernel stack
|
||||||
//
|
//
|
||||||
|
DPRINT1("Argument: %p\n", *Argument);
|
||||||
Arguments[i] = *Argument;
|
Arguments[i] = *Argument;
|
||||||
Argument++;
|
Argument++;
|
||||||
}
|
}
|
||||||
|
@ -548,7 +585,7 @@ KiSystemService(IN PKTHREAD Thread,
|
||||||
// Do the system call and save result in EAX
|
// Do the system call and save result in EAX
|
||||||
//
|
//
|
||||||
TrapFrame->R0 = KiSystemCall(SystemCall, Arguments, ArgumentCount);
|
TrapFrame->R0 = KiSystemCall(SystemCall, Arguments, ArgumentCount);
|
||||||
//DPRINT1("Returned: %lx\n", TrapFrame->R0);
|
DPRINT1("Returned: %lx\n", TrapFrame->R0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -569,7 +606,7 @@ KiSoftwareInterruptHandler(IN PKTRAP_FRAME TrapFrame)
|
||||||
PreviousMode = KiGetPreviousMode(TrapFrame);
|
PreviousMode = KiGetPreviousMode(TrapFrame);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Save old previous mode
|
// FIXME: Save old previous mode
|
||||||
//
|
//
|
||||||
//TrapFrame->PreviousMode = PreviousMode;
|
//TrapFrame->PreviousMode = PreviousMode;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue