diff --git a/reactos/apps/utils/pice/loader/main.c b/reactos/apps/utils/pice/loader/main.c index 5ed33924cfb..7d3e2447ec3 100644 --- a/reactos/apps/utils/pice/loader/main.c +++ b/reactos/apps/utils/pice/loader/main.c @@ -82,7 +82,7 @@ void process_stabs( //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,'/'); @@ -502,7 +502,7 @@ int process_file(char* filename) 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)) { diff --git a/reactos/apps/utils/pice/module/hardware.c b/reactos/apps/utils/pice/module/hardware.c index 1db5e1d54f0..d0fea1f7e1e 100644 --- a/reactos/apps/utils/pice/module/hardware.c +++ b/reactos/apps/utils/pice/module/hardware.c @@ -952,8 +952,8 @@ BOOLEAN ConsoleInit(void) 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) { diff --git a/reactos/apps/utils/pice/module/output.c b/reactos/apps/utils/pice/module/output.c index 5369b091aed..d55c8925369 100644 --- a/reactos/apps/utils/pice/module/output.c +++ b/reactos/apps/utils/pice/module/output.c @@ -34,7 +34,7 @@ Copyright notice: //// #include "remods.h" #include "precomp.h" - +/* #include #include #include @@ -43,6 +43,7 @@ Copyright notice: #include #include #include +*/ char tempOutput[1024],tempOutput2[1024]; @@ -51,7 +52,6 @@ BOOLEAN bInPrintk = FALSE; BOOLEAN bIsDebugPrint = FALSE; ULONG ulCountTimerEvents = 0; -struct timer_list sPiceRunningTimer; asmlinkage int printk(const char *fmt, ...); @@ -65,7 +65,9 @@ EXPORT_SYMBOL(printk); 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); @@ -76,12 +78,13 @@ asmlinkage int printk(const char *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 @@ -183,19 +186,28 @@ void PrintkCallback(void) // 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(); } @@ -207,11 +219,19 @@ void PiceRunningTimer(unsigned long param) //************************************************************************* 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(); } //************************************************************************* @@ -220,7 +240,7 @@ void InitPiceRunningTimer(void) //************************************************************************* void RemovePiceRunningTimer(void) { - del_timer(&sPiceRunningTimer); + KeCancelTimer( &PiceTimer ); } //************************************************************************* @@ -230,9 +250,12 @@ void RemovePiceRunningTimer(void) 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); diff --git a/reactos/apps/utils/pice/module/patch.c b/reactos/apps/utils/pice/module/patch.c index 159fd165cde..4d2967cad8b 100644 --- a/reactos/apps/utils/pice/module/patch.c +++ b/reactos/apps/utils/pice/module/patch.c @@ -125,7 +125,7 @@ BOOLEAN PatchKeyboardDriver(ULONG AddrOfKbdEvent,ULONG AddrOfScancode) 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)); @@ -140,7 +140,7 @@ BOOLEAN PatchKeyboardDriver(ULONG AddrOfKbdEvent,ULONG AddrOfScancode) *pOffset = ulOffset; } - if(memcmp(pPatchAddress,ucPattern,sizeof(ucPattern))==0) + if(RtlCompareMemory(pPatchAddress,ucPattern,sizeof(ucPattern))==0) { DPRINT((0,"pattern found @ %x\n",pPatchAddress)); diff --git a/reactos/apps/utils/pice/module/privateice.c b/reactos/apps/utils/pice/module/privateice.c index 5b5f0be4ab2..6bd24dfbaa1 100644 --- a/reactos/apps/utils/pice/module/privateice.c +++ b/reactos/apps/utils/pice/module/privateice.c @@ -74,11 +74,13 @@ NTSTATUS STDCALL pice_open(PDEVICE_OBJECT DeviceObject, PIRP Irp) /* 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; } @@ -94,6 +96,7 @@ NTSTATUS STDCALL pice_close(PDEVICE_OBJECT DeviceObject, PIRP Irp) /* We're now ready for our next caller */ bDeviceAlreadyOpen = FALSE; + IoCompleteRequest (Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; } @@ -147,9 +150,10 @@ NTSTATUS STDCALL pice_ioctl(PDEVICE_OBJECT DeviceObject, PIRP Irp) } break; default: - return STATUS_BAD_PARAMETER; + IoCompleteRequest (Irp, IO_NO_INCREMENT); + return STATUS_BAD_PARAMETER; } - + IoCompleteRequest (Irp, IO_NO_INCREMENT); return STATUS_SUCCESS; } diff --git a/reactos/apps/utils/pice/module/remods.h b/reactos/apps/utils/pice/module/remods.h index 5075f4f4ce0..6c64d78cc13 100644 --- a/reactos/apps/utils/pice/module/remods.h +++ b/reactos/apps/utils/pice/module/remods.h @@ -28,9 +28,6 @@ Copyright notice: This file may be distributed under the terms of the GNU Public License. --*/ -#include -#define __NO_VERSION__ -#include -#include + diff --git a/reactos/apps/utils/pice/module/symbols.c b/reactos/apps/utils/pice/module/symbols.c index 3b12f89d82e..5cbae230712 100644 --- a/reactos/apps/utils/pice/module/symbols.c +++ b/reactos/apps/utils/pice/module/symbols.c @@ -150,7 +150,7 @@ nomatch: p = temp; for(;*pStr!=0x0a;)*p++=*pStr++; *p=0; - p = strtok(temp," "); + p = PICE_strtok(temp," "); state=0; while(p) { @@ -174,7 +174,7 @@ nomatch: } state++; - p = strtok(NULL," "); + p = PICE_strtok(NULL," "); } } diff --git a/reactos/apps/utils/pice/module/utils.c b/reactos/apps/utils/pice/module/utils.c index 2b782c9fbbd..282637ee60f 100644 --- a/reactos/apps/utils/pice/module/utils.c +++ b/reactos/apps/utils/pice/module/utils.c @@ -2006,7 +2006,12 @@ UCHAR AsciiToScan(UCHAR s) //************************************************************************ 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); } //************************************************************************ @@ -2015,8 +2020,14 @@ void outportb(USHORT port,UCHAR data) //************************************************************************ UCHAR inportb(USHORT port) { - return inb(port); + return READ_PORT_UCHAR(port); } + +UCHAR inb_p(USHORT port) +{ + return READ_PORT_UCHAR(port); +} + //************************************************************************* // GetInitMm() diff --git a/reactos/apps/utils/pice/module/utils.h b/reactos/apps/utils/pice/module/utils.h index b369da0e3f9..0f0eb23633f 100644 --- a/reactos/apps/utils/pice/module/utils.h +++ b/reactos/apps/utils/pice/module/utils.h @@ -218,8 +218,8 @@ BOOLEAN Disasm(PULONG pOffset, PUCHAR pchDst); #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); @@ -239,6 +239,15 @@ UCHAR AsciiToScan(UCHAR s); 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); diff --git a/reactos/apps/utils/pice/module/vga.c b/reactos/apps/utils/pice/module/vga.c index 8d84c539e9b..78a02de3f8d 100644 --- a/reactos/apps/utils/pice/module/vga.c +++ b/reactos/apps/utils/pice/module/vga.c @@ -35,7 +35,7 @@ Copyright notice: #include "remods.h" #include "precomp.h" -#include +//#include #include