I don't know why suddenly when I tried to add DLL Loading to my bootloader, Some weird stuff started to happen, first when I loaded one function from one DLL it worked fine but as soon as I added another function the bootloader does no longer work (and the loading code is copied from the previous os which was successful in loading relocatable importing and exporting pe images).
Print() prints some weird stuff when adding an ASCII String Argument "%s" even on the serial.log.
The Kernel "/src/nos" imports "syscruntime.lib" which is the kernel mode version of my cruntime library (basicly its exactly the same as cruntime.lib but compiled with /SUBSYSTEM:native
I don't see anything wrong in the loader "/src/boot/efi/amd64/load.c"
However even if I try to print a string at the start of UefiEntry to same weird thing happens, but if I use a unicode string "%ls" it works fine.
Libraries code is at "/lib/"
project NewOS : https://github.com/NXTdevosc1/New-Operating-System
Although the bootloader gets extremely larger each time I add a function, now it is at 183KB, I don't think it needs to be more then 25KB
UEFI Print(%s) writes weird characters
Re: UEFI Print(%s) writes weird characters
EFI does not have a "Print" function, but gnu-efi's efilib does.
The efilib Print function takes a UTF16 format string, and the "%s" formatter also expects UTF16 arguments. If you want to pass an ASCII string argument, it has a "%a" format specifier.
Here's a reference from someone's mirror of gnu-efi: https://github.com/vathpela/gnu-efi/blo ... nt.c#L1055
The efilib Print function takes a UTF16 format string, and the "%s" formatter also expects UTF16 arguments. If you want to pass an ASCII string argument, it has a "%a" format specifier.
Here's a reference from someone's mirror of gnu-efi: https://github.com/vathpela/gnu-efi/blo ... nt.c#L1055
-
- Member
- Posts: 5560
- Joined: Mon Mar 25, 2013 7:01 pm
Re: UEFI Print(%s) writes weird characters
It looks like this is actually EDK2 and not GNU-EFI, but EDK2 also provides a Print() function, and EDK2's Print() function also requires "%a" for ASCII strings.
Re: UEFI Print(%s) writes weird characters
Ah, my mistake - though, the UefiLib in EDK2 is a descendent of the efilib in gnu-efi, which is why these work the same wayOctocontrabass wrote:It looks like this is actually EDK2 and not GNU-EFI, but EDK2 also provides a Print() function, and EDK2's Print() function also requires "%a" for ASCII strings.
Re: UEFI Print(%s) writes weird characters
Thanks ill try that.
Re: UEFI Print(%s) writes weird characters
It's working !