Printing after entering 64-bit kernel
Posted: Mon Jun 11, 2018 6:52 pm
Hello there,
I just managed to get the jump to the 64-bit kernel to work, using a separate loader.
When I first managed to do that, I noticed that the prints aren't working anymore. After thinking about it for a bit, I realized that the VGA frame buffer address (0xb8000) which I assigned to a pointer inside the 32-bit loader for printing, is a physical address, however, after I enabled paging, every address is being recognized as a virtual one.
Given that, I thought I was simply missing a mapping entry for the VGA frame buffer, so I did the following:
And in my bootstrap file, before entering the kernel, I mapped the addresses 0xffffffff802b8000 to 0xb8000.
Here I map the addresses, on 4KiB pages (MAP_MODE_PT) with a mapping size of 4KiB (VGA buffer size (80 x 25) x 2, since buffer holds 16-bit entries = 4000 bytes < 4KiB)
When checking if the mapping was successful, the linear memdump for 0xffffffff802b8000 in Bochs displayed the contents of the frame buffer correctly, so I thought it should definitely work now, but it doesn't.
Am I missing something important here?
I just managed to get the jump to the 64-bit kernel to work, using a separate loader.
When I first managed to do that, I noticed that the prints aren't working anymore. After thinking about it for a bit, I realized that the VGA frame buffer address (0xb8000) which I assigned to a pointer inside the 32-bit loader for printing, is a physical address, however, after I enabled paging, every address is being recognized as a virtual one.
Given that, I thought I was simply missing a mapping entry for the VGA frame buffer, so I did the following:
Code: Select all
#define VGA_TEXT_BUFFER_ADDRESS_X86 0xb8000
#define VGA_TEXT_BUFFER_ADDRESS_X86_64 0xffffffff802b8000
#if defined(__i386__)
#define VGA_TEXT_BUFFER_ADDRESS VGA_TEXT_BUFFER_ADDRESS_X86
#endif
#if defined(__x86_64__)
#define VGA_TEXT_BUFFER_ADDRESS VGA_TEXT_BUFFER_ADDRESS_X86_64
#endif
Code: Select all
memmap(MAP_MODE_PT, VGA_TEXT_BUFFER_ADDRESS_X86_64,
VGA_TEXT_BUFFER_ADDRESS_X86, (X86_64_PTE_FLAG_PRESENT | X86_64_PTE_FLAG_READ_WRITE), 0x1000);
When checking if the mapping was successful, the linear memdump for 0xffffffff802b8000 in Bochs displayed the contents of the frame buffer correctly, so I thought it should definitely work now, but it doesn't.
Am I missing something important here?