void pre_new_sweb_assert(uint32 condition, uint32 line, char* file) { char *error_string = "KERNEL PANIC: Assertion Failed in File: on Line: "; char line_string[5]; if (!condition) { uint8 * fb = (uint8*)0xC00B8000; uint32 s=0; uint32 i=0; for (s=0; s<40; ++s) { fb[i++] = error_string[s]; fb[i++] = 0x9f; } writeLine2Bochs((uint8*) error_string); writeChar2Bochs((uint8) '\n'); writeLine2Bochs((uint8*) file); writeChar2Bochs((uint8) '\n'); while (file && *file) { fb[i++] = *file++; fb[i++] = 0x9f; } for (s=40; s<54; ++s) { fb[i++] = error_string[s]; fb[i++] = 0x9f; } i-=4; for (s=0; s<5; ++s) { line_string[s]=' '; } line_string[s]='\0'; while (line>0) { fb[i++] = (uint8) ( 0x30 + (line%10) ); fb[i] = 0x9f; line_string[--s] = ( 0x30 + (line%10) ); i-=3; line /= 10; } writeLine2Bochs((uint8*) line_string); writeChar2Bochs((uint8) '\n'); for (;;); } }
void writeLine2Bochs( const uint8 * line2Write ) { // TODO: It would be nice to have a sprintf function // so we can format the string const uint8 *currentChar; const uint8 *swebTag = ( uint8 * ) "[SWEB] "; for( currentChar = swebTag; (*currentChar != '\0'); currentChar++ ) writeChar2Bochs( *currentChar ); uint8 counter = 0; // the message is cut off at 250 chars for( currentChar = line2Write; (*currentChar != '\0') && (counter++ < 250); currentChar++ ) writeChar2Bochs( *currentChar ); }
void writeLine2Bochs( const char * line2Write ) { const char *currentChar; uint8 counter = 0; for( currentChar = line2Write; (*currentChar != '\0') && (counter++ < 250); currentChar++ ) writeChar2Bochs( *currentChar ); }
void writeLine2Bochs( const char * line2Write ) { uint8 counter = 0; while (*line2Write && counter++ < 250) { writeChar2Bochs( *line2Write ); ++line2Write; } }