About a week ago I tried to debug my kernel through COM1 serial port. I used tutorial on the wiki and it works. But now I tried to upgrade the way of debugging, by recreating debugging function.
These two functions are my currently work:
Code: Select all
// Help function for DebugWrite, givs int args in every %x position:
void vDebugWrite(const char *x, va_list args)
{
for(int i = 0; x[i] != '\0'; i++)
{
if((x[i] == '%') && (x[i + 1] == 'x'))
{
int Value = va_arg(args, int);
char Holder[] = {};
kitoa(Value, Holder, 16);
for(int a = 0; Holder[a] != '\0'; a++)
{
write_serial(Holder[a]);
}
// It's here!
//int *pom = &Holder;
//kprintf("Holder address: 0x%x\n", pom);
i++;
}
else write_serial(x[i]);
}
}
// Write string to port:
void DebugWrite(const char *x, ...)
{
va_list args;
va_start(args, x);
vDebugWrite(x, args);
va_end(args);
}
Here is how debug file looks like without these to lines:
Address of var "p", created statically in kernel is 0x11f458 in debugging in QEMU nad VirtualBox. Because my kprintf() function is working properly, I can read it from screen. But I don't know why these two extra lines of code, that I don't want to display on screen this data, makes code working. Correct address is on screen and in logfile.Strayex Kernel Debug Mode
Using serial port COM1
Full kernel name: Strayex Kernel v1.0.1 Alpha
Adress of p: 0x11f4 <- it's here!
Please help, I don't see problem here, maybe it's some value passing into stream of serial port. I really don't know. If it is necessary, I will paste here kprintf() function code.
And, of corse, thank you for your answers!