Author: arty
Date: Tue Jun 12 12:03:54 2007
New Revision: 27152
URL:
http://svn.reactos.org/svn/reactos?rev=27152&view=rev
Log:
Working syscall. Should be good for both usermode and kernel mode.
Modified:
branches/powerpc/reactos/lib/rtl/powerpc/debug.c
branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c
branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c
Modified: branches/powerpc/reactos/lib/rtl/powerpc/debug.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/lib/rtl/powerpc…
==============================================================================
--- branches/powerpc/reactos/lib/rtl/powerpc/debug.c (original)
+++ branches/powerpc/reactos/lib/rtl/powerpc/debug.c Tue Jun 12 12:03:54 2007
@@ -15,14 +15,14 @@
(ULONG Service, const void *Buffer, ULONG Length, PVOID Arg1, PVOID Arg2)
{
NTSTATUS Result;
- __asm__("mr 3,%1\n\t"
- "mr 4,%2\n\t"
- "mr 5,%3\n\t"
- "mr 6,%4\n\t"
- "mr 7,%5\n\t"
- "mr 8,%6\n\t"
+ __asm__("mr 3,%2\n\t"
+ "mr 4,%3\n\t"
+ "mr 5,%4\n\t"
+ "mr 6,%5\n\t"
+ "mr 7,%6\n\t"
+ "mr 8,%1\n\t"
"sc\n\t"
- "mr %0,3\n\t" :
+ "mr %0,3\n\t" :
"=r" (Result) :
"r" (0x10000),
"r" (Service),
Modified: branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/pow…
==============================================================================
--- branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c (original)
+++ branches/powerpc/reactos/ntoskrnl/ke/powerpc/kiinit.c Tue Jun 12 12:03:54 2007
@@ -40,56 +40,14 @@
".globl syscall_end\n\t"
".globl KiSystemService\n\t"
"syscall_start:\n\t"
- "mtsprg1 1\n\t"
- "lis 1,_kernel_trap_stack_top@ha\n\t"
- "addi 1,1,_kernel_trap_stack_top@l\n\t"
+ "mr 2,1\n\t"
+ "lis 1,KiSystemService1@ha\n\t"
+ "addi 1,1,KiSystemService1@l\n\t"
+ "mfsrr0 0\n\t"
+ "mtsrr0 1\n\t"
+ "lis 1,_kernel_trap_stack@ha\n\t"
+ "addi 1,1,_kernel_trap_stack@l\n\t"
"subi 1,1,0x100\n\t"
- "stw 0,0(1)\n\t"
- "mfsprg1 0\n\t" /* 10 */
- "stw 0,4(1)\n\t"
- "stw 2,8(1)\n\t"
- "stw 3,12(1)\n\t"
- "stw 4,16(1)\n\t" /* 20 */
- "stw 5,20(1)\n\t"
- "stw 6,24(1)\n\t"
- "stw 7,28(1)\n\t"
- "stw 8,32(1)\n\t" /* 30 */
- "stw 9,36(1)\n\t"
- "stw 10,40(1)\n\t"
- "stw 11,44(1)\n\t"
- "stw 12,48(1)\n\t" /* 40 */
- "stw 13,52(1)\n\t"
- "stw 14,56(1)\n\t"
- "stw 15,60(1)\n\t"
- "stw 16,64(1)\n\t" /* 50 */
- "stw 17,68(1)\n\t"
- "stw 18,72(1)\n\t"
- "stw 19,76(1)\n\t"
- "stw 20,80(1)\n\t" /* 60 */
- "stw 21,84(1)\n\t"
- "stw 22,88(1)\n\t"
- "stw 23,92(1)\n\t"
- "stw 24,96(1)\n\t" /* 70 */
- "stw 25,100(1)\n\t"
- "stw 26,104(1)\n\t"
- "stw 27,108(1)\n\t"
- "stw 28,112(1)\n\t" /* 80 */
- "stw 29,116(1)\n\t"
- "stw 30,120(1)\n\t"
- "stw 31,124(1)\n\t"
- "mflr 0\n\t" /* 90 */
- "stw 0,128(1)\n\t"
- "mfctr 0\n\t"
- "stw 0,132(1)\n\t"
- "mfsrr0 0\n\t" /* a0 */
- "stw 0,136(1)\n\t"
- "mfsrr1 0\n\t"
- "stw 0,140(1)\n\t"
- "mfdsisr 0\n\t" /* b0 */
- "stw 0,144(1)\n\t"
- "lis 3,KiSystemService@ha\n\t" /* b8 */
- "addi 3,3,KiSystemService@l\n\t" /* bc */
- "mtsrr0 3\n\t"
"rfi\n\t"
"syscall_end:\n\t"
".space 4");
Modified: branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/ntoskrnl/ke/pow…
==============================================================================
--- branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c (original)
+++ branches/powerpc/reactos/ntoskrnl/ke/powerpc/ppc_irq.c Tue Jun 12 12:03:54 2007
@@ -749,16 +749,93 @@
return Return;
}
+ULONG
+NTAPI
+KdpServiceDispatcher(ULONG Service, PCHAR Buffer, ULONG Length);
+
+__asm__(".globl KiSystemService\n\t"
+ ".globl KiSystemService1\n\t"
+ ".globl kiss_proceed\n\t"
+ ".globl kiss_end\n"
+ "KiSystemService1:\n\t"
+ "stw 2,4(1)\n\t" // r1
+ "stw 3,12(1)\n\t"
+ "stw 4,16(1)\n\t"
+ "stw 5,20(1)\n\t"
+ "stw 6,24(1)\n\t"
+ "stw 7,28(1)\n\t"
+ "stw 8,32(1)\n\t"
+ "stw 9,36(1)\n\t"
+ "stw 10,40(1)\n\t"
+ "stw 11,44(1)\n\t"
+ "stw 12,48(1)\n\t"
+ "stw 13,52(1)\n\t"
+ "stw 14,56(1)\n\t"
+ "stw 15,60(1)\n\t"
+ "stw 16,64(1)\n\t"
+ "stw 17,68(1)\n\t"
+ "stw 18,72(1)\n\t"
+ "stw 19,76(1)\n\t"
+ "stw 20,80(1)\n\t"
+ "stw 21,84(1)\n\t"
+ "stw 22,88(1)\n\t"
+ "stw 23,92(1)\n\t"
+ "stw 24,96(1)\n\t"
+ "stw 25,100(1)\n\t"
+ "stw 26,104(1)\n\t"
+ "stw 27,108(1)\n\t"
+ "stw 28,112(1)\n\t"
+ "stw 29,116(1)\n\t"
+ "stw 30,120(1)\n\t"
+ "stw 31,124(1)\n\t"
+ /* This save is important */
+ "stw 0,140(1)\n\t" // srr0
+ "mflr 0\n\t"
+ "stw 0,128(1)\n\t"
+ "mfctr 0\n\t"
+ "stw 0,136(1)\n\t"
+ "mfsrr1 0\n\t"
+ "stw 0,144(1)\n\t"
+ "mfdsisr 0\n\t"
+ "stw 0,148(1)\n\t"
+ "mfdar 0\n\t"
+ "stw 0,152(1)\n\t"
+ "lis 3,KiSystemService@ha\n\t"
+ "addi 3,3,KiSystemService@l\n\t"
+ "mtctr 3\n\t"
+ "mr 3,1\n\t"
+ "subi 1,1,0x100\n\t"
+ "bctrl\n\t"
+ "addi 1,1,0x100\n\t"
+ /* Return from kernel */
+ "lwz 3,12(1)\n\t" /* Result */
+ "lwz 0,128(1)\n\t"
+ "mtlr 0\n\t"
+ "lwz 0,140(1)\n\t"
+ "mtsrr0 0\n\t"
+ "lwz 0,144(1)\n\t"
+ "mtsrr1 0\n\t"
+ "lwz 1,4(1)\n" /* Stack */
+ "rfi\n");
+
VOID
NTAPI
-KiSystemService()
+KiSystemService(ppc_trap_frame_t *trap_frame)
{
SetPhysByte(0x800003f8, 'S');
SetPhysByte(0x800003f8, 'C');
SetPhysByte(0x800003f8, '!');
SetPhysByte(0x800003f8, '\r');
SetPhysByte(0x800003f8, '\n');
- while(1);
+ switch(trap_frame->gpr[8])
+ {
+ case 0x10000: /* DebugService */
+ trap_frame->gpr[3] = KdpServiceDispatcher
+ (trap_frame->gpr[3],
+ (PCHAR)trap_frame->gpr[4],
+ trap_frame->gpr[5]);
+ break;
+ }
}
/* EOF */