//printf("LOADER: enter process_stabs()\n");
- memset((void*)&SymbolFileHeader,0,sizeof(SymbolFileHeader));
+ PICE_memset((void*)&SymbolFileHeader,0,sizeof(SymbolFileHeader));
SymbolFileHeader.magic = PICE_MAGIC;
strcpy(temp,pExeName);
pSlash = strrchr(temp,'/');
if(p)
{
//printf("LOADER: malloc'd @ %x\n",p);
- memset(p,0,len+16);
+ PICE_memset(p,0,len+16);
if(len == read(file,p,len))
{
ENTER_FUNC();
// preset ohandlers and ihandler to NULL
- memset((void*)&ohandlers,0,sizeof(ohandlers));
- memset((void*)&ihandlers,0,sizeof(ihandlers));
+ PICE_memset((void*)&ohandlers,0,sizeof(ohandlers));
+ PICE_memset((void*)&ihandlers,0,sizeof(ihandlers));
switch(eTerminalMode)
{
////
#include "remods.h"
#include "precomp.h"
-
+/*
#include <linux/sched.h>
#include <asm/io.h>
#include <asm/page.h>
#include <linux/sched.h>
#include <linux/console.h>
#include <asm/delay.h>
+*/
char tempOutput[1024],tempOutput2[1024];
BOOLEAN bIsDebugPrint = FALSE;
ULONG ulCountTimerEvents = 0;
-struct timer_list sPiceRunningTimer;
asmlinkage int printk(const char *fmt, ...);
asmlinkage int printk(const char *fmt, ...)
{
ULONG len,ulRingBufferLock;
- static ULONG ulOldJiffies = 0;
+ static LONGLONG ulOldJiffies = 0;
+ LARGE_INTEGER jiffies;
+
va_list args;
va_start(args, fmt);
PICE_vsprintf(tempOutput, fmt, args);
bIsDebugPrint = TRUE;
- // if the last debug print was longer than 5 timer ticks ago
+ // if the last debug print was longer than 50 ms ago
// directly print it, else just add it to the ring buffer
// and let the timer process it.
- if( (jiffies-ulOldJiffies) > (1*wWindow[OUTPUT_WINDOW].cy)/2)
+ KeQuerySystemTime(&jiffies);
+ if( (jiffies.QuadPart-ulOldJiffies) > 10000*(1*wWindow[OUTPUT_WINDOW].cy)/2)
{
- ulOldJiffies = jiffies;
+ ulOldJiffies = jiffies.QuadPart;
Print(OUTPUT_WINDOW,tempOutput);
}
else
// PiceRunningTimer()
//
//*************************************************************************
-void PiceRunningTimer(unsigned long param)
-{
- mod_timer(&sPiceRunningTimer,jiffies + HZ/10);
+KTIMER PiceTimer;
+KDPC PiceTimerDPC;
+
+// do I need it here? Have to keep DPC memory resident #pragma code_seg()
+VOID PiceRunningTimer(IN PKDPC Dpc,
+ IN PVOID DeferredContext,
+ IN PVOID SystemArgument1,
+ IN PVOID SystemArgument2)
+{
CheckRingBuffer();
if(ulCountTimerEvents++ > 10)
{
ulCountTimerEvents = 0;
+ LARGE_INTEGER jiffies;
+
+ KeQuerySystemTime(&jiffies);
SetForegroundColor(COLOR_TEXT);
SetBackgroundColor(COLOR_CAPTION);
- PICE_sprintf(tempOutput,"jiffies = %.8X\n",jiffies);
+ PICE_sprintf(tempOutput,"jiffies = %.8X\n",jiffies.LowPart);
PutChar(tempOutput,GLOBAL_SCREEN_WIDTH-strlen(tempOutput),GLOBAL_SCREEN_HEIGHT-1);
ResetColor();
}
//*************************************************************************
void InitPiceRunningTimer(void)
{
- init_timer(&sPiceRunningTimer);
- sPiceRunningTimer.data = 0;
- sPiceRunningTimer.function = PiceRunningTimer;
- sPiceRunningTimer.expires = jiffies + HZ;
- add_timer(&sPiceRunningTimer);
+ LARGE_INTEGER Interval;
+
+ ENTER_FUNC();
+ÿÿ
+ KeInitializeTimer( &PiceTimer );
+ KeInitializeDpc( &PiceTimerDPC, PiceRunningTimer, NULL );
+
+ Interval.QuadPart=-1000000L; // 100 millisec. (unit is 100 nanosec.)
+
+ KeSetTimerEx(&PiceTimer,
+ Interval, 1000000L,
+ &PiceTimerDpc);
+ LEAVE_FUNC();
}
//*************************************************************************
//*************************************************************************
void RemovePiceRunningTimer(void)
{
- del_timer(&sPiceRunningTimer);
+ KeCancelTimer( &PiceTimer );
}
//*************************************************************************
void InstallPrintkHook(void)
{
ENTER_FUNC();
- DPRINT((0,"enter InstallPrintk()\n"));
+ DPRINT((0,"installing PrintString hook\n"));
+
+ ScanExports("_KdpPrintString",(PULONG)&ulPrintk);
+
+ ASSERT( ulPrintk ); // temporary
- ScanExports("printk",(PULONG)&ulPrintk);
if(ulPrintk)
{
InstallSWBreakpoint(ulPrintk,TRUE,PrintkCallback);
DPRINT((0,"initial offset = %X\n",ulOffset));
*pOffset = ulOffset;
- while((memcmp(pPatchAddress,ucPattern,sizeof(ucPattern))!=0) &&
+ while((RtlCompareMemory(pPatchAddress,ucPattern,sizeof(ucPattern))!=0) &&
(countBytes<0x1000))
{
/* DPRINT((0,"offset = %X\n",ulOffset));
*pOffset = ulOffset;
}
- if(memcmp(pPatchAddress,ucPattern,sizeof(ucPattern))==0)
+ if(RtlCompareMemory(pPatchAddress,ucPattern,sizeof(ucPattern))==0)
{
DPRINT((0,"pattern found @ %x\n",pPatchAddress));
/* We don't want to talk to two processes at the
* same time */
- if (bDeviceAlreadyOpen)
- return STATUS_UNSUCCESSFUL; /* is there a more descriptive status code for this case? */
+ if (bDeviceAlreadyOpen){
+ IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ return STATUS_UNSUCCESSFUL; /* is there a more descriptive status code for this case? */
+ }
bDeviceAlreadyOpen = TRUE;
-
+ IoCompleteRequest (Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
/* We're now ready for our next caller */
bDeviceAlreadyOpen = FALSE;
+ IoCompleteRequest (Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
}
break;
default:
- return STATUS_BAD_PARAMETER;
+ IoCompleteRequest (Irp, IO_NO_INCREMENT);
+ return STATUS_BAD_PARAMETER;
}
-
+ IoCompleteRequest (Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
This file may be distributed under the terms of the GNU Public License.
--*/
-#include <linux/kernel.h>
-#define __NO_VERSION__
-#include <linux/module.h>
-#include <linux/version.h>
+
p = temp;
for(;*pStr!=0x0a;)*p++=*pStr++;
*p=0;
- p = strtok(temp," ");
+ p = PICE_strtok(temp," ");
state=0;
while(p)
{
}
state++;
- p = strtok(NULL," ");
+ p = PICE_strtok(NULL," ");
}
}
//************************************************************************
void outportb(USHORT port,UCHAR data)
{
- outb(data,port);
+ WRITE_PORT_UCHAR(data,port);
+}
+
+void outb_p(UCHAR data, USHORT port)
+{
+ WRITE_PORT_UCHAR(data,port);
}
//************************************************************************
//************************************************************************
UCHAR inportb(USHORT port)
{
- return inb(port);
+ return READ_PORT_UCHAR(port);
}
+
+UCHAR inb_p(USHORT port)
+{
+ return READ_PORT_UCHAR(port);
+}
+
//*************************************************************************
// GetInitMm()
#define GLOBAL_CODE_SEGMENT (__KERNEL_CS)
#define GLOBAL_DATA_SEGMENT (__KERNEL_DS)
-#define OVR_CS .byte 0x2e
-#define OVR_FS .byte 0x64
+//#define OVR_CS .byte 0x2e
+//#define OVR_FS .byte 0x64
void DisplayRegs(void);
void SaveOldRegs(void);
void outportb(USHORT port,UCHAR data);
UCHAR inportb(USHORT port);
+void outb_p(UCHAR data, USHORT port);
+UCHAR inb_p(USHORT port);
+
+#define save_flags(x) __asm__ __volatile__("pushfl ; popl %0":"=g" (x): /* no input */)
+#define restore_flags(x) __asm__ __volatile__("pushl %0 ; popfl": /* no output */ :"g" (x):"memory", "cc")
+#define cli() __asm__ __volatile__("cli": : :"memory")
+#define sti() __asm__ __volatile__("sti": : :"memory")
+
+
extern unsigned long sys_call_table[];
struct mm_struct *GetInitMm(void);
#include "remods.h"
#include "precomp.h"
-#include <asm/io.h>
+//#include <asm/io.h>
#include <linux/ctype.h>