serenity icon indicating copy to clipboard operation
serenity copied to clipboard

Userland: Add starter AML parser for ACPI data

Open me-minus opened this issue 2 years ago • 17 comments

Begining of a parser for the newly exposed DSTS table in /sys/firmware/acpi. It only implements one opcode, making it possible to partially parse the DSTS table in my computer/qemu.

Hopefully the parser can be extended into an interpreter and used by the kernel to get the correct APCI data.

There is lots of debug output at the moment, most of it will be removed as the parser grows

me-minus avatar Oct 24 '22 18:10 me-minus

I am not against building the ACPI code in userland as long as we are standing clear on that it's only temporary (so we will need to make a library to ensure it happens). ACPI AML parsing should be allowed to be done in userland, to aid debugging of the AML, but the actual parsing for doing power management stuff should happen only in the kernel space (we are not building a microkernel here, and despite the advertisements of how safe a microkernel is, I am still not convinced that if badly written AML, or even worse, malicious AML blob was inserted, that an actual separation will help anyway here), therefore to prevent code duplication, a library with the code being implemented there is the best approach.

supercomputer7 avatar Oct 27 '22 18:10 supercomputer7

I am not against building the ACPI code in userland as long as we are standing clear on that it's only temporary (so we will need to make a library to ensure it happens). ACPI AML parsing should be allowed to be done in userland, to aid debugging of the AML, but the actual parsing for doing power management stuff should happen only in the kernel space (we are not building a microkernel here, and despite the advertisements of how safe a microkernel is, I am still not convinced that if badly written AML, or even worse, malicious AML blob was inserted, that an actual separation will help anyway here), therefore to prevent code duplication, a library with the code being implemented there is the best approach.

I agree 100%! That has been my intention from the beginning. But kernels are also scary to begin in. Userspace comfy :-)

me-minus avatar Oct 28 '22 05:10 me-minus

Feel free to use my branch of an AML parsing implementation I tried about a year ago - https://github.com/supercomputer7/serenity/commits/aml-revised

supercomputer7 avatar Oct 28 '22 10:10 supercomputer7

Sorry for not being very straightforward. Hope you appreciated to use more Serenity's C++

No problem! I'm very happy to get a deep review, especially since this is a new application.

me-minus avatar Nov 13 '22 19:11 me-minus

This has conflicts.

AtkinsSJ avatar Dec 06 '22 15:12 AtkinsSJ

In the commit message please change to the following pharses: it possible to partially parse the DSTS table in my computer/qemu. => it possible to partially parse the DSDT table in my computer/qemu. most of it will be removed as the parser grows => most of it will be removed as the parser grows.

supercomputer7 avatar Dec 17 '22 08:12 supercomputer7

In the commit message please change to the following pharses: it possible to partially parse the DSTS table in my computer/qemu. => it possible to partially parse the DSDT table in my computer/qemu. most of it will be removed as the parser grows => most of it will be removed as the parser grows.

Commit message has been updated with your comments

me-minus avatar Dec 17 '22 10:12 me-minus

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Jan 14 '23 02:01 stale[bot]

Typo in commit message:

Begining of a parser for the newly exposed DSDT table in

Begining > beginning

gmta avatar Jan 15 '23 12:01 gmta

Typo in commit message:

Begining of a parser for the newly exposed DSDT table in

Begining > beginning

Typo has been fixed and rebased to master

me-minus avatar Jan 20 '23 19:01 me-minus

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Feb 10 '23 22:02 stale[bot]

That's not stale!

LucasChollet avatar Feb 10 '23 23:02 LucasChollet

Hello!

One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why. Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.

BuggieBot avatar Mar 10 '23 21:03 BuggieBot

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Apr 30 '23 01:04 stale[bot]

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar May 21 '23 16:05 stale[bot]

2023-06-24 12:19 https://discord.com/channels/830522505605283862/830525093905170492/1122108854147240038

IdanHo: We generally don't merge PRs that don't add any new functionality ('dead code'), since there's no guarantee anyone will eventually come and expand on it in future PRs (especially for new contributors) to make it useful in some way I didnt throughly review your PR, but it seems like what it does add would be below my personal threshold for dead code. IdanHo: Note that it does not mean that the single commit in that PR should necessarily be larger, it can also just be more commits in the same PR, that bring it to some more functional state

me-minus avatar Jun 28 '23 07:06 me-minus

me_minus: My idea is to first write an AML to ASL decompiler and then a ASL to AML compiler. After that some kind of interpreter (in userspace) and lastly refactor a library that can run AML in kernelspace (and still be usable in userspace)

me-minus avatar Jun 28 '23 07:06 me-minus

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!

stale[bot] avatar Jul 20 '23 04:07 stale[bot]

This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!

stale[bot] avatar Jul 27 '23 05:07 stale[bot]