Giter VIP home page Giter VIP logo

lai's Introduction

Lightweight AML Interpreter

LAI is an interpreter for AML, the ACPI Machine Language. AML is an integral component of modern BIOS and UEFI firmware, both on x86(_64) machines and ARM servers. As an AML interpreter, LAI is used by OS kernels to implement support for ACPI.


Official Discord Server: https://discord.gg/7WB6Ur3. This is our primary real-time communication channel.

Official IRC Channel: #managarm-lai on irc.libera.chat

Documentation

LAI has been split up into 3 parts:

  • Core, The main parser/interpreter
  • Helpers, Some extra functions that help interfacing with the ACPI API
  • Drivers, A few ACPI related drivers that are generic per OS

lai's People

Contributors

atiep avatar austanss avatar avdgrinten avatar dennisbonke avatar electrodeyt avatar fido2020 avatar ilobilo avatar itay2805 avatar itsmevjnk avatar jasonbrave avatar lukflug avatar matt8898 avatar mintsuki avatar msathieu avatar n00byedge avatar neptune650 avatar notyuriy avatar qookei avatar ricardoluis0 avatar thomtl avatar toor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lai's Issues

Remove lai_eval_operand in IF_OP

This issue is part of an ongoing effort to remove the lai_eval_operand() function. The goal is to make the interpreter completely non-recursive.

Refactor resource API

The API to iterate over a ACPI resource buffer (e.g., the buffer returned by _CRS) should be implemented as a lightweight (non-allocating) iterator over a buffer (defined by a const void * + size_t).

Suggestions for methods:

  • lai_resource_read(): advance to the next resource descriptor or determine that no such descriptor exists
  • lai_resource_get_type(): return the type of the descriptor
  • lai_resource_get_irq(): take an index n and return the n-th IRQ vector

Support buffers in OpRegions

ACPI specifies that accesses to fields that are larger than the integer size return buffers instead. This needs to be implemented in opregion.c.

PM Timer

Adding a PM Timer helper could be a pretty nice and simple addition to Lai.

ACPI reset

Ever since ACPI 2.0 the FADT provides a way to reset the system in a hardware independant way(On most PCs this is implemented via a mostly unknown PCI I/O port). This could be used to reboot a system instead of shutting it down. The reset doesn’t require the use of the AML interpreter but just requires a write of a byte to a Generic Address Structure.

Remove lai_eval_operand in WHILE_OP

This issue is part of an ongoing effort to remove the lai_eval_operand() function. The goal is to make the interpreter completely non-recursive.

Host: Improve PCI interface

The PCI access functions do not support non-zero segments. Furthermore, they only support 32-bit access. Both of those issues should be fixed by refactoring the PCI access functions.

Missing feature: Mutexes

Implement the missing feature and add a unit test
Opcodes related to feature

  • Acquire (Currently stubbed)
  • Release (Currently stubbed)

Implement GC for packages

Packages either need to be refcounted properly (i.e., we need to make sure our behavior is consistent with ACPICA) or garbage-collected.

Disabling ACPI

Some time ago when refactoring the directory structure of lai I discovered an unimplemented function prototype

void acpi_disable(void);

We discussed it back then but came to the conclusion that disabling ACPI was impossible for non-system-firmware however this is possible per the spec. Implement such a function

Remove lai_eval_operand in BUFFER_OP

This issue is part of an ongoing effort to remove the lai_eval_operand() function. The goal is to make the interpreter completely non-recursive.

API: Add node type API

Add an enum lai_node_type similar to enum lai_object_type and a function to query it.

API: Publish variable API

The API functions lai_assign_object(), lai_move_object() and lai_free_object() should be renamed to lai_var_<function>, made public and documented. free should become finalize to match acpi_state_t. There should be a cleanup macro for finalize and an initializer macro.

Missing feature: Events

Implement the missing feature and add a unit test
Opcodes related to feature

  • Signal
  • Wait
  • Notify

Support big endian systems in lai_obj_to_integer

Currently for the buffer case only little endian systems are supported, fix this
Code could look like

#if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
bswap64(&object->integer);
#endif

However bswap64 is not yet implemented, it should be implemented with its already implemented counterparts bswap32 and bswap16 in core/eval.c

Remove lai_eval_operand in RETURN_OP

This issue is part of an ongoing effort to remove the lai_eval_operand() function. The goal is to make the interpreter completely non-recursive.

Add support for the ECDT table

Due to the possibility of AML writing to a field on table level before the EC is currently initializeable, ACPI provides a table to be able to access the EC before the AML interpreter is even started, support this

Refactor OpRegion access

The I/O code in opregion.c needs an overhaul.

  • The field flags (ByteAcc/WordAcc etc.) determine the minimum access width. However, accesses are still naturally aligned. Hence, the code should first round of the access size to natural alignment.
  • Field offsets and sizes are always in bits, never in bytes.
  • There is no need to special case PCI access.

Separate helpers from core functions

Helpers, that is, functions that are implemented on top of the AML interpreter, should be separated from the core. Their declarations should move to a lai/helpers/ directory in include/. Their implementation should move to helpers/.

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.