Author: ros-arm-bringup
Date: Mon Jun 23 11:08:32 2008
New Revision: 34061
URL:
http://svn.reactos.org/svn/reactos?rev=34061&view=rev
Log:
- Fix broken system call handler with shitty but works system call handler.
- Fix broken .rbuild file -- not sure how this was supposed to build in the first place.
- This gets us further -- more of ARM Mm needs implementing.
Modified:
trunk/reactos/ReactOS-arm.rbuild
trunk/reactos/ntoskrnl/ke/arm/trap.s
trunk/reactos/ntoskrnl/ke/arm/trapc.c
Modified: trunk/reactos/ReactOS-arm.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ReactOS-arm.rbuild?rev=340…
==============================================================================
--- trunk/reactos/ReactOS-arm.rbuild [iso-8859-1] (original)
+++ trunk/reactos/ReactOS-arm.rbuild [iso-8859-1] Mon Jun 23 11:08:32 2008
@@ -80,7 +80,7 @@
<directory name="drivers">
<directory name="csq">
<xi:include href="lib/drivers/csq/csq.rbuild" />
-/directory>
+ </directory>
</directory>
<directory name="debugsup">
<xi:include href="lib/debugsup/debugsup.rbuild" />
Modified: trunk/reactos/ntoskrnl/ke/arm/trap.s
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trap.s?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trap.s [iso-8859-1] Mon Jun 23 11:08:32 2008
@@ -42,16 +42,22 @@
NESTED_ENTRY KiSoftwareInterruptException
PROLOG_END KiSoftwareInterruptException
-
- //
- // Save return address
+
+ //
+ // Save the current lr
//
str lr, [sp, #-4]!
//
+ // Save the SVC lr and sp
+ //
+ str lr, [sp, #-4]!
+ str sp, [sp, #-4]!
+
+ //
// Make space for trap frame
//
- sub sp, sp, #(4*17)
+ sub sp, sp, #(4*15)
//
// Save user-mode registers
@@ -77,7 +83,7 @@
//
mov r0, sp
bl KiSoftwareInterruptHandler
-
+
//
// Skip IRQL
//
@@ -391,24 +397,65 @@
//
ldmia r5, {a1-a4}
add r5, r5, #(4* 4)
- //sub r6, r6, #4
-
- //
- // Now copy the other arguments into our stack
- //
+
+ //
+ //
+ // This code is complete shit.
+ //
+ //
+
+ //
+ // Save stack address and return address
+ //
+ mov r11, sp
+ mov r10, lr
+
+ //
+ // Check if we have more than 4 arguments
+ //
+ cmp r6, #4
+ ble SysCall
+
+ //
+ // Make space on stack
+ //
+ sub r6, r6, #4
+ sub sp, sp, r6, lsl #2
+
CopyLoop:
- cmp r6, #4
- //strne sp, [r5], #4
- //subne r6, r6, #1
- bge .
-
+ //
+ // Copy one parameter
+ //
+ ldr r7, [r5]
+ str r7, [sp]
+ add r5, r5, #4
+ add sp, sp, #4
+
+ //
+ // Keep looping until we've copied them all
+ //
+ cmp sp, r11
+ bne CopyLoop
+
+ //
+ // Set the stack
+ //
+ sub sp, sp, r6, lsl #2
+
//
// Now do the system call
//
+SysCall:
+ mov lr, pc
mov pc, r4
-
- //
- // Should not get here
- //
- b .
+
+ //
+ // Restore the stack
+ //
+ mov sp, r11
+
+ //
+ // Get us back
+ //
+ mov pc, r10
ENTRY_END KiSystemCall
Modified: trunk/reactos/ntoskrnl/ke/arm/trapc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ke/arm/trapc.c?re…
==============================================================================
--- trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/ke/arm/trapc.c [iso-8859-1] Mon Jun 23 11:08:32 2008
@@ -476,6 +476,7 @@
//
// Copy them into the kernel stack
//
+ DPRINT1("Argument: %p\n", *Argument);
Arguments[i] = *Argument;
Argument++;
}
@@ -501,17 +502,22 @@
// We were called from the kernel
//
Argument = (PULONG)TrapFrame->SvcSp;
+
+ //
+ // Bias for the values we saved
+ //
+ Argument += 2;
}
//
// Copy the rest
//
- DPRINT1("Stack: %p\n", Argument);
for (i = 4; i < ArgumentCount; i++)
{
//
// Copy into kernel stack
//
+ DPRINT1("Argument: %p\n", *Argument);
Arguments[i] = *Argument;
Argument++;
}
@@ -521,6 +527,7 @@
// Do the system call and save result in EAX
//
TrapFrame->R0 = KiSystemCall(SystemCall, Arguments, ArgumentCount);
+ DPRINT1("Returned: %lx\n", TrapFrame->R0);
}
VOID