os-tutorial
os-tutorial copied to clipboard
16-video-driver can't pass string
When I pass a string to kprint or kprint_at it always points to null. I have to first declare the string as an array, and then pass it. Why is this happening? I copied/pasted the code.
char msg[] = "test";
kprint_at(msg, 1, 2);
the above works but the below does not
kprint_at("test", 1, 2);
I'm having a problem where no matter what string i put in the function, i get one single asterisks where the string should start. Also when I use clear_screen() I have a green box on top about 5 or 6 spaces in. Did you ever have that problem? Any ideas on how to solve it?
I fixed my one problem but now I have the same issue that you do. Have you ever got it fixed?
Check the value of dh
that indicates the number of sectors to be loaded to the memory. The bytes loaded are equal to number of sectors times 512 bytes/sector. You'd better check the size of kernel image and change that value properly.
That's probably how to fix it because its probably glitching because not enough disk was read
Guys, I have the same problem on a Windows 10, does anybody knows why this happens or have a solution? Amazing tutorial anyway!!
Dear Caio,
I guess this problem is not anything OS-specific, and I believe my previous response will help you solve it.
BTW, Happy new year!
Travor Liu
From: Caio Alexandre Troti Caetano [email protected] Sent: Tuesday, December 31, 2019 9:24:39 AM To: cfenollosa/os-tutorial [email protected] Cc: Travor Liu [email protected]; Comment [email protected] Subject: Re: [cfenollosa/os-tutorial] 16-video-driver can't pass string (#31)
Guys, I have the same problem on a Windows 10, does anybody knows why this happens or have a solution? Amazing tutorial anyway!!
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/cfenollosa/os-tutorial/issues/31?email_source=notifications&email_token=AF5X74KRYPRIJXGVDIOEBLDQ3KNNPA5CNFSM4EMX3ZKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEH3R7RI#issuecomment-569843653, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AF5X74PLTGHJZMNLVR5DKQDQ3KNNPANCNFSM4EMX3ZKA.
No, actually the problems doesn't was about the loaded sectors. It seems the GCC in windows (dunno if it happens in others systems) when using this environment provided by the tutorial, doesn't have ideia where to put global constants.
Using the knowledge acquired with this tutorial I followed the tutorial from os-dev to Grub Multiboot, and with a linker.ld file with .rodata section solved the problem. Link here
The .rodata section defines global constants (read-only), which we used in inline char arrays:
kprint_at("test", 1, 2);
Awesome tutorial, and Happy New Year!!! :D
Hey guys, I had the same problem, and @caioaletroca is right. I wasn't using a cross-compiler, so my GCC was generating code for x84_64 architecture and elf64 format. So, our new operating system didn't know where was the literal string. Now, I am using a cross-compiler (i686-elf-gcc, i686-elf-ld) to generate code in elf32 format and i386 architecture, and it's working. I recommend this link: Why do I need a cross-compiler?
Check the value of
dh
that indicates the number of sectors to be loaded to the memory. The bytes loaded are equal to number of sectors times 512 bytes/sector. You'd better check the size of kernel image and change that value properly.
which is the right answer , the size of 'os-image.bin' in my device is 5144bytes, change $dh in bootsect.asm from 2 to 13 will fix the problem
I fixed my one problem but now I have the same issue that you do. Have you ever got it fixed?
how did u fix the problem pls ?