Coder Social home page Coder Social logo

efi-wrapper's Introduction

efi-wrapper

Whats this?

A UEFI implemented running under OS (Linux), implemented some UEFI interfaces

NOTICE: the project is in the early experimental stage, and some functions may have many bugs and may not work as expected

This project is not a sandbox, efi program code will be executed directly!

How does it work?

As we all know, UEFI does not have system calls. Applications call UEFI services through System Table struct of arguments. As long as we implement System Table and then emulate some privileged instructions, we can run the UEFI program.

UEFI Shell

If you want to run UEFI Shell, you need HII related DXE (from EDK2):

  • HiiDatabase.efi
  • EnglishDxe.efi

Implemented UEFI protocols

  • gEfiDevicePathUtilitiesProtocolGuid
  • gEfiComponentNameProtocolGuid
  • gEfiComponentName2ProtocolGuid
  • gEfiGraphicsOutputProtocolGuid (SDL2 / VNC / MemoryOnly)
  • gEfiAbsolutePointerProtocolGuid (SDL2 / VNC)
  • gEfiSimplePointerProtocolGuid (SDL2 / VNC)
  • gEfiSimpleTextInProtocolGuid (SDL2 / VNC / STDIO)
  • gEfiSimpleTextInputExProtocolGuid (partial)
  • gEfiSimpleFileSystemProtocolGuid (write untested)
  • gEfiSimpleTextOutProtocolGuid
  • gEfiUnicodeCollationProtocolGuid
  • gEfiUnicodeCollation2ProtocolGuid

UEFI services (Boot Service / Runtime Service)

Unimplemented services

  • gRT->SetVirtualAddressMap (no possible)
  • gRT->ConvertPointer (no possible)
  • gRT->UpdateCapsule
  • gRT->QueryCapsuleCapabilities
  • gRT->SetTime (return EFI_ACCESS_DENIED)
  • gRT->GetWakeupTime
  • gRT->SetWakeupTime
  • gRT->GetNextHighMonotonicCount
  • gBS->GetNextMonotonicCount
  • gBS->UnloadImage
  • gBS->SetWatchdogTimer

Partial implemented services

  • gRT->ResetSystem (force exit application)
  • gRT->SetVariable (no persistent storage)
  • gRT->GetVariable (no persistent storage)
  • gRT->GetNextVariableName (no persistent storage)
  • gBS->ExitBootServices (fake exit)

Architecture:

  • x86_64 / amd64
  • aarch64 / arm-v8a
  • x86 / i386 (untested)
  • arm32 / arm-v7 (untested)

TODO

  • Fix STDIO Console
  • Implement SimpleTextInputEx
  • Implement HII Protocols
  • Emulate more privileged instructions

Bugs

  • All code are unstable
  • Memory management (pool allocate) are very bogous
  • Memory protection does not seem to be working properly, you may need add -p to arguments (enable memory permissive)
  • PE32 relocations broken
  • No persistent variable storage

Code used:

  • edk2
  • U-Boot

efi-wrapper's People

Contributors

bigfootaca avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

mollysophia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.