Replaced calls to _printk() by calls to DbgPrint().

svn path=/trunk/; revision=696
This commit is contained in:
Eric Kohl 1999-10-14 16:54:17 +00:00
parent babfe77ea9
commit 4551dfba1e
8 changed files with 38 additions and 102 deletions

View file

@ -39,12 +39,6 @@ extern descriptor gdt[256];
/* /*
* printf style functions * printf style functions
*/ */
void __putchar(char c);
void __goxy(unsigned x, unsigned y);
unsigned __wherex (void);
unsigned __wherey (void);
void __getscreensize (unsigned *maxx, unsigned *maxy);
asmlinkage void printk(const char* fmt, ...);
int vsprintf(char *buf, const char *fmt, va_list args); int vsprintf(char *buf, const char *fmt, va_list args);
int sprintf(char* buf, const char* fmt, ...); int sprintf(char* buf, const char* fmt, ...);
@ -94,6 +88,4 @@ VOID KeInit(VOID);
VOID HalInitConsole(boot_param* bp); VOID HalInitConsole(boot_param* bp);
VOID CmInitializeRegistry(VOID); VOID CmInitializeRegistry(VOID);
extern WCHAR wtolower(WCHAR ch);
#endif #endif

View file

@ -83,7 +83,7 @@ BOOL static checksum(bios32* service_entry)
{ {
sum=sum+p[i]; sum=sum+p[i];
} }
// printk("sum = %d\n",sum); // DbgPrint("sum = %d\n",sum);
if (sum==0) if (sum==0)
{ {
return(TRUE); return(TRUE);
@ -131,7 +131,7 @@ VOID Hal_bios32_probe()
{ {
continue; continue;
} }
// printk("Signature detected at %x\n",i); // DbgPrint("Signature detected at %x\n",i);
if (!checksum(service_entry)) if (!checksum(service_entry))
{ {
continue; continue;

View file

@ -244,7 +244,7 @@ asmlinkage void exception_handler(unsigned int edi,
DbgPrint("ESP %x\n",esp); DbgPrint("ESP %x\n",esp);
stack = (unsigned int *) (esp + 24); stack = (unsigned int *) (esp + 24);
printk("Stack:\n"); DbgPrint("Stack:\n");
for (i = 0; i < 16; i = i + 4) for (i = 0; i < 16; i = i + 4)
{ {
DbgPrint("%.8x %.8x %.8x %.8x\n", DbgPrint("%.8x %.8x %.8x %.8x\n",
@ -253,7 +253,7 @@ asmlinkage void exception_handler(unsigned int edi,
stack[i+2], stack[i+2],
stack[i+3]); stack[i+3]);
} }
printk("Frames:\n"); DbgPrint("Frames:\n");
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
{ {
if (stack[i] > ((unsigned int) &stext)) if (stack[i] > ((unsigned int) &stext))

View file

@ -391,7 +391,7 @@ ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType,
default: default:
ret = -1; ret = -1;
printk("(%s:%d) Don't know that bus type\n",__FILE__,__LINE__); DbgPrint("(%s:%d) Don't know that bus type\n",__FILE__,__LINE__);
break; break;
} }
return(ret); return(ret);

View file

@ -113,6 +113,9 @@ static unsigned int in_hal_console = 1;
/* FUNCTIONS ***************************************************************/ /* FUNCTIONS ***************************************************************/
void __putchar(char c);
void HalSwitchToBlueScreen(void) void HalSwitchToBlueScreen(void)
/* /*
* FUNCTION: Switches the monitor to text mode and writes a blue background * FUNCTION: Switches the monitor to text mode and writes a blue background
@ -164,11 +167,18 @@ void HalDisplayString(char* string)
* mode * mode
*/ */
{ {
char* str=string;
if (!in_hal_console) if (!in_hal_console)
{ {
HalSwitchToBlueScreen(); HalSwitchToBlueScreen();
} }
printk("%s",string);
while ((*str)!=0)
{
__putchar(*str);
str++;
}
} }
void __putchar(char c) void __putchar(char c)
@ -220,23 +230,6 @@ void __putchar(char c)
} }
} }
#if 0
if (lines_seen == 24)
{
char str[] = "--- press escape to continue";
lines_seen = 0;
for (i = 0; str[i] != 0; i++)
{
vidmem[NR_COLUMNS*(NR_ROWS-1)*2+i*2] = str[i];
vidmem[NR_COLUMNS*(NR_ROWS-1)*2+i*2+1] = CharAttribute;
}
while (inb_p(0x60)!=0x81);
memset(&vidmem[NR_COLUMNS*(NR_ROWS-1)*2],0,NR_COLUMNS*2);
}
#endif
if (cursory >= NR_ROWS) if (cursory >= NR_ROWS)
{ {
unsigned short *LinePtr; unsigned short *LinePtr;
@ -265,55 +258,10 @@ void __putchar(char c)
outb_p(CRTC_DATA, offset); outb_p(CRTC_DATA, offset);
} }
asmlinkage void printk(const char* fmt, ...)
/*
* FUNCTION: Print a formatted string to the hal console
* ARGUMENTS: As for printf
* NOTE: So it can used from irq handlers this function disables interrupts
* during its execution, they are restored to the previous state on return
*/
{
char buffer[256];
char* str=buffer;
va_list ap;
unsigned int eflags;
/*
* Because this is used by alomost every subsystem including irqs it
* must be atomic. The following code sequence disables interrupts after
* saving the previous state of the interrupt flag
*/
__asm__("pushf\n\tpop %0\n\tcli\n\t"
: "=m" (eflags)
: /* */);
/*
* Process the format string into a fixed length buffer using the
* standard C RTL function
*/
va_start(ap,fmt);
vsprintf(buffer,fmt,ap);
va_end(ap);
while ((*str)!=0)
{
__putchar(*str);
str++;
}
/*
* Restore the interrupt flag
*/
__asm__("push %0\n\tpopf\n\t"
:
: "m" (eflags));
}
ULONG DbgPrint(PCH Format, ...) ULONG DbgPrint(PCH Format, ...)
{ {
char buffer[256]; char buffer[256];
char* str=buffer;
va_list ap; va_list ap;
unsigned int eflags; unsigned int eflags;
@ -334,11 +282,7 @@ ULONG DbgPrint(PCH Format, ...)
vsprintf(buffer,Format,ap); vsprintf(buffer,Format,ap);
va_end(ap); va_end(ap);
while ((*str)!=0) HalDisplayString (buffer);
{
__putchar(*str);
str++;
}
/* /*
* Restore the interrupt flag * Restore the interrupt flag

View file

@ -1,4 +1,4 @@
/* $Id: main.c,v 1.23 1999/10/07 23:36:00 ekohl Exp $ /* $Id: main.c,v 1.24 1999/10/14 16:53:30 ekohl Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -57,7 +57,7 @@ void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
if (i>3) if (i>3)
{ {
printk("Invalid breakpoint index at %s:%d\n",__FILE__,__LINE__); DbgPrint("Invalid breakpoint index at %s:%d\n",__FILE__,__LINE__);
return; return;
} }
@ -210,7 +210,7 @@ asmlinkage void _main(boot_param* _bp)
/* /*
* Enter idle loop * Enter idle loop
*/ */
printk("Finished main()\n"); DbgPrint("Finished main()\n");
PsTerminateSystemThread(STATUS_SUCCESS); PsTerminateSystemThread(STATUS_SUCCESS);
} }

View file

@ -197,7 +197,7 @@ asmlinkage int page_fault_handler(unsigned int cs,
*/ */
if (cs != KERNEL_CS) if (cs != KERNEL_CS)
{ {
printk("%s:%d\n",__FILE__,__LINE__); DbgPrint("%s:%d\n",__FILE__,__LINE__);
return(0); return(0);
} }
FaultMode = UserMode; FaultMode = UserMode;
@ -210,7 +210,7 @@ asmlinkage int page_fault_handler(unsigned int cs,
MemoryArea = MmOpenMemoryAreaByAddress(PsGetCurrentProcess(),(PVOID)cr2); MemoryArea = MmOpenMemoryAreaByAddress(PsGetCurrentProcess(),(PVOID)cr2);
if (MemoryArea == NULL) if (MemoryArea == NULL)
{ {
printk("%s:%d\n",__FILE__,__LINE__); DbgPrint("%s:%d\n",__FILE__,__LINE__);
return(0); return(0);
} }

View file

@ -161,22 +161,22 @@ static void validate_free_list(void)
(base_addr+current->size) > (base_addr+current->size) >
(kernel_pool_base)+NONPAGED_POOL_SIZE) (kernel_pool_base)+NONPAGED_POOL_SIZE)
{ {
printk("Block %x found outside pool area\n",current); DbgPrint("Block %x found outside pool area\n",current);
printk("Size %d\n",current->size); DbgPrint("Size %d\n",current->size);
printk("Limits are %x %x\n",kernel_pool_base, DbgPrint("Limits are %x %x\n",kernel_pool_base,
kernel_pool_base+NONPAGED_POOL_SIZE); kernel_pool_base+NONPAGED_POOL_SIZE);
KeBugCheck(KBUG_POOL_FREE_LIST_CORRUPT); KeBugCheck(KBUG_POOL_FREE_LIST_CORRUPT);
} }
blocks_seen++; blocks_seen++;
if (blocks_seen > nr_free_blocks) if (blocks_seen > nr_free_blocks)
{ {
printk("Too many blocks on list\n"); DbgPrint("Too many blocks on list\n");
KeBugCheck(KBUG_POOL_FREE_LIST_CORRUPT); KeBugCheck(KBUG_POOL_FREE_LIST_CORRUPT);
} }
// verify_for_write(base_addr,current->size); // verify_for_write(base_addr,current->size);
if (current->next!=NULL&&current->next->previous!=current) if (current->next!=NULL&&current->next->previous!=current)
{ {
printk("%s:%d:Break in list (current %x next %x " DbgPrint("%s:%d:Break in list (current %x next %x "
"current->next->previous %x)\n", "current->next->previous %x)\n",
__FILE__,__LINE__,current,current->next, __FILE__,__LINE__,current,current->next,
current->next->previous); current->next->previous);
@ -208,19 +208,19 @@ static void validate_used_list(void)
(base_addr+current->size) > (base_addr+current->size) >
(kernel_pool_base)+NONPAGED_POOL_SIZE) (kernel_pool_base)+NONPAGED_POOL_SIZE)
{ {
printk("Block %x found outside pool area\n",current); DbgPrint("Block %x found outside pool area\n",current);
for(;;); for(;;);
} }
blocks_seen++; blocks_seen++;
if (blocks_seen > EiNrUsedBlocks) if (blocks_seen > EiNrUsedBlocks)
{ {
printk("Too many blocks on list\n"); DbgPrint("Too many blocks on list\n");
for(;;); for(;;);
} }
// verify_for_write(base_addr,current->size); // verify_for_write(base_addr,current->size);
if (current->next!=NULL&&current->next->previous!=current) if (current->next!=NULL&&current->next->previous!=current)
{ {
printk("Break in list (current %x next %x)\n", DbgPrint("Break in list (current %x next %x)\n",
current,current->next); current,current->next);
for(;;); for(;;);
} }
@ -251,14 +251,14 @@ static void check_duplicates(block_hdr* blk)
if ( (int)current > base && (int)current < last ) if ( (int)current > base && (int)current < last )
{ {
printk("intersecting blocks on list\n"); DbgPrint("intersecting blocks on list\n");
for(;;); for(;;);
} }
if ( (int)current < base && if ( (int)current < base &&
((int)current + current->size + sizeof(block_hdr)) ((int)current + current->size + sizeof(block_hdr))
> base ) > base )
{ {
printk("intersecting blocks on list\n"); DbgPrint("intersecting blocks on list\n");
for(;;); for(;;);
} }
current=current->next; current=current->next;
@ -268,14 +268,14 @@ static void check_duplicates(block_hdr* blk)
{ {
if ( (int)current > base && (int)current < last ) if ( (int)current > base && (int)current < last )
{ {
printk("intersecting blocks on list\n"); DbgPrint("intersecting blocks on list\n");
for(;;); for(;;);
} }
if ( (int)current < base && if ( (int)current < base &&
((int)current + current->size + sizeof(block_hdr)) ((int)current + current->size + sizeof(block_hdr))
> base ) > base )
{ {
printk("intersecting blocks on list\n"); DbgPrint("intersecting blocks on list\n");
for(;;); for(;;);
} }
current=current->next; current=current->next;
@ -454,7 +454,7 @@ static unsigned int alloc_pool_region(unsigned int nr_pages)
length=0; length=0;
} }
} }
printk("CRITICAL: Out of non-paged pool space\n"); DbgPrint("CRITICAL: Out of non-paged pool space\n");
for(;;); for(;;);
return(0); return(0);
} }