#include <ppcmmu/mmu.h>\r
\r
#define NDEBUG\r
-#include <internal/debug.h>\r
+#include <debug.h>\r
\r
KDPC KiExpireTimerDpc;\r
extern ULONG KiMaximumDpcQueueDepth;\r
extern ULONG KeMinimumIncrement;\r
extern ULONG KeTimeAdjustment;\r
\r
+extern void PearPCDebug(int ch);\r
+\r
/* GLOBALS *****************************************************************/\r
\r
/* Interrupt handler list */\r
* @implemented\r
*/\r
VOID\r
-STDCALL\r
+NTAPI\r
KeUpdateRunTime(IN PKTRAP_FRAME TrapFrame,\r
IN KIRQL Irql)\r
{\r
* @implemented\r
*/\r
VOID\r
-STDCALL\r
+NTAPI\r
KeUpdateSystemTime(IN PKTRAP_FRAME TrapFrame,\r
IN KIRQL Irql,\r
IN ULONG Increment)\r
SharedUserData->TickCount.LowPart = Time.LowPart;\r
SharedUserData->TickCount.High1Time = Time.HighPart;\r
\r
- /* Update tick count in shared user data as well */\r
- SharedUserData->TickCountLowDeprecated++;\r
-\r
/* Queue a DPC that will expire timers */\r
KeInsertQueueDpc(&KiExpireTimerDpc, 0, 0);\r
}\r
}\r
}\r
\r
-VOID STDCALL\r
+VOID NTAPI\r
KiInterruptDispatch2 (ULONG vector, KIRQL old_level)\r
/*\r
* FUNCTION: Calls all the interrupt handlers for a given irq.\r
CurrentThread = KeGetCurrentThread();\r
if (CurrentThread!=NULL && CurrentThread->ApcState.UserApcPending)\r
{\r
- DPRINT("PID: %d, TID: %d CS %04x/%04x\n",\r
- ((PETHREAD)CurrentThread)->ThreadsProcess->UniqueProcessId,\r
- ((PETHREAD)CurrentThread)->Cid.UniqueThread,\r
- Trapframe->Cs,\r
- CurrentThread->TrapFrame ? CurrentThread->TrapFrame->Cs : 0);\r
if (CurrentThread->TrapFrame == NULL)\r
{\r
OldTrapFrame = CurrentThread->TrapFrame;\r
* @implemented\r
*/\r
BOOLEAN\r
-STDCALL\r
+NTAPI\r
KeConnectInterrupt(PKINTERRUPT InterruptObject)\r
{\r
KIRQL oldlvl,synch_oldlvl;\r
* InterruptObject = isr to release\r
*/\r
BOOLEAN\r
-STDCALL\r
+NTAPI\r
KeDisconnectInterrupt(PKINTERRUPT InterruptObject)\r
{\r
KIRQL oldlvl,synch_oldlvl;\r
* @implemented\r
*/\r
VOID\r
-STDCALL\r
+NTAPI\r
KeInitializeInterrupt(PKINTERRUPT Interrupt,\r
PKSERVICE_ROUTINE ServiceRoutine,\r
PVOID ServiceContext,\r
NTAPI\r
KdpServiceDispatcher(ULONG Service, PCHAR Buffer, ULONG Length);\r
\r
-__asm__(".globl KiSystemService\n\t"\r
- ".globl KiSystemService1\n\t"\r
- ".globl kiss_proceed\n\t"\r
- ".globl kiss_end\n"\r
- "KiSystemService1:\n\t"\r
- "stw 2,4(1)\n\t" // r1\r
- "stw 3,12(1)\n\t"\r
- "stw 4,16(1)\n\t"\r
- "stw 5,20(1)\n\t"\r
- "stw 6,24(1)\n\t"\r
- "stw 7,28(1)\n\t"\r
- "stw 8,32(1)\n\t"\r
- "stw 9,36(1)\n\t"\r
- "stw 10,40(1)\n\t"\r
- "stw 11,44(1)\n\t"\r
- "stw 12,48(1)\n\t"\r
- "stw 13,52(1)\n\t"\r
- "stw 14,56(1)\n\t"\r
- "stw 15,60(1)\n\t"\r
- "stw 16,64(1)\n\t"\r
- "stw 17,68(1)\n\t"\r
- "stw 18,72(1)\n\t"\r
- "stw 19,76(1)\n\t"\r
- "stw 20,80(1)\n\t"\r
- "stw 21,84(1)\n\t"\r
- "stw 22,88(1)\n\t"\r
- "stw 23,92(1)\n\t"\r
- "stw 24,96(1)\n\t"\r
- "stw 25,100(1)\n\t"\r
- "stw 26,104(1)\n\t"\r
- "stw 27,108(1)\n\t"\r
- "stw 28,112(1)\n\t"\r
- "stw 29,116(1)\n\t"\r
- "stw 30,120(1)\n\t"\r
- "stw 31,124(1)\n\t"\r
- /* This save is important */\r
- "stw 0,140(1)\n\t" // srr0\r
- "mflr 0\n\t"\r
- "stw 0,128(1)\n\t"\r
- "mfctr 0\n\t"\r
- "stw 0,136(1)\n\t"\r
- "mfsrr1 0\n\t"\r
- "stw 0,144(1)\n\t"\r
- "mfdsisr 0\n\t"\r
- "stw 0,148(1)\n\t"\r
- "mfdar 0\n\t"\r
- "stw 0,152(1)\n\t"\r
- "lis 3,KiSystemService@ha\n\t"\r
- "addi 3,3,KiSystemService@l\n\t"\r
- "mtctr 3\n\t"\r
- "mr 3,1\n\t"\r
- "subi 1,1,0x100\n\t"\r
- "bctrl\n\t"\r
- "addi 1,1,0x100\n\t"\r
- /* Return from kernel */\r
- "lwz 3,12(1)\n\t" /* Result */\r
- "lwz 0,128(1)\n\t"\r
- "mtlr 0\n\t"\r
- "lwz 0,140(1)\n\t"\r
- "mtsrr0 0\n\t"\r
- "lwz 0,144(1)\n\t"\r
- "mtsrr1 0\n\t"\r
- "lwz 1,4(1)\n" /* Stack */\r
- "rfi\n");\r
+typedef ULONG (*PSYSCALL_FUN)\r
+(ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG,ULONG);\r
\r
VOID\r
NTAPI\r
KiSystemService(ppc_trap_frame_t *trap_frame)\r
{\r
int i;\r
- switch(trap_frame->gpr[8])\r
+ PKSYSTEM_ROUTINE SystemRoutine;\r
+ PSYSCALL_FUN SyscallFunction;\r
+\r
+ switch(trap_frame->gpr[0])\r
{\r
case 0x10000: /* DebugService */\r
for( i = 0; i < trap_frame->gpr[5]; i++ )\r
- SetPhysByte(0x800003f8, ((PCHAR)trap_frame->gpr[4])[i]);\r
-\r
+ {\r
+ PearPCDebug(((PCHAR)trap_frame->gpr[4])[i]);\r
+ WRITE_PORT_UCHAR((PVOID)0x800003f8, ((PCHAR)trap_frame->gpr[4])[i]);\r
+ }\r
trap_frame->gpr[3] = KdpServiceDispatcher\r
(trap_frame->gpr[3],\r
(PCHAR)trap_frame->gpr[4],\r
trap_frame->gpr[5]);\r
break;\r
+ case 0xf0000: /* Thread startup */\r
+ /* XXX how to use UserThread (gpr[6]) */\r
+ SystemRoutine = (PKSYSTEM_ROUTINE)trap_frame->gpr[3];\r
+ SystemRoutine((PKSTART_ROUTINE)trap_frame->gpr[4], \r
+ (PVOID)trap_frame->gpr[5]);\r
+ break;\r
+\r
+ /* Handle a normal system call */\r
+ default:\r
+ SyscallFunction = \r
+ ((PSYSCALL_FUN*)KeServiceDescriptorTable\r
+ [trap_frame->gpr[0] >> 12].Base)[trap_frame->gpr[0] & 0xfff];\r
+ trap_frame->gpr[3] = SyscallFunction\r
+ (trap_frame->gpr[3],\r
+ trap_frame->gpr[4],\r
+ trap_frame->gpr[5],\r
+ trap_frame->gpr[6],\r
+ trap_frame->gpr[7],\r
+ trap_frame->gpr[8],\r
+ trap_frame->gpr[9],\r
+ trap_frame->gpr[10],\r
+ trap_frame->gpr[11],\r
+ trap_frame->gpr[12]);\r
+ break;\r
}\r
}\r
\r