#uACPI - a portable and easy-to-integrate ACPI implementation

1 messages ยท Page 66 of 1

frank canopy
#

(also not a huge deal because im still a ways away from actually implementing pci interrupt routing in my kernel lmao)

slim panther
#

why not take a trait ref

rustic compass
frank canopy
#

zuacpi update: added binds for object_get_type, and eval and get for string, buffer, and string_or_buffer

#

@fiery turtle why is it eval_buffer_or_string and get_string_or_buffer

#

why are the two different

fiery turtle
#

A string is guaranteed to be null terminated in uacpi

fiery turtle
#

(internally it uses the same object storage ofc)

fiery turtle
#

Some feature plans (or ideas) for uacpi:

  • Ability to precalculate the space needed for the early table buffer
  • (behind an option) An ability to attach a user object to a namespace node
  • An extended version of for_each_subtable that allows arbitrary headers via a callback (not just madt/srat entries)
  • table.h has a lot of naming inconsistencies, so these should be fixed for the next major release
  • Fix uacpi_generate_absolute_path to no include trailing _, or have a separate function that outputs prettier paths
  • Fix random scattered globals, at least follow the g_ convention for them
  • Maybe add helpers for static/compile-time spinlock/mutex creation without allocations
  • Consider offloading uacpi state into a context
  • UACPI_DISABLE_PCI
  • An overridable 64-bit division helper
  • Check how NT handles missing arguments for methods
calm latch
#

Are you planning for for_each_subtable to just deduce the type based on the signature?

#

