In my boot assembly file I declare my stack as:
Code: Select all
kernel_stack:
times 32768 db 0xcc
Code: Select all
int r = 0x33413442;
puts("\n-----\n");
puts((char *)&r);
puts("\n-----\n");
printf("r is %x\n",r);
and the puts routine prints 'r' properly but printf prints 0xcccccccc which is somewhere random on the stack. I have tried many different combinations of print modifiers and none of them work. I have also tried moving where the variable im printing is located (bss/data) etc and same results.
I don't think its stack corruption on my side because puts is working ifne otherwise.
I was also wondering what should be the proper type for rounding inside of the va_ functions. 32 bit systems use size of (4 bytes), but shouldnt 64 bit systems use sizeof(long) (8 bytes)? I tried both and neither fixed my problem.
Does someone have a working 64bit printf so I can test to make sure i am not completely off or has anyone else had problems with this? I have tried 3 different printf implementations and all have the same problem.