Uefi.inc: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m →‎Hello World from UEFI: fixed string to be wide characters as per forum post
m Reformat, mark as lovecraftian
Line 1:
{{Lovecraftian}}
== uefi.inc ==
Is<tt>uefi.inc</tt> a library for UEFI written in assembly for fasm. It's main goal was small code, and to achieve that it gives only limited access to UEFI. It was designed to fulfill all the needs of a boot loader, namely
 
* provide user input interface
Line 7:
 
It is not intend to be an universal UEFI library.
=== Hello World from UEFI ===
This shows how to import and use the library.
<source lang="asm">
Line 35:
</source>
 
=== Case studies: usage in a boot loader ===
Please note that these are only tutorials. They focus on a specific topic only. They do not allocate buffers they use for example. You'll have to write that part on your own.
They were written for those who wants to roll their own UEFI boot loader in assembly. I hope it will save them some sleepless nights and headaches.
==== Reading a character from keyboard ====
<source lang="asm">
@@: uefi_call_wrapper ConIn, ReadKeyStroke, ConIn, key
Line 50:
</source>
 
==== Detecting Memory Map ====
<source lang="asm">
mov dword [memmapdescsize], 48
Line 72:
Note that memmapkey is needed for ExitBootServices. If you use memory allocation or free, you'll have to query again map to get a valid key.
 
==== Iterating on disks ====
<source lang="asm">
; query device handles
Line 123:
</source>
 
==== Loading a sector from device ====
<source lang="asm">
mov rax, qword [bootdiskblkio]
Line 151:
</source>
 
==== Get sorted list of available video modes ====
<source lang="asm">
; installation check on GOP. This must return buffer too small if GOP supported
Line 274:
</source>
 
=== The include file ===
And finally the library that makes the magic alive:
<source lang="asm">