(so like the api won't even change)

fiery turtle
#

thats an interesting idea

#

i could have a for_each_subtable_auto or something

rustic compass
#

@fiery turtle given

uacpi_status uacpi_object_resolve_as_aml_namepath(
    uacpi_object*, uacpi_namespace_node *scope, uacpi_namespace_node **out_node
);

do i need to pass a ptr to the uacpi_object that i currently have there or the ptr that i get from uacpi when creating a new a new object?

fiery turtle
#

you pass in a string object that you already have

rustic compass
#

you mean uacpi_namespace_node?

fiery turtle
#

no i mean an object

#

this function takes a string object that the aml provided you

#

which contains a path

#

that path is then resolved against a scope

#

and gives you back the namespace node that it meant

rustic compass
#

the problem i have is does the function want its input as call by value or by reference?

fiery turtle
#

wdym by that?

#

in C all arguments are by value

#

do you mean which arguments here are output?

#

only the out_node argument

#

even if you wanted, u cant make a uacpi_object manually and pass it by reference (pointer) because its an opaque type

rustic compass
#

i can pass a ptr that points to the pointer i got from uacpi that represents the object or i can just directly give the function a copy of that ptr

fiery turtle
#

ngl i dont understand the question

#

if you pass it a uacpi_object** it will crash

rustic compass
#
//Call by reference
fn call(thing: &MyStruct) 

//Call by value
fn call(thing: MyStruct)
fiery turtle
#

the object is not modified by the function

#

if thats what you mean

#

like you literally cannot pass an object by value in uacpi

#

its an opaque type

#

all you have is a handle

#

at all times

frank canopy
#

the order in the name is different between the two functions

fiery turtle
#

ohh

#

i guess one more inconsistency to the list

frank canopy
#

also stuff like the object type here is why I love zig's opaque type, which just let's me define a thing that's allowed to have a pointer to it but not be dereferenced

fiery turtle
#

Added here #1217009725711847465 message

rustic compass
fiery turtle
#

it's guaranteed to not be null as long as the return status is OK

frank canopy
#

oh for the subtable iteration, any plans to support the bonus stuff in the GTDT? or leave that to custom headers

#

doesn't impact me either way because zuacpi can't use c macros and anything that takes a callback is to be avoided if possible because I lose some good zig qol that way (zig uses iterators as the main idiomatic pattern anyway for that)

fiery turtle
#

What is gtdt again?

frank canopy
#

generic timer description table

#

it's for arm

#

it is in the proper acpi spec though

fiery turtle
#

Perhaps could be handled by new for_each_subtable_auto

frank canopy
#

the usual chapter for tables

#

the thing with the gtdt is it's got two lists of different subtable headers iirc

#

well slightly different

#

it has one list of subtables but one of the subtable entry types has its own list in it

#

thankfully the sub-sub-entries are fixed size now that im lookin at it again lmao

rustic compass
fiery turtle
#

Can you give an example of an api

rustic compass
#
uacpi_object *uacpi_object_create_package(uacpi_object_array in);
fiery turtle
#

Null is returned on OOM

frank canopy
#

oh also, zuacpi technically has api autodocs now

#

insofar as my kernel uses it and the autodocs i generate for the kernel include all the modules it imports ๐Ÿ˜†

fiery turtle
#

Damn lol

#

Did you make the website yourself?

frank canopy
#

yep

#

the autodocs are generated at compile time by zig

fiery turtle
#

Thats cool

frank canopy
#

note that this is technically a bit out of date because i dont have any ci set up so the website has to be manually updated by me

frank canopy
# fiery turtle Thats cool

so how the autodocs for zig actually work is kinda bonkers tbh. theres a zig module in the source for zig itself that imports the literal actual zig parser and compiles to wasm, and then it has a small js wrapper and loads a tarball of the sources and the wasm module parses the doc comments out of the actual literal source tarball on the fly

#

and then that generates html using the dom api stuff afaik

#

so when you load those autodocs its literally loading a source tarball using the zig std tar api and the actual from-the-compiler zig parser to extract the autodocs

#

(i did replace the handmade html and css parts of the autodocs to match my site but i left the wasm and js fully intact other than finding and fixing a bug in it that made it break if you build the docs on a platform that uses backslash as the file separator)

fiery turtle
#

Damn

frank canopy
#

the old-school html purist in me hates this wasm nonsense. the lazy in me is like meh its fine i leave it

#

i dont really think the site is that that impressive but ive been doing osdev for like two and a half years now and webdev for literally like 5-7 times longer than that

#

tfw i realise ive been doing webdev for longer than @north holly has been alive ๐Ÿ’€

hallow marten
fiery turtle
#

Header comments

hallow marten
#

maybe but

#

you could use my documentation tool

fiery turtle
#

What is it

hallow marten
fiery turtle
#

Cool

#

If someone was willing to actually host a website or something that contains the docs that would be cool, but I have no idea how that stuff works and have nowhere to host so

hallow marten
hallow marten
#

its static pages so github pages works fine

fiery turtle
frank canopy
#

technically i dont think it needs to be static for gh pages, just client-side only if theres dynamic stuff

fiery turtle
#

That could be fixed ofc but thats effort

hallow marten
#

well

#

if you'd like I can set it up

fiery turtle
#

Will it work without proper convention?

hallow marten
#

yeah, or I can adapt the comments

#

theres no convention

#

just

#
/**
 * Something
*/
fiery turtle
#

Sure I mean thatd be cool

hallow marten
#

two stars

#

or ///

#

but like it doesnt try parsing doxygen-style annotations like @param or whatever

fiery turtle
#

It just does stars without the second one atm

hallow marten
#

@fiery turtle

#

that's kinda cool

frank canopy
#

neat

fiery turtle
#

Nice

#

Although Len is not an int I think

frank canopy
#

no its a uacpi_size

hallow marten
#

yeah that's likely a libclang problem

#

not sure yet

#

ok no I forgot to add -Iinclude

#

now it works

left orbit
#

maybe you should make sure it parses without errors

hallow marten
#

ok it's all working perfectly now

#

I will try integrating it into the CI

fiery turtle
#

is that just white vs black theme or is something else different also

hallow marten
#

the fonts are different

#

and colors

#

obviously

fiery turtle
#

i mean idk but i think your website looks better

torpid root
#

indeed

hallow marten
#

well okay imma set it up with the light theme for now, and I'll let you look at it live and change it if you want

hallow marten
#

lmk if you still prefer the other theme (I personally think that one looks nice, but I can easily change it so its no big deal)

#

obviously some comments are rendered weird, but that's because they were not written with the tool in mind. Now if you want prettier comments, you'd need to write them using markdown syntax

fiery turtle
#

Yeah looks good

#

Looks like it indexed internal api as well

hallow marten
#

is that a problem?

#

I can exclude it if you want

fiery turtle
#

Well other than it being unstable guess not

fiery turtle
hallow marten
#

yeah that's what I figured too

#

I think it's as simple as changing the glob from **/*.h to *.h

fiery turtle
#

Yeah

hallow marten
#

just wanna check whether it got included

fiery turtle
#

Like it literally listed uacpi_memcmp etc

hallow marten
#

yeah ok good

#

I think it's ready now? do you want me to PR?

fiery turtle
#

Can osdev wiki stuff be copied there also?

hallow marten
#

yeah

#

you can embed mdbook-style docs

fiery turtle
#

Would it be a separate repo?

hallow marten
#

no

#

a different branch

#

it can be a different repo tho

fiery turtle
#

I think a separate repo would be better, I dont think a separate branch for literally a different thing is how git is supposed to be used

hallow marten
#

you'd have to use your secret token and stuff in the workflow but I think it'd work

fiery turtle
hallow marten
#

ok yeah maybe

fiery turtle
#

Less code churn

hallow marten
#

I will try restoring them

fiery turtle
#

That would be nice

#

Ill think about whether it should be a sep repo, idk yet

#

How do you add new stuff to the website?

#

Like stuff from the wiki etc

hallow marten
#

if you have a markdown file you just add it

#

do you?

fiery turtle
#

Its all on the wiki so not yet

hallow marten
#

ok I reverted the files

#

I'll see if I can get the clanker to rewrite as markdown

fiery turtle
#

Nice

#

You can make a pr for now I guess

hallow marten
#

I'll do the wiki thing then I'll do it

fiery turtle
hallow marten
#

because you dont want 8 million HTML files in your master branch

#

ideally

fiery turtle
#

You have like 2 there?

hallow marten
#

and github pages works really well with "deploy from branch"

hallow marten
fiery turtle
#

Hm

hallow marten
#

the workflow generates HTML and pushes it to that branch

#

github pages publishes it

fiery turtle
#

I think other projects use separate repos usually, I can make uacpi a submodule there or something ig?

#

Or it can clone it itself or smth

hallow marten
#

yes, you could do that

#

but then youd need to trigger it on every uACPI push?

#

or maybe on every release you regenerate the docs

fiery turtle
#

Yeah on release could make more sense

hallow marten
#

mhm

#

well, I'll add the wiki stuff and PR for now

fiery turtle
#

How hard would it be for you to make a repo where it automatically clones uacpi and then we can just move it into the uacpi org?

hallow marten
#

not hard

fiery turtle
#

I think that would be ideal

north hull
fiery turtle
#

And I guess comment changes can be in the main repo ofc

hallow marten
#

actually I think I can still PR, but I'd move the workflows to another repo

hallow marten
fiery turtle
#

Yeah you pr the comment changes right

north hull
#

at least my workflow doesnt do that

hallow marten
#

yeah

fiery turtle
#

Sure

hallow marten
#

god bless the clanker

#

though I should remove that header and instead name the thing "Example usage"

north hull
hallow marten
north hull
#

oh maybe its this

#

I have it on actions

#

here is this for reference

hallow marten
#

ahh

#

ok thanks

#

I think this will be github workflows wrestling more than anything meme

north hull
#

๐Ÿ™‚

hallow marten
#

actually I'm thinking I can move all the config and static stuff to the docs building repo

#

yeah that's better

#

ok @fiery turtle my PR is a lot of back and forths so you should probably squash it, but I think this is better

#

I basically only PR the comments, then you should create a repo named uACPI.github.io that I can be contributor to or something

fiery turtle
hallow marten
#

perfect then

fiery turtle
hallow marten
#

yeah it can detect struct member comments

fiery turtle
#

Cool then

hallow marten
#

platform/ is because I did a simple find-and-replace

#

I can revert it

fiery turtle
#

Hmm idk, maybe its fine

hallow marten
#

well, I just did

#

doesn't change anything

#

it's not being picked up anyway

fiery turtle
#

Ah ok

#

Yeah cool

#

Can u do a quick interactive rebase to fix them all up into the first commit? The github default squash message is ugly

hallow marten
#

fuck how do I do that

fiery turtle
#

git rebase -i HEAD~N

#

And mark those on top as fixup

#

Then just push -f

hallow marten
#

ok I fixed it

#

yea

fiery turtle
#

thx

#

i dont think we need all that description in there KEKW

hallow marten
#

git did that

fiery turtle
#

git commit --amend && git push -f trl

#

btw it seems like u dropped the config also?

hallow marten
#

yeah I will put it all inthe new repo

#

I think it's better that way

fiery turtle
#

ah cool

#

yes

hallow marten
#

ok just vibecoded a workflow

#

I think it should work

fiery turtle
#

lol

hallow marten
#

git clones duck and uACPI, builds docs from uACPI source and pushes it

fiery turtle
#

I wonder what will happen if you ask a clanker to produce an aml interpreter

hallow marten
#

ok great it works

#

how do we move it to the org?

steel inlet
#

rdmsr

#

wrmsr(IA32_GS_BASE, 0xdeadbeef)

hallow marten
fiery turtle
hallow marten
#

tho you should maybe merge the PR beforehand though

frank canopy
#

iirc

fiery turtle
hallow marten
#

sure

fiery turtle
#

ill send u an invite in a sec and then u can move the repo into the org once you're in it @hallow marten

hallow marten
#

alright I changed the desc

fiery turtle
fiery turtle
hallow marten
#

you'll have to change the github pages repo settings though

#

I cant do that

#

(I shouldn't be able to anyway)

fiery turtle
#

what should be changed?

hallow marten
#

ah no I think it's fine

#

I just retriggered anyway

#

pretty damn cool

fiery turtle
#

how do we retrigger it manually e.g. if a new release happens?

#

damn yeah

#

thats nice

hallow marten
#

you just click on "re-run all jobs"

fiery turtle
#

i can add that link to the main repo as well

fiery turtle
hallow marten
#

the relative ones don't

#

which is expected

fiery turtle
#

the ones that point to some markdown sections also ig

hallow marten
#

really?

#

which one

#

that shouldnt happen

fiery turtle
hallow marten
#

ok that's my bad

fiery turtle
#

also it seems we're back to int and comments don't appear there but I guess thats because the pr is not merged yet

hearty pike
#

It seems messed up on Firefox.

hallow marten
#

mhm well I cant autogenerate them, you have to do something like # More detailed overview {#id} then link to #id

hallow marten
fiery turtle
#

lmao

hallow marten
fiery turtle
#

table looks fine for me i guess

hallow marten
#

I forgot -I again

hearty pike
#

1080 width by 1920 height.

fiery turtle
#

lol yeah i can repro

#

on my monitor thats flipped sideways

hallow marten
#

works fine for me

#

mhm

hearty pike
#

It happens every where.

fiery turtle
#

yeah same

hallow marten
#

ah

#

not sure how to reproduce

hearty pike
hallow marten
#

@fiery turtle I pushed a fix for the int stuff, should be up soon

fiery turtle
#

its reproducable if u slowly resize the page

hallow marten
#

I'll check it out

hearty pike
#

Yep. It is only an issue for me on the default zoom level on my vertical monitor. Zooming out fixes it and zooming in transitions to a different layout.

fiery turtle
#

yep

hallow marten
#

works now

fiery turtle
#

cool thx

hallow marten
#

the only issue is aliases sometimes refer to themselves

#

I'm not sure how to fix that

#

I'll push a fix and retrigger eventually

fiery turtle
#

nice

#

yea...

#

at least im not getting replaced

hallow marten
#

btw, tl;dr on how to write comments from now on if you want them to show up better:

  • use markdown
  • you can link to names using :: links, so (or the other way around, I always forget markdown syntax)
  • This is how you document members:
struct hello {
  int a; /**< Some member */
}
  • There are also mermaid diagrams if you're into that kinda thing
fiery turtle
#

what is that?

#

Also what does **< do?

hallow marten
hallow marten
#

I think /** should work too

#

mhm

fiery turtle
#

ah

#

also i think u changed the pr title but not the actual commit message

hallow marten
#

I didnt change the message but removed the description

fiery turtle
#

thats way better than docs: generate documentation since its not even what it does meme

hallow marten
#

aaa

#

ok

fiery turtle
#

thanks

#

ill add the website link to uacpi repo description i think

hallow marten
#

done

fiery turtle
#

nice

#

When i merge the pr we just regen the docs and it should work?

hallow marten
#

yeah

#

the comments just add text

#

so we should see more text show up

fiery turtle
#

ye

#

added the link too

hallow marten
#

also note that since internal and platform arent used in the generation it wont generate descriptions for like uacpi_u64 and friends

#

that's fine I think

fiery turtle
#

yeah thats whatever

#

i think u can deduce from the name what it is

hallow marten
#

that is what managarm uses

#

idk why you'd write a book on uACPI though meme

north hull
#

mdbook is sick

fiery turtle
#

thanks

#

yeah a book idk

#

but some examples would be nice ig

north hull
#

well u dont have to call it a book

hallow marten
north hull
#

dope

#

readthedocs is also nice

hallow marten
#

this is what managarm looks like

north hull
#

but reST is uhhh.. slightly cursed meme

hallow marten
#

uACPI is my test subject before I integrate in managarm btw meme

fiery turtle
#

lol

#

isnt there some sort of a managarm book already

hallow marten
#

yeah but we wanna integrate the api reference with it

fiery turtle
#

ah

hallow marten
#

btw the css is heavily inspired by kernel.org idk if you noticed trl

north hull
hallow marten
#

I like org better

#

but not everyone uses emacs

north hull
#

never heard of it lol

hallow marten
#

asciidoc is also nice

north hull
#

yeah

hallow marten
north hull
#

lmao

hallow marten
#

like a lot of people consider it its killer feature

#

because its really powerful

north hull
#

interesting

hallow marten
#

with org-roam you can have a system and stuff like obsidian

frank canopy
#

when markdown stops cutting it I just start writing html by hand like the old-fashioned woman I am lmao

fiery turtle
#

@hallow marten so whats the right way to write api comments with parameter highlighting etc, is it documented somewhere?

hallow marten
#

there's no parameter highlighting, it's literally just markdown

#

and yeah there is

fiery turtle
#

no i mean like

hallow marten
fiery turtle
#

oh ok

#

so i just thing for example

hallow marten
#

it's like rustdoc if you've ever used that

#

yea

fiery turtle
#

nope never used it just like rust in general lol

fiery turtle
hallow marten
#

I don't think so KEKW

fiery turtle
#

lol

hallow marten
#

it's literally just a doxygen thing I think

fiery turtle
#

it just looks uglier than **

#

windows ci runs for 10 years because it also checks openwatcom

hallow marten
#

I was about to say

fiery turtle
#

special support for exactly one person that uses openwatcom KEKW

#

at least iretq added multithreaded tests so its way faster than it used to be

#

alright merged

hallow marten
#

ok imma retrigger docs

fiery turtle
#

cool

hallow marten
#

cute duck is the best feature

fiery turtle
#

lol

#

would be funnier if it had a chance to randomly rm rf your computer

hallow marten
#

great

#

now there's text

fiery turtle
#

that was fast

#

btw clicking index doesnt work sometimes

hallow marten
#

CI will be faster eventually when I figure out how to prebuild binaries

hallow marten
fiery turtle
#

is it possible to improve code formatting here a bit?

hallow marten
#

no

fiery turtle
hallow marten
#

not yet at least

#

because like it's building that on its own and just outputs it

fiery turtle
#

i see

hallow marten
fiery turtle
#

ah

hallow marten
#

mhm see uacpi_namespace_node is broken

#

it refers to itself

fiery turtle
#

i mean

#

its an opaque object

hallow marten
#

ah yeah you're right

#

but I still saw that bug somewhere where it shouldnt

#

the fix should be simple if alias: dont refer to the same alias

fiery turtle
hallow marten
#

it is but it's self referring

#

that's the bug

fiery turtle
#

ah

hallow marten
#

this works

fiery turtle
#

Yeah i think tahts not the type of the callback KEKW

hallow marten
#

that shouldnt happen

#

I'll take notes of these issues and fix them eventually, if you find any other let me know

fiery turtle
#

sure, thanks, overall thats pretty cool anyway and a huge upgrade over just header comments and osdev wiki

hallow marten
median crest
fiery turtle
#

oh yeah probably, its just gonna take a lot of time

median crest
#

If I had a lot of cash that would be an interesting experiment

#

Finance me @anthropic

gentle peak
fiery turtle
#

and macos...

gentle peak
#

does macOS have a custom one?

fiery turtle
#

yeah ofc, i think they have their own impl

gentle peak
#

I would've thought they'd just use acpica since they don't have to worry about compatibility with random aml

fiery turtle
#

maybe people who are more familiar with macos could confirm

fiery turtle
#

thats kinda hilarious honestly

fiery turtle
hallow marten
#

which AI is that

fiery turtle
fiery turtle
hallow marten
#

huh

#

font is weird

fiery turtle
#

i've never seen an apple contribution in acpica code

#

i mean i get that they're doing arm now but

#

but yeah apparently AppleACPIPlatform.kext is based on heavily modified acpica

hallow marten
#

@fiery turtle i fixed all the bugs I think

#

the only caveat is that you cant click on types in function pointers

#

thats because they're a PITA

fiery turtle
#

Thanks, that was fast

hallow marten
#

man complex types are such a pain in the ass to deal with

fiery turtle
#

๐Ÿ’€

rustic compass
#

i'm nearly done with types.h in what order should i do the other headers for uacpi-rs?

fiery turtle
#

i'm assuming u already have tables, uacpi.h contains most initialization functions, after that maybe namespace stuff

frank canopy
#

for zuacpi i started with uacpi.h and tables.h, and then from there namespace.h and just adding things as i use them in practice - i figure the longer it takes me to get to using something the less likely someone else using zuacpi will need it immediately

#

so basically same recs as infy has

rustic compass
#

does

uacpi_status uacpi_object_assign_package(uacpi_object*, uacpi_object_array in);

copy the supplied objects to somewhere else or does the package object now directly references the objects supplied by uacpi_object_array in?

fiery turtle
#

there's literally a comment above โ˜ ๏ธ

rustic compass
#

maybe i should read those

frank canopy
#

maybe

fiery turtle
#

letsgo

frank canopy
#

any chance of getting the IORT table in uacpi? ill need to create separate definitions for zuacpi anyway but might be good to have em in the base thing too

torpid root
#

what does iort do again? I seem to have downloaded documentation for it but I don't remember when or why

fiery turtle
#

yeah idk what that is

#

i usually add tables as I go, but I accept PRs for any tables

frank canopy
#

IORT (IO redirection table) tells you how to make devices to device ids used by the GIC's MSI stuff

#

and i think some other stuff but thats the bit i need it for

#

it also tells you which devices are connected to which iommus on aarch64

#

because you can have multiple SMMUs connected at once

frank canopy
#

basically doing the same thing with zuacpi of adding tables as i go

hallow marten
#

why is zuacpi needed? cant you just @cImport

frank canopy
#

(and also also zuacpi provides the log alloc and free kernel apis for you on top of that)

#

mostly its to organize and wrap the bindings in a zig-idiomatic way though

#

stuff like error sets and error returns, slices instead of pointer and length, stuff like that

frank canopy
#

the one is idiomatic wrappers the other is raw bindings

#

tbh the biggest reason for zuacpi existing is that cimport/translate-c used to be way way worse at its job and i needed to fiddle a lot to make things work lmao

frank canopy
#

and another example where root complex a isnt hooked to the SMMU but does generate MSIs

#

it can also have reserved memory ranges and at least a few other things

frank canopy
#

alright zuacpi has the IORT (a basic version anyway, missing a few things that i dont need yet for my kernel) and also i added the MADT structure for the GIC ITS

fiery turtle
#

PSA: uACPI 5.0 will have a distinct return value (UACPI_MAP_FAILED) for uacpi_kernel_map to make 0 a valid return value to allow client code that identity maps all addresses + AML that erroneously tries to map physical 0

vast kestrel
#

Yum

fiery turtle
#

namely some crappy xiaomi tablet that does that

frank canopy
#

oh btw its not official-official yet but https://github.com/tianocore/edk2/issues/11148 exists and is already in acpica

GitHub

Code First Item Overview Arm has architected a new Generic Interrupt Controller (GICv5). The GICv5 architecture definition can be found here: https://developer.arm.com/documentation/aes0070/latest/...

GitHub

The GICv5 adds the following MADT structures:

  • IRS
  • ITS Config Frame
  • ITS Translate Frame

The ACPI spec ECR is at https://github.com/tianocore/edk2/issues/11148

Change-Id: I35a46714de862edd6d0...

fiery turtle
#

cool

frank canopy
#

not sure if you want to wait for it to actually get into the spec or not but figured it was worth bringing up

fiery turtle
#

๐Ÿคทโ€โ™‚๏ธ

frank canopy
#

yeah thats my feeling too

calm latch
#

this is an interesting edge case...

#

but who id maps their memory?

fiery turtle
flat badge
frank canopy
#

lmao yeah

calm latch
#

I forgot about csmwrap

frank canopy
#

ok im getting IRQ resources (not extended irq) that all report irq 29 (0x17) only and i dont think thats possible

#

since the basic irq resource is a 16-bit mask

#

@fiery turtle any ideas how i could track this down?

#

ah found the issue, was on my end

frank canopy
#

bug was in zuacpi in fact and a fix has been pushed

fiery turtle
#

Cool

frank canopy
# fiery turtle Cool

was some leftover manual field alignment in the resource types and i didnt realise that setting the alignment of the first field to 8 would force there to be extra padding after all 6 byte fields and as a result the irq list trailing array thing was doing bad pointer math and overrunning into something else

#

the manual field alignment didnt need to be there anyway so i just removed it and that fixed it

vast kestrel
#

Apparently in Gemini lake bioses are supposed to set the HW_REDUCED_ACPI bit

#

Also the fact the ucode handles the timer is cursed af

frank canopy
#

that is cursed

calm latch
#

though weren't there netbooks without acpi pm timer already?

slim panther
#

isnt gemini lake that cursed mini nuc thing

fiery turtle
#

Gg

fiery turtle
#

nt must boot

torpid root
#

lol

fiery turtle
#

@vast kestrel can u send that pdf btw

fiery turtle
#

thanks

vast kestrel
#

yeah it's that one

zenith crescent
#

Released in 2017

#

My laptop has the pentium silver from that generation, and its very slow. Base clock is 1.1GHz, boost is 2.7GHz, 4 cores. Also only passive cooling.

fiery turtle
#

That thing must be torture to work with

zenith crescent
#

Yep, it really is. Takes a couple of seconds for it to register the power button has been pressed. Windows takes a long time to boot, but it isn't too bad after that. I once tried gentoo on that thing.... Was not a good idea.

fiery turtle
#

I guess it can be good as an osdev machine for testing stuff

zenith crescent
#

Yeah

fiery ice
#

Optimizations in my memory operations worked wonderfully

#

tho idk why it still says it's slow

#

maybe my timers are screwed up?

loud ice
fiery turtle
#

PSA for those 2 people that use UACPI_FORMATTED_LOGGING, uacpi_kernel_vlog is getting removed in 5.0

#

i guess it doesnt even break backwards compat in any way, it just wont be a function exposed in the header

#

since it was never used by uacpi anyway

frank canopy
#

formatted logging is where you provide your own printf, right?

#

oh also id like to request replacing your newline at the end of logging with something that can be turned off as a feature (obv on by default)

#

(idea is to replace the final trailing \n with a macro using that stupid c thing of adjacent strings join and then let that macro be defined as nothing if you dont want trailing newline)

fiery turtle
frank canopy
#

and having to use std.mem.trimEnd every time is annoying when it could just be never sent in the first place

fiery turtle
#

Ill see what I can do

frank canopy
#

๐Ÿ‘

#

its not a huge deal itd just be nice to maybe have

#

(the other related idea would be an option to replace line endings altogether for carriage-return ecosystems but i dont have any use for that its just an idea that popped into my head)

fiery turtle
#

the hard part will be making a script to strip \n from all existing log strings

frank canopy
#

you can do that with any good find-in-files editor tbf

fiery turtle
#

maybe

fiery turtle
#

that would be cool

frank canopy
#

mhm

frank canopy
fiery turtle
#

thats the easy part

hallow marten
#

cant u literally just grep for \n"

frank canopy
#

if not its most

fiery turtle
hallow marten
#

its a simple search-and-replace I think

fiery turtle
#

all logging code already goes through uacpi_log_lvl

frank canopy
#

yeah you can do that in the log helper

#

instead of at each callsite

hallow marten
#

idk what that does

#

oh you mean after removing the line endings

#

ah

#

ok

fiery turtle
#

yes

frank canopy
#

thanks jetbrains for a good find-replace thing for getting me the patch i put above lol

fiery turtle
#
git am "C:\Users\infy\Downloads\remove-trailing.patch"
Patch format detection failed.
#

wtf do u want

frank canopy
#

lmao

fiery ice
#

it works wonderfully

frank canopy
#

since im on windows it might have some line ending bullshit

fiery turtle
#

doesnt seem to have done anything ๐Ÿ˜ญ

frank canopy
#

rip

fiery ice
#

try what i told you

#

i made it apply 90+ patches bc they did not want to apply bc of the same error

frank canopy
fiery ice
#

and it went and manually applied them

frank canopy
#

because i didnt do git format-patch

torpid root
#

what about patch

fiery ice
frank canopy
#

so its a raw patch and you might need apply instead of am

fiery turtle
#

oh nvm

#

it worked

#

cool

frank canopy
#

pog

fiery ice
#

oh

#

lol

frank canopy
#

yeah git am is for taking a format-patch output with authorship and commit messages and all that afaik

fiery ice
#

when i did it, both did nothing XD

#

on my other repo

frank canopy
fiery ice
#

and i had 90 patches to apply

hallow marten
#

would patch < file.patch work as well here

frank canopy
#

which would break

frank canopy
torpid root
fiery turtle
torpid root
#

okie

dense steppe
fiery turtle
#

be my guest lol

frank canopy
#

if you do thats your problem lmao

fiery turtle
#

@frank canopy your patch didnt catch stuff like

    uacpi_trace(
        "%sactivated all '%s' opregions controlled by '%.4s', "
        "%zu _REG() calls (%zu errors)\n",
frank canopy
dense steppe
#

There's an argument to instead doing it like printf("%s" fmt "%s", UACPI_START_OF_LOG_MSG, __VA_ARGS__ __VA_OPT__(,) UACPI_END_OF_LOG_MSG);

fiery turtle
#

why is this better?

dense steppe
#

because it allows me to use %s or literally any string as the "start of log msg" bit.

although there's also an argument against it, because it adds more indirection to logging (now you have to parse the %s whenever you are printing anything).

fiery turtle
#

or literally any string as the "start of log msg" bit.
thats already how UACPI_START_OF_LOG_MSG works

#

if you insert printf reserved stuff there for whatever reason thats a u problem

dense steppe
#

indeed it is

fiery turtle
#

like i just dont see the benefit of adding a ton of runtime cost just to support bad strings

frank canopy
#

esp when its not user-provided anyway

fiery turtle
#

yeah like its a compile time constant

hallow marten
fiery turtle
#

if u insert %s there the program wont compile

fiery turtle
#

since it uses attribute format

hallow marten
#

ah that works too

frank canopy
#

yeah

hallow marten
#

oh wait

frank canopy
hallow marten
#

yes hence the meme

fiery turtle
#

@frank canopy I pushed the feature to for-5.0 if u wanna give it a shot

#

let's see if this compiles on OpenWatcom at all

frank canopy
#

lol gl

#

ill test in a bit, im in a groove on what im writing atm and dont wanna lose it

fiery turtle
#

yeah ofc

frank canopy
#

you gonna put a ifndef default for end of log to \n to maintain compat?

fiery turtle
#

i added \n in config.h to maintain compat

#

if config doesnt define it log.h will define to nothing

#

Oh right i should also wrap it in ifndef here so that u can override via gcc and not config.h

frank canopy
#

yeah id appreciate that, overriding by the compiler is way easier for zuacpi's build setup

hallow marten
fiery turtle
fiery turtle
#

i have stuff like this in most files

#

Damn with this patch I can just do

#

Thats really convenient

#

Also good news openwatcom seems to have liked the patch

frank canopy
#

๐ŸŽ‰ nice

fiery turtle
#

thanks for the idea, I think overall its a W for everyone

frank canopy
#

glad itll help others

fiery turtle
#

I saw a ton of people complaining about it because of latest flanterm changes

frank canopy
#

oh? what did flanterm change?

#

(i dont use it so havent been watching)

fiery turtle
frank canopy
#

ah

#

tbh good, that gives guaranteed compat with serial

fiery turtle
#

Yeah

#

The change was valid

frank canopy
#

if i could make zig use \r\n for multiline strings i would for that reason too

#

but its way too convenient to use the multiline literals to not use them anyway

#

ok time to test the new stuff

#

alright it worked perfectly right out of the box so zuacpi has been updated and pushed to use the for-5.0 branch for now

fiery turtle
#

Cool

narrow steeple
#

Hmhm I'm encountering a strange issue. I'm getting a page fault in tables.c:149 from initialize_from_rxsdt at this line uacpi_memcpy(&entry_phys_addr_large, &rxsdt->ptr_bytes[i], entry_size);. The thing is it works if I run with -smp 1 or -smp 4, but with smth like -smp 8 it crashes after FACP to load APIC

UACPI: starting uACPI, version 4.0.0
Map: 0x00000000000f5000-0x00000000000f6000 -> 0xffff8000000f5000-0xffff8000000f6000
UACPI: RSDP 0x00000000000F52C0 00000014 v00 (BOCHS )
Unmap: 0xffff8000000f5000-0xffff8000000f6000
Map: 0x000000000ffe2000-0x000000000ffe3000 -> 0xffff80000ffe2000-0xffff80000ffe3000
UACPI: RSDT 0x000000000FFE259E 00000038 v01 (BOCHS  BXPC    )
Unmap: 0xffff80000ffe2000-0xffff80000ffe3000
Map: 0x000000000ffe2000-0x000000000ffe3000 -> 0xffff80000ffe2000-0xffff80000ffe3000
Map: 0x000000000ffe2000-0x000000000ffe3000 -> 0xffff80000ffe2000-0xffff80000ffe3000
Unmap: 0xffff80000ffe2000-0xffff80000ffe3000
Map: 0x000000000ffe2000-0x000000000ffe3000 -> 0xffff80000ffe2000-0xffff80000ffe3000
Map: 0x000000000ffe0000-0x000000000ffe1000 -> 0xffff80000ffe0000-0xffff80000ffe1000
Unmap: 0xffff80000ffe0000-0xffff80000ffe1000
UACPI: DSDT 0x000000000FFE0040 0000231E v01 (BOCHS  BXPC    )
Unmap: 0xffff80000ffe2000-0xffff80000ffe3000
UACPI: FACP 0x000000000FFE235E 000000F4 v03 (BOCHS  BXPC    )

Page Fault at address 0xffff80000ffe25c6 with error code 0
  - Non-present page
  - Read access
  - Kernel-mode
fiery turtle
#

What does your kernel api look like

#

Is it possible u handle this incorrectly?

map1 = map(0x1234);
map2 = map(0x1234);
unmap(map2); // also unmaps map1
narrow steeple
# fiery turtle What does your kernel api look like
void *uacpi_kernel_map(const uacpi_phys_addr addr, const uacpi_size len)
{
    const u64 aligned_address = math::align_down(addr, memory::s_page_size);
    const u64 address_diff = addr - aligned_address;
    const u64 aligned_length = math::align_up(len + address_diff, memory::s_page_size);

    for (usize i = 0; i < aligned_length; i += memory::s_page_size) {
        vmm::map(
            vmm::get_kernel_page_map(),
            aligned_address + i,
            aligned_address + i + boot::get_hhdm_offset(),
            vmm::Attribute::Write);
    }

    return reinterpret_cast<void *>(addr + boot::get_hhdm_offset());
}

void uacpi_kernel_unmap(void *addr, const uacpi_size len)
{
    const u64 virtual_address = reinterpret_cast<u64>(addr);
    const u64 aligned_address = math::align_down(virtual_address, memory::s_page_size);
    const u64 address_diff = virtual_address - aligned_address;
    const u64 aligned_length = math::align_up(len + address_diff, memory::s_page_size);

    for (usize i = 0; i < aligned_length; i += memory::s_page_size) {
        vmm::unmap(vmm::get_kernel_page_map(), aligned_address + i);
    }
}
fiery turtle
#

yeah from your code thats the bug

#

if you do it like u do it you need a reference count

narrow steeple
#

Ahh I see, yeah that would make sense why it fails

#

Nice thanks, it works now!

fiery turtle
#

npnp

frank canopy
#

fuck you acpi, if it wasnt for this one subentry these could all be 4-byte aligned but noooo

frank canopy
#

zuacpi updated with SRAT and also a bunch of refactoring to make things more idiomatic which is breaking changes but hopefully wont be too unintuitive to update to if theres anyone other than me using zuacpi

hasty plinth
frank canopy
fiery turtle
kind mantle
#

I'm afraid that needs more ACPI knowledge than you think

#

Because it's not explained what actual state the CPUs themselves enter

fiery turtle
#

it does say ACPI C3

kind mantle
#

yea well

#

my smooth brain has never heard of acpi c3 before

kind mantle
#

So C3 is basically paused but still powered on

fiery turtle
#

nope its not paused

#

cpu is still running

#

just very slowly

kind mantle
#

How slow are we talking

#

Several MHz?

fiery turtle
#

i think this info is extractable via cpuid

#

but yes

kind mantle
#

Can't immediately find where ACPI specifies what rebooting and shutting down are

#

Is it that you place it in S5?

#

And I suppose for reboots, cause something else to immediately wake afterward?

fiery turtle
kind mantle
#

I see

fiery turtle
#

but u can reboot via a deferred alarm yes

kind mantle
#

So I had correctly identified S5

fiery turtle
#

s5 is the full shutdown state

kind mantle
#

check

flat badge
#

any non zero C state means that the cpu is not running (i.e. not executing instructions)

#

C3 is clock off, cache coherency not maintained

#

The states in which the CPU keeps running (just at a slower clock rate) are called P states

vast kestrel
#

^

loud ice
fiery turtle
frank canopy
#

added madt local x2apic and x2apic nmi subentry binds to zuacpi

fierce kiln
#

I was doing iommu stuff and encountered the lack of dmar in uacpi (I might be on old version)

#

there are quite a lot of acpi tables though, and adding all of them could result in undesirable bloat to codebase size

fiery turtle
#

So we can add every existing table if someone wants to do that

calm latch
#

No, but I added that table a month ago (which broke msvc in the main branch at the time ๐Ÿ’€๐Ÿ’€)

#

The AMD table was more obnoxious though

calm latch
pallid lava
#

what caching mode is assumed for uacpi_kernel_map?

fiery turtle
#

Writeback if referencing normal ram, uncached otherwise

pallid lava
#

okay, i suppose i have to check from the memory map

fiery turtle
#

Yeah

#

You can also just rely on MTRRs to set the right one for you

#

And just always map wb

pallid lava
#

yeah, i didn't think of that

fiery turtle
#

I'm finally adding pretty advanced table info iteration api to uacpi

#

also helpers to get/put table by the internal index in the array, as well as the table count

#

the info iteratio api is mostly for more niche uses cases and it provides a ton of additional info:

  • the origin of the table: whether it came from firmware or client code, whether it has a virtual or physical origin
  • whether the table was already loaded by the aml interpreter
  • whether it passed the checksum check
  • union { physical, virtual } address depending on origin
  • number of references currently alive
calm latch
#

out of curiosity, how do you even know if the table is virtual?

fiery turtle
#

virtual is either uacpi_table_install or LoadTableOp/LoadOp from AML

calm latch
#

cool

fiery turtle
#

These are the origins:

typedef enum uacpi_table_origin {
    /**
     * A table that originated from a physical address provided by the firmware.
     * All tables discovered via RSDP have this origin.
     */
    UACPI_TABLE_ORIGIN_FIRMWARE_PHYSICAL = 1 << 0,

    /**
     * A table that was dynamically loaded by the AML firmware.
     * This includes both Load/LoadTable opcodes. Such tables live in a
     * heap-allocated kernel buffer.
     */
    UACPI_TABLE_ORIGIN_FIRMWARE_VIRTUAL = 1 << 1,

    /**
     * A table installed by the client code via uacpi_table_install_physical().
     */
    UACPI_TABLE_ORIGIN_HOST_PHYSICAL = 1 << 2,

    /**
     * A table installed by the client code via uacpi_table_install().
     */
    UACPI_TABLE_ORIGIN_HOST_VIRTUAL = 1 << 3,
} uacpi_table_origin;
frank canopy
#

uacpi_table_install feels like one of those things that almost never comes up that id somehow end up using anyway someday

#

its better than what winload does to add custom acpi tables though dear lord

#

(winload, in order to install extra tables from software, creates its own xsdt from scratch based on the firmware one but with its tables added and also stuff filtered/etc as needed, and then its own rsdp pointing to that that it gives to the kernel and acpi drivers)

fiery turtle
#

the most common use case is probably just adding missing firmware devices that some driver looks for

frank canopy
#

yeah thats what they do it for iirc

#

im on the wrong machine to actually check for sure

#

i think it was IBFT? could be misremembering but im sure the first letter of the signature was I

fiery turtle
#

I think this will be the final API:

typedef struct uacpi_table_info {
    /**
     * The index of this table in the internal array
     */
    uacpi_size idx;

    /**
     * Size of this table in bytes
     */
    uacpi_size size;

    /**
     * Signature of this table
     */
    uacpi_char signature[4];

    /**
     * One of 'uacpi_table_origin' values
     */
    uacpi_u8 origin;

/**
 * This table has been processed & loaded by the AML interpreter.
 * Only applicable for AML bytecode tables.
 */
#define UACPI_TABLE_LOADED (1 << 0)

/**
 * This table's checksum has been checked. The checksum is valid if
 * UACPI_TABLE_CSUM_BAD is not set.
 */
#define UACPI_TABLE_CSUM_CHECKED (1 << 1)

/**
 * This table's checksum was found to be incorrect.
 * Note that if UACPI_FLAG_PROACTIVE_TBL_CSUM is enabled alongside
 * UACPI_FLAG_BAD_CSUM_FATAL, such tables are never installed in the first
 * place.
 */
#define UACPI_TABLE_CSUM_BAD (1 << 2)

    /**
     * A mask of UACPI_TABLE_* flags
     */
    uacpi_u8 flags;

    /**
     * Reference count of this table
     */
    uacpi_u16 reference_count;
} uacpi_table_info;

typedef uacpi_iteration_decision (*uacpi_table_iteration_callback)
    (uacpi_handle, uacpi_table_info *info);

/**
 * Iterate every installed table on the system.
 *
 * The provided callback receives the information about each table in the
 * 'info' pointer. A table may be mapped by client code if needed via
 * uacpi_table_get_by_index().
 *
 * Note that this is a low level helper that iterates _every_ installed table,
 * even tables that are unreachable via uacpi_table_find() etc. due to bad
 * checksum.
 */
uacpi_status uacpi_for_each_table(
    uacpi_table_iteration_callback, void *user
);

/*
 * Retrieve information about the table installed internally at 'idx'.
 *
 * The number of available tables can be retrieved via uacpi_table_count().
 */
uacpi_status uacpi_table_info_get_by_index(
    uacpi_size idx, uacpi_table_info *out_info
);
#

Oh yeah I forgot about the phys address in the info struct

#
union {
    /**
     * The physical address of this table, only applicable for
     * UACPI_TABLE_ORIGIN_*_PHYSICAL.
     */
    uacpi_phys_addr phys_addr;

    /**
     * The virtual address of this table, only applicable for
     * UACPI_TABLE_ORIGIN_*_VIRTUAL.
     *
     * NOTE: use uacpi_table_get_by_index() if you need a virtual address
     *       for a UACPI_TABLE_ORIGIN_*_PHYSICAL table in order to map it.
     */
    void *virt_addr;
};
#

Bro are u fucking kidding me

#

there's an ACPICA compiler regression in macos-latest

#

it cant compile some of my tests anymore

calm latch
#

uACPI aml compiler when trl

fiery turtle
#

naah

calm latch
#

The Serial Port Console Redirection Table that is used to indicate whether a serial port or a non-legacy UART interface is available for use with Microsoftยฎ Windowsยฎ Emergency Management Services (EMS).

calm latch
#

Microsoft talks about patents something something

fiery turtle
#

patent for a C struct?

calm latch
#

Who knows

flat badge
#

spcr is already in uacpi

calm latch
#

Yeah, I've just noticed, but there is no ACPI_SPCR_SIGNATURE

fiery turtle
#

@calm latch thanks, the patches look good to me, i'll have to unfuck the acpica regression before i can merge them tho

calm latch
#

ok

fiery turtle
#

ill check how to install a specific version of a package for brew

#

(hoping it's not yet in apt & choco)

hallow marten
#

how hard could it be

fiery turtle
#

give it a shot meme

hallow marten
#

sponsor me

#

and i will

fiery turtle
#

nooo free labor when

hallow marten
#

I will make every tool uACPI requires until uACPI is completely dependent on me...

#

the documentation was just the start

fiery turtle
#

damn

#

but yeah not depending on the acpica compiler would be cool

#

because the maintainer there just accepts random bs and they have 0 regression testing

#

they dont even have CI

hallow marten
#

if i had more time id do it

#

in rust or something since parsing is easier with its types

pallid lava
#

about uacpi_kernel_install_interrupt_handler,

  1. what polarity and trigger is expected for the irq?
  2. dumb question, but it's safe to assume it's a GSI, right? (not a PIC IRQ that possibly needs to be translated to an IOAPIC IRQ using the overrides)
pallid lava
#

active high/low

fiery ice
#

why does this matter here?

pallid lava
#

because the interrupt controller cares about how the irq is going to be asserted

fiery ice
#

i always left it default, i didn't even know it could do that XD

pallid lava
#

if uacpi_kernel_install_interrupt_handler is only used to install the SCI then it would be a good idea if it is specified in the docstring above that it should be configured as an active low level irq

frank canopy
pallid lava
#

yeah, i just checked the acpi documentation and i have to check the overrides

#

for future reference

fiery turtle
#

yep

#

SCI is just a normal ISA interrupt

#

but has different defaults for polarity/triggering

pallid lava
#

impressive how on the leaderboard the top scores are 10M ops/s

#

meanwhile i have 100k/s ๐Ÿ˜†

flat badge
#

keep in mind that the top of the leaderboard does not support multi threading though

torpid root
#

mine does

#

it was like 7.5 mil iirc

#

memcpy and allocator speeds matter the most

fiery turtle
#

iirc for loop byte copy memcpy won over PhD memcpy with LTO and O3

#

Aka the uacpi built-in

fiery turtle
#

Since its in Userspace

torpid root
flat badge
#

because uacpi copies are probably so small that the loop unrolling is not worth it

fiery turtle
#

Probably

fiery turtle
#

the record with kvm was like 250 ops/s i think

#

nyaux had it

calm latch
#

It's kinda sad there probably won't be a Nyaux moment again with all of the gen ai stuff

pallid lava
#

i realized why it wasn't being so quick, i was compiling with Og rather than, for example, O3

#

however now i have random ub all over the place ๐Ÿ˜ข

#

hmm, maybe i added the Og flag later and forgot about it, with it i have 600k ops/s

#

now i have to fix the issues with O3

#

still, uacpi is pretty nice so thanks to all who contributed to its development

#

i cant wait to call random aml methods of my laptop and get random data sync flood errors

fiery turtle
#

thanks

#

it was basically just me, some people contributed new tables, monkuous contributed openwatcom support and rewrote tests in C

pallid lava
#

first disappoinment of the day: my laptop does not have the fixed power button event

fiery turtle
#

you're in for a treat yes

#

fixed power button is PC only

#

laptops have 3 different ways of routing the power button

#
  • via the EC driver + AML Notify
  • via the AMD GPIO driver + AML Notify
  • via legacy general purpose event + AML Notify
pallid lava
#

amd gpio?

fiery turtle
#

@calm latch has an impl in his kernel if u wanna take a look

#

all modern amd hw uses that

#

both ec and amd gpio are relatively easy to implement, and the legacy routing is free

#

you just have to hook a notify on the power button object in aml

pallid lava
#

i see

fiery turtle
#

legacy routing is pretty rare tbh lol, i've only seen one laptop like that, it's some toshiba that monkuous has

#

most are just EC

pallid lava
#

i had a 2016 laptop which supported it

fiery turtle
#

desktops are usually fixed event

loud ice
calm latch
#

clanker, implement the power button event on my laptop

fiery turtle
#

hardcode whatever register the firmware uses internally to check a pending pwrbtn press

loud ice
#

cros_ec isnt that hard anyway

#

and you can claim that implementing that is a "real" driver

fiery turtle
#

For anyone curious this is how general purpose event dispatch loop looks like on monkuous' toshiba laptop:

While ((GP50 || (GP51 || (GP52 || (GP53 || (GP54 || (
    GP55 || (GP56 || (GP57 || (GP60 || (GP61 || (GP62 || (GP63 || 
    (GP66 || (GP67 || (GP70 || (GP71 || (GP93 || (GP94 || (
    GPAP || (GPBP || (GPCP || (GPDP || (GPEP || (GPFP || (GPGP || 
    (GPHP || (FCDP || (FTVP || (FQSP || (GP96 || (GP97 || (
    GPD0 || (GPD1 || (GPD2 || (GPD3 || (GPD4 || (BPFE || (TPBP || 
    (ECDS || (B1ST || B2ST)))))))))))))))))))))))))))))))))))))))))
pallid lava
#

jesus

fiery turtle
#

All of these are recursive as well

frank canopy
#

lmao of course

fiery turtle
#

So it's OrOp(GP50, OrOp(...

pallid lava
#

the "worst" I've seen is

return 0xFFFFFFFE
return 0xFFFFFFFE

#

and my laptop has like 5 or 6 objects that are missing

#

acpica complains too

fiery turtle
calm latch
fiery turtle
#

nope

fiery turtle
#

wait haiku is back??

slim panther
fiery turtle
#

they're using some very niche apis and in general haiku is way more advanced acpi-usage-wise

#

than any other hobby os i've seen

#

or i guess its not even that hobby at that point since they have funding etc

frank canopy
#

yo nice

frank canopy
fiery turtle
#

the register accessors for example

#

all the GPE-related APIs also

frank canopy
#

ah neat

fiery turtle
#

Looks like no one in ACPICA cares about the regression

#

ill have to bisect the damn compiler myself

frank canopy
#

rip

fiery turtle
#
Bisecting: 61 revisions left to test after this (roughly 6 steps)
[b35adf49e89a610ea9ea33af21c1970ea95f56e4] Add validation for Node in AcpiNsBuildNormalizedPath to prevent use-after-free vulnerabilities

Not too bad

frank canopy
#

yeah that aint bad tbh

fiery turtle
#

alright

eff423cadbe44c916078d99b666406b20aea130b is the first bad commit
commit eff423cadbe44c916078d99b666406b20aea130b
Author: ikaros <[email protected]>
Date:   Sat Jan 10 20:39:57 2026 +0800

    Add AslKeywordMappingCount for validation in OpcGenerateAmlOpcode

    Fixes: #1070
    Signed-off-by: ikaros <[email protected]>

 source/compiler/aslglobal.h  | 1 +
 source/compiler/aslmap.c     | 2 ++
 source/compiler/aslopcodes.c | 8 ++++++++
 3 files changed, 11 insertions(+)
bisect found first bad commit
fiery turtle
#

Stupid choco and brew always hardcode the newest version and u cant fetch older

#

so I'll disable MacOS CI completely, and for Windows I'll download an older release manually from the intel website in CI directly

#

and linux will keep working since ubuntu is using an old version thankfully

fiery turtle
#

@calm latch could u please rebase your pr so it's on top of master? I added a fix for CI

calm latch
#

done

fiery turtle
#

Awesome

#

Btw why the hell do they ship WAET spec as a word document

frank canopy
#

all the microsoft tables are shipped that way

fiery turtle
#

lol

#

the microsoft office gate

frank canopy
#

yknow part of me wonders if those table docs all being word docs isnt some sort of licensing policy thing dating back to when pdfs were pay-to-create

crude summit
#

pretty sure that uacpi has a pattern of tons of tiny allocations and deallocations during that init process

fiery ice
#

i still need to understand why my allocator is slow AF

#

yes

#

it does

crude summit
#

it's likely O(n) during free

fiery ice
#

mine is a bit faster on a physical linux

#

on WSL it was slower

crude summit
#

I have two allocators, a base one that is really really simple and slow as a snail riding an elephant on the back of a tortoise, and then a buddy allocator which is really fast, subsystems allocate buddy allocators inside arenas in the dumb allocator, and uacpi has such a buddy region

#

it is also slow if you're using tcg for obvious reasons

#

here's mine on KVM

#
[0]: [uACPI] successfully loaded 1 AML blob, 1757 ops in 3ms (avg 536526/s)
fiery ice
#

10x faster than mine

#

lol

crude summit
#

feel free to take a look at my allocator if you want, basically uacpi only really does 3 things during init, requests memory, io space and an interrupt

#

if you give uacpi a bump allocator you can fudge that stat lol

fiery ice
#

yeah it allocates very small amounts

#

does it also release that memory after?

#

or some is kept

crude summit
#

it keeps some iirc

#

because it sets up interrupt handlers and will need memory to handle that

#

if you stub out it's interrupt registration function in your abstraction layer you can safely tear down uacpi afterwards by taking away it's allocated memory region, I used to do that

fiery ice
#

it allocates all of this, lol

#

and then 12 bytes at the end

fiery turtle
#

Uacpi scored pretty poorly on that test with a bump allocator

#

Since it made the cache cold and as u said uacpi frees and allocates tiny objects all the time

#

An allocator that reuses memory scores a lot more here

fiery turtle
fiery turtle
#

Only temporary objects are freed

#

Whatever was used during DSDT eval

fiery turtle
#

maybe i should consider making like an emulated arena allocator in uacpi

#

or like an object cache for fast reuse

crude summit
#

99% of kernels can just stub out io space requests,.it's asking for access to an io port and most kernels don't restrict that unless you're doing some kind of microkernel thing

fiery ice
crude summit
#

you might want to add that so you can profile your kernel and see where the expensive parts are

kind mantle
mortal yoke
#

on x86 its not

kind mantle
#

do you just identity map the whole lower half?

#

smh

mortal yoke
#

its for port io

kind mantle
#

right

#

I honestly haven't used x86 for so long I forgot it had that

fiery turtle
#

yeah lol

#

map_memory is for mapping memory

#

i guess the names could be clearer but they're designed after their respective name in the acpi spec

#

aka SystemIO and SystemMemory

#

well there's a comment there i guess

crude summit
#

I'm betting debug output is the most expensive part of that?

fiery ice
#

or well

#

i can't see the print functions

#

they would polute too much

crude summit
#

how can you not see them? you exclude them from profiling?

hallow marten
fiery ice
#
  • -finstrument-functions
crude summit
#

hmmm thats why you cant profile debug output

#

the ouput format isnt flexible enough

#

i recommend outputting it in callgrind format on e.g. com1 or the qemu console

#

then, loading that into kcachegrind

fiery ice
#

hmm

#

i'll try

crude summit
#

if you want i have code for that

fiery ice
#

oh yes pls

crude summit
#

its just a simple text format a bit like yaml

#

you do need to store 'edges'

#

mine stores it to a simple hash table

#

then just walks the hash table when i press a debug-key (ctrl-alt-shift-P)

fiery ice
#

thx