Преглед изворни кода

Made ARM exception stack size a parameter.

By making ARM's EXCEPTION_STACK_SIZE a parameter to the assembly
functions, the additional define in arm.inc can be deleted. This allows
the exception stack size to be changed at compile time in a less error
prone manner. Larger exception stacks can be used for debugging stack
exceptions, for instance.
Evan Green пре 8 година
родитељ
комит
e86efd02ae

+ 4 - 2
boot/lib/armv7/commsup.S

@@ -40,7 +40,8 @@ ASSEMBLY_FILE_HEADER
 ##
 ## VOID
 ## BoInitializeExceptionStacks (
-##     PVOID ExceptionStacksBase
+##     PVOID ExceptionStacksBase,
+##     ULONG ExceptionStackSize
 ##     )
 ##
 
@@ -59,6 +60,8 @@ Arguments:
         be used for exception stacks. Each stack takes up 16 bytes and there are
         4 modes, so at least 64 bytes are needed.
 
+    ExceptionStackSize - Supplies the size of each exception stack.
+
 Return Value:
 
     None.
@@ -71,7 +74,6 @@ FUNCTION BoInitializeExceptionStacks
     ## Load R1 with an individual stack size.
     ##
 
-    ldr     %r1, =EXCEPTION_STACK_SIZE
     add     %r0, %r0, %r1
 
     ##

+ 3 - 8
boot/lib/armv7/prochw.c

@@ -33,8 +33,6 @@ Environment:
 // ---------------------------------------------------------------- Definitions
 //
 
-#define DOUBLE_FAULT_STACK_SIZE 1024
-
 //
 // ----------------------------------------------- Internal Function Prototypes
 //
@@ -45,7 +43,8 @@ Environment:
 
 VOID
 BoInitializeExceptionStacks (
-    PVOID ExceptionStacksBase
+    PVOID ExceptionStacksBase,
+    ULONG ExceptionStackSize
     );
 
 VOID
@@ -133,10 +132,6 @@ BopDoubleFaultHandler (
 
 ULONG BoExceptionStacks[EXCEPTION_STACK_COUNT * EXCEPTION_STACK_SIZE];
 
-UCHAR BoDoubleFaultStack[DOUBLE_FAULT_STACK_SIZE];
-PUCHAR BoDoubleFaultStackPointer =
-                  BoDoubleFaultStack + DOUBLE_FAULT_STACK_SIZE - sizeof(ULONG);
-
 //
 // Global containing a partially initialized interrupt table. This table will
 // be copied to the real location, either 0 or 0xFFFF0000.
@@ -224,7 +219,7 @@ Return Value:
 
 {
 
-    BoInitializeExceptionStacks(BoExceptionStacks);
+    BoInitializeExceptionStacks(BoExceptionStacks, EXCEPTION_STACK_SIZE);
     BopInitializeInterrupts();
     return;
 }

+ 3 - 2
boot/lib/efi/armv7/efiarch.c

@@ -54,7 +54,8 @@ Environment:
 
 VOID
 BoInitializeExceptionStacks (
-    PVOID ExceptionStacksBase
+    PVOID ExceptionStacksBase,
+    ULONG ExceptionStackSize
     );
 
 BOOL
@@ -280,7 +281,7 @@ Return Value:
         }
     }
 
-    BoInitializeExceptionStacks(BoExceptionStacks);
+    BoInitializeExceptionStacks(BoExceptionStacks, EXCEPTION_STACK_SIZE);
     return;
 }
 

+ 4 - 1
include/minoca/kernel/arm.h

@@ -1129,7 +1129,8 @@ Return Value:
 
 VOID
 ArpInitializeExceptionStacks (
-    PVOID ExceptionStacksBase
+    PVOID ExceptionStacksBase,
+    ULONG ExceptionStackSize
     );
 
 /*++
@@ -1147,6 +1148,8 @@ Arguments:
         be used for exception stacks. Each stack takes up 16 bytes and there are
         4 modes, so at least 64 bytes are needed.
 
+    ExceptionStackSize - Supplies the size of each exception stack in bytes.
+
 Return Value:
 
     None.

+ 0 - 2
include/minoca/kernel/arm.inc

@@ -142,8 +142,6 @@ Environment:
 #define EXCEPTION_STACK_R0   0
 #define EXCEPTION_STACK_CPSR 4
 
-#define EXCEPTION_STACK_SIZE 8
-
 ##
 ## Define the size of the PROCESSOR_CONTEXT structure.
 ##

+ 1 - 1
kernel/armv7/prochw.c

@@ -152,7 +152,7 @@ Return Value:
     // Initialize the exception stacks.
     //
 
-    ArpInitializeExceptionStacks(ExceptionStacks);
+    ArpInitializeExceptionStacks(ExceptionStacks, EXCEPTION_STACK_SIZE);
 
     //
     // Initialize the pointer to the processor block.

+ 4 - 2
kernel/armv7/trap.S

@@ -40,7 +40,8 @@ ASSEMBLY_FILE_HEADER
 ##
 ## VOID
 ## ArpInitializeExceptionStacks (
-##     PVOID ExceptionStacksBase
+##     PVOID ExceptionStacksBase,
+##     ULONG ExceptionStackSize
 ##     )
 ##
 
@@ -59,6 +60,8 @@ Arguments:
         be used for exception stacks. Each stack takes up 16 bytes and there are
         4 modes, so at least 64 bytes are needed.
 
+    ExceptionStackSize - Supplies the size of each exception stack.
+
 Return Value:
 
     None.
@@ -71,7 +74,6 @@ FUNCTION ArpInitializeExceptionStacks
     ## Load R1 with an individual stack size.
     ##
 
-    ldr     %r1, =EXCEPTION_STACK_SIZE
     add     %r0, %r0, %r1
 
     ##

+ 4 - 2
uefi/core/armv7/commsup.S

@@ -40,7 +40,8 @@ ASSEMBLY_FILE_HEADER
 ##
 ## VOID
 ## EfipInitializeExceptionStacks (
-##     PVOID ExceptionStacksBase
+##     PVOID ExceptionStacksBase,
+##     ULONG ExceptionStackSize
 ##     )
 ##
 
@@ -59,6 +60,8 @@ Arguments:
         be used for exception stacks. Each stack takes up 16 bytes and there are
         4 modes, so at least 64 bytes are needed.
 
+    ExceptionStackSize - Supplies the size of each exception stack.
+
 Return Value:
 
     None.
@@ -71,7 +74,6 @@ FUNCTION EfipInitializeExceptionStacks
     ## Load R1 with an individual stack size.
     ##
 
-    ldr     %r1, =EXCEPTION_STACK_SIZE
     add     %r0, %r0, %r1
 
     ##

+ 3 - 2
uefi/core/armv7/prochw.c

@@ -47,7 +47,8 @@ Environment:
 
 VOID
 EfipInitializeExceptionStacks (
-    PVOID ExceptionStacksBase
+    PVOID ExceptionStacksBase,
+    ULONG ExceptionStackSize
     );
 
 VOID
@@ -185,7 +186,7 @@ Return Value:
 
 {
 
-    EfipInitializeExceptionStacks(EfiExceptionStacks);
+    EfipInitializeExceptionStacks(EfiExceptionStacks, EXCEPTION_STACK_SIZE);
     EfipInitializeInterrupts();
     return;
 }