OSDev.org

The Place to Start for Operating System Developers
It is currently Wed May 22, 2024 11:29 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: uACPI, a portable and easy-to-integrate ACPI implementation
PostPosted: Sun Mar 03, 2024 3:53 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 184
Hi all!

uACPI is an ACPI implementation (including an AML interpreter and other components) that aims to be easy to port and integrate.
Project on GitHub: https://github.com/UltraOS/uACPI

Current state of the project
- A well-tested interpreter fully supporting all of AML
- A fully implemented resource subsystem supporting all existing descriptors
- Lots of API already available, this includes sleep/reset, device search, namespace management, opregion/notify handlers, gas read/write, pci routing, interrupt model
- Works on all real hardware tested so far (about 8 different computers), and all VMs. This includes namespace initialization, reading battery state, shutting down and rebooting

More details in the README: https://github.com/UltraOS/uACPI?tab=readme-ov-file#state-of-the-project

Project goals
- Perfect compatibility with the Windows NT ACPI interpreter
- Addressing some of the fundamental design flaws of ACPICA: the global interpreter lock, unsafe object lifetimes, NT incompatibility (reference semantics, implicit-casts, etc)
- Simplifying code by embracing AML designed for the NT ACPI interpreter, instead of trying to work around it (see: ACPICA two-pass package named object resolution)
- Ease of integration and development

Some code examples & more details in the README: https://github.com/UltraOS/uACPI?tab=readme-ov-file#why-would-i-use-this-over-acpica

A reddit post by me showcasing the interpreter on real hardware: https://www.reddit.com/r/osdev/comments/1and6yg/my_aml_interpreter_on_real_hardware/

Thanks!


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Thu Mar 14, 2024 2:37 pm 
Offline
Member
Member
User avatar

Joined: Mon May 22, 2017 5:56 am
Posts: 825
Location: Hyperspace
Excellent goals! I particularly like that the instructions for building it without CMake are just 2 lines. ;) Bookmarked.

_________________
Kaph — a modular OS intended to be easy and fun to administer and code for.
"May wisdom, fun, and the greater good shine forth in all your work." — Leo Brodie


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Sat Mar 23, 2024 3:55 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 184
An update on the state of the project:
- uACPI now has a fairly complete event subsystem for fixed and general purpose events
- Added support for gracefully skipping opcodes attempting to create duplicate named objects during namespace load
- A bunch of small improvements and various bug fixes, removed strtoull os dependency, now shipping own implementation
- We have tested a lot more computers since, the number is probably close to 20 if not more at the moment, all working just fine!
- uACPI is now the official ACPI subsystem used by the managarm operating system: https://github.com/managarm/managarm


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Wed Mar 27, 2024 1:20 pm 
Offline
Member
Member

Joined: Wed Oct 01, 2008 1:55 pm
Posts: 3196
Interesting. How does it compare in executable size to ACPICA? What does it require from the runtime library? Does it work for a 32-bit protected mode kernel?


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Wed Mar 27, 2024 2:29 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 184
rdos wrote:
How does it compare in executable size to ACPICA?

I haven't measured, but it's ~20k loc of C code, so that should give you an idea

rdos wrote:
What does it require from the runtime library?

A few very common libc functions (memcpy, strcmp, ...) + snprintf. Besides that, kernel API like map/unmap, alloc/free, mutexes, ticks, etc.

rdos wrote:
Does it work for a 32-bit protected mode kernel?

This is not something I've tested personally, but there aren't any places in code that assume 64-bit at least as far as I'm aware, so might just work


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Fri Apr 05, 2024 4:19 am 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 184
Yet another project state update!

- Dynamic table loads from AML via (Load/LoadTable) are no longer recursive (they are in ACPICA even to this day!)
- Fixed a bunch of bugs/missing error checks found via fuzzing
- Sped up name string parsing
- Added a bunch of new tests


Top
 Profile  
 
 Post subject: Re: uACPI, a portable and easy-to-integrate ACPI implementat
PostPosted: Fri Apr 26, 2024 4:46 pm 
Offline
Member
Member

Joined: Sun Apr 05, 2020 1:01 pm
Posts: 184
uACPI now has a page on osdev wiki! https://wiki.osdev.org/UACPI

Since the last update I also:
- Added a highly requested UACPI_SIZED_FREES mode, which makes all frees include a size argument
- Made 32-bit builds first class citizen (now run 32-bit CI for every commit as well)
- Did some more fuzzing thanks to the help from a friend, this time against 500 publicly available real hardware AML blobs
- Fixed a few important bugs (we no longer have any crashes when fuzzing! perhaps needs longer sessions)
- Reworked secondary table loading to include PSDTs and made failures non-critical
- Added a more verbose log level (with some extra interpreter bytecode tracing on top)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group