#uACPI - a portable and easy-to-integrate ACPI implementation
1 messages · Page 21 of 1
yeah sounds like bs
i wonder if you're supposed to first call some other method
linux does i think?
like display init
it reads from a hardcoded place in NVS
that it updates from BCM
so no wonder its 0
btw
the package it retruns just has every value from 0 to 100
Return (Package (0x67)
{
0x50,
0x32,
Zero,
One,
0x02,
0x03,
0x04,
0x05,
0x06,
0x07,
0x08,
0x09,
0x0A,
0x0B,
0x0C,
0x0D,
0x0E,
0x0F,
0x10,
0x11,
0x12,
0x13,
0x14,
0x15,
0x16,
0x17,
0x18,
0x19,
0x1A,
0x1B,
0x1C,
0x1D,
0x1E,
0x1F,
0x20,
0x21,
0x22,
0x23,
0x24,
0x25,
0x26,
0x27,
0x28,
0x29,
0x2A,
0x2B,
0x2C,
0x2D,
0x2E,
0x2F,
0x30,
0x31,
0x32,
0x33,
0x34,
0x35,
0x36,
0x37,
0x38,
0x39,
0x3A,
0x3B,
0x3C,
0x3D,
0x3E,
0x3F,
0x40,
0x41,
0x42,
0x43,
0x44,
0x45,
0x46,
0x47,
0x48,
0x49,
0x4A,
0x4B,
0x4C,
0x4D,
0x4E,
0x4F,
0x50,
0x51,
0x52,
0x53,
0x54,
0x55,
0x56,
0x57,
0x58,
0x59,
0x5A,
0x5B,
0x5C,
0x5D,
0x5E,
0x5F,
0x60,
0x61,
0x62,
0x63,
0x64
})
and if it detects linux it returns some other crap lol
perhaps
OBOS becomes DOS
maybe I need to call _DSS
seems like I need to pass 0x8000'0001
which tells it to enable the display, then commit the changes
If (((Arg0 & 0xC0000000) == 0xC0000000))
{
CSTE = NSTE /* \NSTE */
}
your aml checks one bit
bruh 
2 bits ¿
hmm
considering GFX0 doesnt even have a DSS
why that specific DD
because that's where I get the brightness event
ah
so I just did all my stuff there
probably correct
how long does run_tests.py --large take to run usually?
like 5 minutes
use make
Add a big mutex around the logs 
its python soo
well in case it fails you could just append to a results array and print the errors at the end
ye
i'll look into making the runner parallel in a bit
that'd be based
i want to give sso a shot because im bored + where is pitust 

while you guys do that, I will be staring at AML
i see that uacpi has no actual string type, everything seems to be a uacpi_buffer
so i guess it's a small buffer optimization
I hate AML
who doesnt
acpi spec devs before starting work:
I think by now it's a good idea to just ditch this
since I can't figure out how to get it working
I'll get it working eventually™️
maybe the reason I wasn't able to get it to wokr
*work
was because I was reading the spec
yup
https://elixir.bootlin.com/linux/v6.12.6/source/drivers/acpi/acpi_video.c#L679 maybe something to do with this?
Elixir Cross Referencer - source code of Linux v6.12.6: drivers/acpi/acpi_video.c
linux calls this on init
perhaps
idk it does kind of a lot
bus_DOS?
.
used to be exactly. now it's usually a fixed speed at around the same value so you can use it for timekeeping since cpu speed can vary
damn i forgot how shit python multiprocessing is 
indeed
i WILL make it work.
based
they already run in parallel i just need to fix passing results from workers back to the python runner

daaamn
@fiery turtle I have an update to obos' score:
[uACPI][INFO]: successfully loaded 1 AML blob, 1704 ops in 5ms (avg 323566/s)```
free 200k?
send iso + command line
Big
qemu-system-x86_64 obos.iso -M q35 -m 1G -accel kvm -cpu host -debugcon file:/dev/stdout
when it's done booting it suspends
[ WARN ] Note: Framebuffer might die
didnt even get one in the first place 
HOW DO I QUIT
WTF
that's because of suspending shenanigans
[uACPI][INFO]: successfully loaded 1 AML blob, 1705 ops in 5ms (avg 314941/s) slower than urs wtf
open a new tty and kill qemu
362128/s
qemu nographic
yeah that worked
[uACPI][INFO]: successfully loaded 1 AML blob, 1705 ops in 3ms (avg 446980/s)
it varies wildly
i get 270k then 440k
weird
315k, 270k, 320k, 309k
ok there's my new score
lmaoo
the highest i got was 371k/s
446k was the highest i got out of like 5 runs
ill try running it on windows under whpx
reminds me i should un-stub my mutex and event stuff since i have those implemented, its just that any timtout other than 0 or infinite is unimplemented atm
since a lot of spinlocks are taken, a lot of IRQL changes are made, which according to fadanoid, cr8 is pretty expensive
[uACPI][INFO]: successfully loaded 1 AML blob, 1705 ops in 3ms (avg 499891/s)
ok new score 
let me fix it
why do you need popcnt
can that not be emulated
technically everything can be emulated
or that
that's also what I got
i can try on bare metal
when I did that
but you'd need to get rid of suspend ☠️
more ops=less score
ah right 
I assume you don't trust it's implementation
no i just don't think i'd be able to read quickly enough
wouldn't it literally suspend my computer
then i'd be able to read the score
(waiting on uDRM for that)
i'm not rebooting now anyway because i am improving uacpi test runner
this one doesn't suspend
okay after measuring sso isnt that big of a deal actually i think
this is my new score
i should try rerunning the full uacpi benchmarks
wait u managed to get it working?
yeah
Damn
i also found out my measurements were crap
and i forgot about all the calloc'ed allocations lol
Lmfao
i'm getting 143k/s with tcg now (i also added a slightly better slab allocator to my shitty kernel)
my gut for handling strings like that has been a string table but the way zig makes that super easy relatively speaking has been skewing things a bit tbh
plus idk if string collisions are enough to be worth it at the scale above four-char ones where youd just use a u32
most allocations still come from deep_copy_package though
and uacpi_execute_control_method
i think that's the "allocate literally any object" thing, though
cant do much about that
@fiery turtle what do you use for formatting python?
Nothing lol
Check the CI script for tools that do the linting
Yeah
Probably
upgraded the test runner's output a little bit
oh whoops
wow discord doesn't even show the full thing
but yeah it now prints the time each test takes and the total amount of time they all took
along with the progress on each test
the code ain't even that bad, i think it's ready for pr
i haven't really tested how it looks like when they fail but 
the results are all printed sequentially and i basically stole the old code for printing that
shouldn't be too different
[28/65] references-4.aml:Call-by-value w/ Store() does NOT modify integers even through a reference OK in 0.01s
[29/65] references-10.aml:Recursively modify ArgX OK in 0.01s
[29/65] empty-objects.aml:Empty objects behave correctly FAILED in 0.01s
TEST OUTPUT FOR empty-objects.aml:Empty objects behave correctly:
stdout:
[uACPI][INFO] RSDP 0x0000783597103D90 00000024 v02 (uOEMID)
[uACPI][INFO] XSDT 0x0000504000001090 0000002C v02 (uTEST uTESTTBL)
[uACPI][INFO] DSDT 0x0000508000000220 00000055 v02 (uTEST TESTTABL)
[uACPI][INFO] FACP 0x00005120000004C0 00000114 v06 (uOEMID uTESTTBL)
[uACPI][INFO] FACS 0x0000506000000440 00000040
[uACPI][INFO] SSDT 0x0000000000000000 00000055 v01 (uTEST RUNRIDTB)
[uACPI][TRACE] load of 'DSDT' (OEM ID 'uTEST ' OEM Table ID 'TESTTABL')
[uACPI][TRACE] load of 'SSDT' (OEM ID 'uTEST ' OEM Table ID 'RUNRIDTB')
[uACPI][TRACE] [AML DEBUG] String => "TestRunner ID SSDT loaded!"
[uACPI][INFO] successfully loaded 2 AML blobs, 7 ops in 0ms (avg 33040/s)
[uACPI][TRACE] initialized GPE block _GPE[0->128], 0 AML handlers (IRQ 0)
[uACPI][TRACE] initialized GPE block _GPE[128->256], 0 AML handlers (IRQ 0)
[uACPI][TRACE] fixed event 0 enabled successfully
[uACPI][TRACE] activated all 'EmbeddedControl' opregions controlled by '\ ', 0 _REG() calls (0 errors)
got a GPE
[uACPI][TRACE] activated all 'PCI_Config' opregions controlled by '\ ', 0 _REG() calls (0 errors)
[uACPI][INFO] namespace initialization done in 0ms: 0 devices, 0 thermal zones
[uACPI][TRACE] _STA calls: 0 (0 errors), _INI calls: 0 (0 errors)
[uACPI][TRACE] [AML DEBUG] Uninitialized
[uACPI][TRACE] [AML DEBUG] Package @0000503000001bd0 (0000503000001c30) (0 elements)
[uACPI][TRACE] [AML DEBUG] Package @0000503000001f30 (0000503000001f90) (0 elements)
[uACPI][TRACE] fixed event 0 disabled successfully
stderr:
unexpected error: returned value '1' doesn't match expected '0'
[30/65] mutex-1.aml:Automatic mutex release OK in 0.01s
[31/65] indices-0.aml:Buffer Indices OK in 0.02s
[32/65] table-overrides.aml:Table overrides work OK in 0.01s
[33/65] store-copies-buffer.aml:Store Copies The Buffer OK in 0.01s
[34/65] eval-supports-plain-objects.aml:Eval supports plain objects OK in 0.02s```
i made one of the tests fail on purpose and that's how it looks like, i think it's okay
[26/65] empty-objects.aml:Empty objects behave correctly FAILED in 0.01s
STDOUT FOR empty-objects.aml:Empty objects behave correctly:
[uACPI][INFO] RSDP 0x00007C5179F03D90 00000024 v02 (uOEMID)
[uACPI][INFO] XSDT 0x0000504000001090 0000002C v02 (uTEST uTESTTBL)
[uACPI][INFO] DSDT 0x0000508000000220 00000055 v02 (uTEST TESTTABL)
[uACPI][INFO] FACP 0x00005120000004C0 00000114 v06 (uOEMID uTESTTBL)
[uACPI][INFO] FACS 0x0000506000000440 00000040
[uACPI][INFO] SSDT 0x0000000000000000 00000055 v01 (uTEST RUNRIDTB)
[uACPI][TRACE] load of 'DSDT' (OEM ID 'uTEST ' OEM Table ID 'TESTTABL')
[uACPI][TRACE] load of 'SSDT' (OEM ID 'uTEST ' OEM Table ID 'RUNRIDTB')
[uACPI][TRACE] [AML DEBUG] String => "TestRunner ID SSDT loaded!"
[uACPI][INFO] successfully loaded 2 AML blobs, 7 ops in 0ms (avg 28497/s)
[uACPI][TRACE] initialized GPE block _GPE[0->128], 0 AML handlers (IRQ 0)
[uACPI][TRACE] initialized GPE block _GPE[128->256], 0 AML handlers (IRQ 0)
[uACPI][TRACE] fixed event 0 enabled successfully
[uACPI][TRACE] activated all 'EmbeddedControl' opregions controlled by '\ ', 0 _REG() calls (0 errors)
got a GPE
[uACPI][TRACE] activated all 'PCI_Config' opregions controlled by '\ ', 0 _REG() calls (0 errors)
[uACPI][INFO] namespace initialization done in 0ms: 0 devices, 0 thermal zones
[uACPI][TRACE] _STA calls: 0 (0 errors), _INI calls: 0 (0 errors)
[uACPI][TRACE] [AML DEBUG] Uninitialized
[uACPI][TRACE] [AML DEBUG] Package @0000503000001bd0 (0000503000001c30) (0 elements)
[uACPI][TRACE] [AML DEBUG] Package @0000503000001f30 (0000503000001f90) (0 elements)
[uACPI][TRACE] fixed event 0 disabled successfully
STDERR FOR empty-objects.aml:Empty objects behave correctly:
unexpected error: returned value '1' doesn't match expected '0'
[27/65] table-loading-0.aml:Load tables from buffers OK in 0.03s```
fixed the indentation, let me pr this stuff
how badly will uacpi break if my mutex lock and event wait dont implement timeouts? a 0 timeout to just test is implemented but timing out a blocking wait is not
i don't imagine it will break, just mutexes that should time out won't
i guess that is the definition of it breaking 
lol
if itll just maybe wait longer than expected in some cases then i can probably just plug it in yeah
"1 workflow awaiting approval" 
brb i gotta go to the store, pls run the ci when u can @fiery turtle
nvm not going yet
how did you people improve the scores so much
uacpi update dropped
nice
ill have to re-do my benchmarking too tbh
Once I finish cooking up the new locks I will update uacpi
well the performance improving update is currently still in a pr, not on master
daaamn
really cool work
ill review in a bit
sounds good
where the f is the run ci button
i found a bug in uacpi, one case in status to string is missing
If you are comfortable with running workflows on the pull request branch, return to the Conversation tab, and under "Workflow(s) awaiting approval", click Approve and run.
oh, i see that i's missing
that is really weird i guess github moment
uhhh lmao
which one?
InvalidTableLength
status.h done, only 16 headers to go
thanks for the report

no reply lol
maybe you can go there and approve it that way?
that worked..
how did u find it lol
i figured since the workflow was created it must be there
it just need to be approved
oh so the binary operator goes on the new line
u have access to these right?
nice
single error
yeah
github kinda dumb
and no button again
great ui github
indie website
really went downhill after msft acquisition
yup
WHAT
BREAK AFTER BINARY OPERATOR BAD
BREAK BEFORE BINARY OPERATOR BAD
WHAT AM I SUPPOSED TO DO
loool
lemme see what its complaining about
print(f"[{pass_count}/{len(cases)}] {case.name} "
+ f"{status_str} in {elapsed:.2f}s", flush=True)```
this
- at the end of first line was bad
and this is bad too
u dont need a plus there do u not?
i need it because if i put it on one line it complains the line is too long
>>> x = "hello" " world"
>>> x
'hello world'
pusehd
wtf python
i like how the ones that failed are still running
this sort of nonsense is why I despise python lmao
ok type checking fails, makes sense
are you aware that C also does this? lol
@fiery turtle what happens if
uacpi_object_type uacpi_object_get_type(uacpi_object*);
gets a object with a type that is not present in the enum uacpi_object_type?
thats not really possible
ill install mypy locally and see if all works
i dont use c lmao. ive not even used c++ since 2014ish either
u can panic in this case if tahts appropriate in rust
did not actually know c also does that specific case though
In any case, it's a feature in many langs to break up multi line strings
its very useful in C
whats it good for in C? now im curious
ah yeah i can imagine its nice for macros
e.g. make_str(arg0) "prefix" #arg0 "postfix"
i should have tested it all locally anyway lol mb
make gh work for its living lmao
lets see how long windows takes, it used to take 20 mins
nice
ubuntu took 6 minutes
linux should see a bigger speed up with 4
oh 6 minutes is kinda slow
how long did it usually take?
oh idk
i should have added a print but oh well
wait uh
Run python3 /Users/runner/work/uACPI/uACPI/tests/run_tests.py --bitness=64 --large
i dont see paralellism here
is it done automatically?
ohh
you can specify --parallelism N manually if you want
it does the large tests in 29.29s for me locally with parallelism=24
oh yeah i didnt see default=os.cpu_count() or 1
so hopefully it speeds up your local workflow too
it definitely will
i think they overprovision their vms
so while technically you get 4 cores you don't get 4x the cpu time you get with 1 core
but i'm also not sure if they give you 4 cores
yeah probably
they all do wtf
i guess they're just not 100% of the cpu
for me large tests finish in ~100s on 4 cores
SUMMARY: 359/359 in 131.25s (ALL PASS!) on ubuntu
for 32 bit runner
SUMMARY: 359/359 in 121.25s (ALL PASS!) on windows for 64 bit runner
nice, I'll clone locally and give it a try, see if i can find nits perhaps (
)
amazing
also run_tests builds with ninja if it can, gives a nice speed up on my machine
i think i have ninja so it should pick that up automatically right
yeah as long as you nuke tests/runner/build-*
because that is already configured with makefiles
yeah
SUMMARY: 359/359 in 112.19s (ALL PASS!) locally with parallelism=4
those ci jobs also install dependencies and stuff
that could be taking some time too
yep
oh yeah of course
ye
that 133.12s is from when it starts the first test to the end of the last test so it's purely compute bound
doesn't include compiling aml
could also be that fork+exec is slow-ish in a vm too, idk
indeed
I think pitust has a working version?
although its private 
exactly
and i think it should make a noticeable difference
getting rid of all the allocations is big
and it should able to hold up to 14-15 bytes
unfortunately no such big improvements for 32 bit builds, since strings are 8, not 16 bytes
yeah
but most targets are 64 bit anyway
ok i go to the store and when i come back i do sso

omg it detected the fact that i have ninja on windows and found some old ass garbage clang
instead of MSVC
is there any way to tell it to prefer msvc?
And you also need to do this before the first project statement
Ninja doesn't deal with setting the compiler afaik
this already works correctly if u dont force -G ninja
I think just not doing -G ninja if it detects os() == Windows is good enough
i want a solution file on windows anyway
not a ninja file
czapek can we just maybe skip the ninja existance test on windows ig?
its not ninja at fault but cmake
absolutely
yeye
amazing
could you so that?
do*
im not home
and you can push to my branch
or merge and push to master if you want
I tested on wsl and looks great
Sounds great
afaik the compiler detection is completely separate from build system detection
also cmake probably picks up clang from path
I guess the default generator on windows just picks up MSVC
yeah it should 100% given you want to test msvc
Probably visual studio just does MSVC because its biased 
thats the default yeah
yep
cmake's default output is a solution file on windows, which then gets compiled by msbuild iirc? but using msvc
(i used to be the designated person who has windows for a cmake-based project which was meant to use mingw instead of msvc and fought with it for quite a time to get it all working just right)
what's a cmake toolchain file
yeah was about to say lol
you can use ninja with msvc on windows but youll need to do all the toolchain stuff manually
also the pci attach api is possibly gonna be real nice to have tbh
itll let me map things onto the same setup ive already got for my primary pci access functions
Just sets platform specific stuff
and the compiler to use etc
Ye
pci attach api?
yeah so why shove that into the main cmake file
He was asking for a workaround
in the same pr as making calloc optional; kinda like the io-map stuff but for pci stuff. most useful because it lets me attach the ECAM region pointer once instead of finding it again each time
because looping through the mcfg stuff each time is slow
Ah i see
i may actually refactor my pci access functions to take a struct instead of a bunch of arguments because ive got those arguments as basically a struct stored in most of the places it gets accessed
either that or ill keep to working on the memory manager that i keep getting distracted from by all the uacpi things
noo dont u want to spend countless hours doing random optimizations to get extra uacpi points 
no but i do want to get more devices working
also i still need to figure out if the uacpi event thing is closer to a KEVENT or to a semaphore because i do not know linux apis and thus event_fd means nothing to me and the docs are as usual hard to read for linux things like that
Alas, we have been lead astray by thy, Oh Infy. Thou hast lead us to do countless hours of optimizing due to thy project
whats kevent
it's just a semaphore
windows nt event object. can be either auto-reset or manual-reset
like
the all caps is because its a type in the NT kernel so its always all caps
so its a semaphore then ok
if its value 0 reads block
if its value is greater than 0, u decrement and instantly return
u can also increment this value
my brain operates entirely on windows terminology so i kept seeing event and getting hung up expecting the windows event object lol
Microsoft 
im not sure if kevent is similar
In the windows world event is a bit different to a semaphore
but sounds like it is
signaling a signaled event is a no-op for what windows calls events
And given acpi comes from Microsoft it would make sense to be similar, even if it isn't in practice
it doesnt keep a counter of how many times its signalled
^
not bad
yeah thats just a binary semaphore
oh heck yeah choccy milk is good
aka a mutex
i think
no because theres events that dont reset to unsignalled on wait
And in general the wait can return with a different state (auto-reset vs manual-reset)
yeah
AutoReset is basically using a mutex for an event
theres two kinds of events, one resets to unsignalled if you wait it and acts more like a mutex (though mutexes also exist and are separate on windows) and manual reset ones dont reset so waits on a signalled one are no-ops
yeah that
linux eventfd is also the former example
the kernel also calls them synchronizationevent and notificationevent whereas windows usermode calls them autoresetevent and manualresetevent
i hope it will auto-approve if u make other prs in the future
oh and the function to signal a windows event also has an option to not lower irql when it returns so you can do a non-preemptable signal-and-wait with it
this is for new contributors only to prevent malicious prs i guess
or maybe to prevent people from spamming ci on popular repos
but not like they cant do it on their own public repos if they want to harm github/microsoft
tooootally hasn't been done already 
yeah idk its dumb
aight ill
once its done with ci
lfg
a binary semaphore can be used to implement a mutex but it's not exactly the same, right?
is it?
lfg indeed
time to drink some choccy milk and give sso a go
unlock -> lock is usually not defined for a mutex
lmao
btw have you looked at zig? :D
thats a good combo
im curious
not yet but i should rn
i had some pr churn going
wrapping up for uacpi 1.0
which will come first uACPI 1.0 or dark finishing all 16 major device drivers 1607 implements in ACPI.sys 
how many callbacks is that
how big is one callback?
I haven’t counted all of them
Smol
now im curious what the 16 are
im predicting at least a week for uacpi 1.0
let me post the wall
btw i can move the template under ultra if u want lol
"ACPI0007"
"FixedButton"
"PNP0000"
"PNP0001"
"PNP0002"
"PNP0003"
"PNP0004"
"PNP0100"
"PNP0101"
"PNP0102"
"PNP0200"
"PNP0201"
"PNP0202"
"PNP0800"
"PNP0A05"
"PNP0A06"
"PNP0B00"
"PNP0C00"
"PNP0C01"
"PNP0C02"
"PNP0C04"
"PNP0C05"
"PNP0C09"
"PNP0C0B"
"PNP0C0C"
"PNP0C0D"
"PNP0C0E"
"PNP0C32"
"SNY5001"
"IBM0062"
"DockDevice
"ThermalZone"
"Processor"
there
Only 16 of these matter though
screw dockdevice
up to you, if you don't mind occasional zig breakages lol
before that happens tho i'd like a proper ultra protocol binding thing
i mean i can make u the admin of the repo right
yeah
ah ok
does uACPI actually stand for Ultra
it micro and ultra
lmao
uNIX when
uNT
lmao
GNU/uNIX
GNu
that’s better actually
ultra digital rights management
so processor, fixed button, all five types of interrupt controller, AT EISA and MCA timers, all three DMA controller types, AT-style speaker sound, generic acpi bus, generic acpi eio bus, AT RTC, "plug and play bios", system board, generic reserving resources, math coprocessor, apm bios, embedded controller, acpi fan, power button, lid, sleep button, HIDACPI button, dock, thermal zone, processor, and idk what sny5001 and ibm0062 are
idk why i have the devids file open always but i do
ci about to be green 🔥
some of
Them are just empty IRP handlers yeah
Each one of those create a unique PDO though 
so when is pr 106 being merged into uacpi i want it
And MS shoved it all inside ACPI.sys
I thought windows 11 would be better but it’s architected exactly the same

that reminds me, is RTC guaranteed to be in acpi somewhere?
thanks a lot, based work
thanks 🎉
well idk about guaranteed, its firmware afterall
but usually yes
eh true
and it even exposes methods to read it
your contributor list on the main page is no longer a list, just a bunch of avatars
later today

lmao
i just want to know if i need to bother with figuring a way to make drivers do a root device if they dont get one from enumeration for rtc lol
wait really? neat
if a firmware dev tells u not to trust them u better listen
yeah we’re terrible people
that's a good emote we should steal
yeah
how about
and 
what are they called? went looking in my acpi dump and not finding anything really
ok I need to lock in
I keep getting distracted by discord and our crappy kernel pushlock code
ill try to look at the dumps that i have and let u know, idr off the top of my head
lmao same
oh god
huh?
that will end terribly
yeah there’s something seriously wrong with the way our .. environment builds uACPI
When I build it as standard C it crashes MSVC
bruh
looks like theres an abstraction device with HID ACPI000E that has the methods but neither of my machines have it afaik
least broken msvc build env
_GRT
which should in theory work on any platform (= also on arm servers etc)
OperationRegion (RTCM, SystemCMOS, Zero, 0x3F)
Field (RTCM, ByteAcc, Lock, Preserve)
{
SEC, 8,
Offset (0x02),
MIN, 8,
Offset (0x04),
HOR, 8,
Offset (0x07),
DAY, 8,
MON, 8,
YEAR, 8,
Offset (0x32),
CNTY, 8
}
Method (_GRT, 0, NotSerialized) // _GRT: Get Real Time
{
Local0 = Buffer (0x10){}
CreateWordField (Local0, Zero, Y)
CreateByteField (Local0, 0x02, M)
CreateByteField (Local0, 0x03, D)
CreateByteField (Local0, 0x04, H)
CreateByteField (Local0, 0x05, MIN1)
CreateByteField (Local0, 0x06, S)
CreateByteField (Local0, 0x07, V)
CreateWordField (Local0, 0x0A, TZ)
CreateByteField (Local0, 0x0C, DL)
FromBCD (YEAR, Local5)
FromBCD (CNTY, Local6)
Y = ((Local6 * 0x64) + Local5)
FromBCD (MON, M) /* \_SB_.AWAC._GRT.M___ */
FromBCD (DAY, D) /* \_SB_.AWAC._GRT.D___ */
FromBCD (HOR, H) /* \_SB_.AWAC._GRT.H___ */
FromBCD (MIN, MIN1) /* \_SB_.AWAC._GRT.MIN1 */
FromBCD (SEC, S) /* \_SB_.AWAC._GRT.S___ */
TZ = 0x07FF
DL = Zero
V = One
Return (Local0)
}
Example
yep my machine doesnt have it
instead ive just got a PNP0B00 device that defines a decode16 io region and optionally a single irq (if hpet is disabled)
about 30% of machines have it
how can i disassemble the tables from an acpidump?
see pins
thanks
and sometimes it tries to assemble the aml as if its asl because it gets confused in my experiencce
This file specifically
Will just blow up MSVC
oh I’ll run the sync script
1/3 chance, nice lol
it also does _SRT
This sounds like something clang would do
i wonder how insane my motherboard's aml is
look around see if u can find a 50 conditions while loop
Only 50?
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)))))))))))))))))))))))))))))))))))))))))
The worst thing I’ve seen was on an nvidia product
rookie aml
could be worse

Imagine bios developers started testing against uACPI
no weird while loops but```
While (One)
{
If ((!IBSY || (IERR == One)))
{
Break
}
If ((Local0 > Local1))
{
RPKG [Zero] = 0x03
Return (RPKG) /* \IPCS.RPKG */
}
Sleep (One)
Local0++
}```
a possible infinite loop
id hope it would the same as testing against latest nt
thats a classic
thats why uacpi has while loop timeouts
nah anything without a _ prefix is private so to speak
here’s hoping
Win11 doesn’t have a lot of extra stuff
ah makes sense
usually u can figure out either by whos calling it or unstripped debug logs
yeah
i ain't reading all that
they usually have a custom method called ADBG or similar
that writes to proprietary debug regs
does uacpi let you capture Debug writes somewhere?
only via kernel log atm
as trace level
ah
❯ grep -rni 'ADBG' -l | wc -l
568
seems like most blobs have it
guess u got the unlucky stripped debug logs blob
ssdt1.dsl
26: Name (ADBG, Buffer (0x0100){})
also lol ```
8215: Debug = "Fn+ESC Pressed"
8222: Debug = "Fn+F1 Pressed"
8229: Debug = "Fn+F2 Pressed"
8238: Debug = "Fn+F3 Pressed"
8247: Debug = "Fn+F4 Pressed"
8254: Debug = "Fn+F6 Pressed"
8261: Debug = "Fn+B Pressed"
@fiery turtle what is a uacpi_data_view and what exactly does it do/represents?
the union confuses me why 2 pointer? isnt a slice ptr + len?
because the data might be char data for strings, or binary data for data buffer
its a union
so its just for convenience
no i mean:
uacpi_u8 *bytes;
const uacpi_u8 *const_bytes;
because this is used as an in param or out param sometimes
so its either writable or readable data
depending on where its used
its just an anonymous data view
so the union contains 4 pointers?
1 pointer with 4 names
you said it yourself, it's a union
it's the same pointer but with a different type
for use in different scenarios
i got confused by the empty line
are you familiar with C unions?
i think for rust u just want to store one pointer and have like as_something() ig
i know the concept of a union
idk how rust does it
untagged?
or you can at least have repr(C) unions
that do the same thing
but muh ub unsafe and all that crap
idk
i think for the purposes of rust having this data structure literally translated would be not super idiomatic
not at all, no
INFO (uacpi): successfully loaded 1 AML blob, 1705 ops in 2ms (avg 689201/s) welp
this is still old branch but also
it's slow as balls
uacpi does a lot of allocations that fit buckets 5-10
and it needs to create a lot of them
so every 30 or so allocations you end up creating a new bucket
and that is slow-ish
because it needs to insert it into the treap
and all that
is this the api-changes pr?
main branch
also the time in nanos computation hits a divide by 0 exception if i use tcg since i only use hypervisor leaves for calibration lmao
my pmm is singly linked lists of free pages with each next-pointer stored in the first bytes of the free page itself, using an hhdm to access it
im currently in the middle of redoing all of my memory manager stuff though
that should be good enough
yeah im 100% sure the bottleneck is GPA
but also im not really going for records here
am a bit surprised though, this is lower perf then last time i tested it lmao
lemme try kvm on wsl2 instead of hyperv accel
on wsl2 with kvm accel i get 1669364/s, on windows with whpx accel im now getting 1006173/s and idk what changed

MSVC is NOT beating the insane allegations
yup
how is msvc subject to the same bug as clang on windows
that's how we build 32bit MSVC ros
i wonder if its some libc bug
it's insane
interestingly on kvm accel my actual device enumeration takes like 5-10 seconds to process but uacpi is ~75% faster to load aml compared to whpx/hyperv
whereas on whpx the device enumeration is fast enough that i dont notice it but uacpi is slower
and i compile with msvc all the time and it works fine, but my msvc is latest so thats why it works probably
nah this is latest we just do some weird stuff
ah
either way on kvm accel i now get consistent 1.6-1.7mil ops/s
we actually have targets for clang, gcc and msvc at once
nice
wtf what did u do
nice
is interpreter.c the only place where string/buffer objects are created/used?
we also support VS2017
but that's likely getting dropped
with this being imported
qemu-system-x86_64 -drive format=raw,file=drive.bin -accel kvm -d int,cpu_reset,guest_errors --no-reboot -M type=q35,smm=off,hpet=on -cpu qemu64,+invtsc,+pdpe1gb,+rdrand,+arat,+rdseed,+x2apic -m 4G -debugcon file:aaa.txt is my image and cli for anyone interested in comparing results
amazing
will 2022 work?
yes
ah ok based
this is 2022
2019 and 2022 are probably all we will support going forward
speed
any%
ok i guess my computer is just slow
what cpu?
if others are getting double the perf
this is close to linux performance btw
but u have most stuff stubbed right
yeah
once u implement those it will tank
not by a lot if u make a good mutex impl
and schedule/wait for work returns status unimplemented rn
that stuff isnt used by init code luckily
not used during init/ns load
yeah
pong
it looks like it but i wanna make sure
nope
ah rip i gotta read more code then 
types.c via user api
oh that is gonna be so fun
create_object etc
lmao
are those objects opaque outside uacpi?
yeah users cant mess with anything directly
good
there are getters for the string/buffer view
the struct u saw earlier
but its a view so its up to u what u set the pointer to
alright then i gotta do it that way
so far it works with O3 + LTO so no ub crimes have been commited by uacpi
at least not ones that would break instantly
actually yknow what, i literally have semaphore and mutex already, why not actually just plug the dang things into uacpi lmao
// This is private API, but we have to use it for tests here.
extern "C" {
#include <uacpi/internal/resources.h>
}

makes sense
trolled

yea
cmon its not that bad, this is a userspace cpp file that does resource conversion tests

makes sense
its ok
its not as bad as this
lmao
these comments remind me of pre-corporate linux

now they arent even allowed to mention MS
welp i had to setup early table access to plug in sync stuff and now thats got a gp fault
F
where does it happen
I forgor to rebase api-changes on top of iretq's changes and now i have to wait forever for ci 💀
i got interrupted before i could check the gp fault, checking now
@fiery turtle do apis that take uacpi_object ptr decrement its refcount when they drop it internally?
like which
unless there's a comment saying otherwise the refcount is the same as it was pre-call
well and for uacpi_eval's arguments specifically, AML can take a RefOf(obj) internally and store it in some global variable
so thats something to be aware of
thats why uacpi doesnt allow stack-allocated objects
well rust likes its stack variables
ok why the heck is this a gp fault and not a page fault
🎉 cool
for anyone who wants free uacpi points u may want to update now :^)
(should be faster now because dynamic array grows by factors)
@fiery turtle
typedef uacpi_status (*uacpi_region_handler)
(uacpi_region_op op, uacpi_handle op_data);
typedef uacpi_status (*uacpi_notify_handler)
(uacpi_handle context, uacpi_namespace_node *node, uacpi_u64 value);
what the fuck is that?
handlers for address space io and Notify requests
or do u mean as in what this means in C
yes
it typedefs a function pointer type
typedef uacpi_status (*uacpi_region_handler)
(uacpi_region_op op, uacpi_handle op_data);
Function pointer type called uacpi_region_handler with signature uacpi_status foo(uacpi_region_op op, uacpi_handle op_data)
so basicly:
type Binop = fn(i32, i32) -> i32;
that
ok i feel kinda dumb now but at least i found my bug
turns out when i allocate something i should also initialize the struct contents
im down from 1.6->1.4 mil/s by adding mutex and semaphore stuff
still pretty good
qemu-system-x86_64 -drive format=raw,file=drive.bin -accel kvm -d int,cpu_reset,guest_errors --no-reboot -M type=q35,smm=off,hpet=on -cpu qemu64,+invtsc,+pdpe1gb,+rdrand,+arat,+rdseed,+x2apic -m 4G -debugcon file:aaa.txt is my image and cli for anyone interested in comparing results (its the same cli)
thats still old branch btw
ive not pulled in new master
updated the leaderboard update message

i should really add proper uacpi<->proxima error code conversion functions
your function pointer shenanigan is causing me real headache, i probably need rust macros and i never wrote one
why is that
my current idea is that i create a Region/NotifyHandler function wrapper that wraps the kernel supplied handler and does safe type conversion, but for that i need compile time code expansion aka macro
i get 2.2-2.3M/s with this cmdline and image
cool
couldnt u just use a wrapper in rust to safely dispatch to different "safe" handlers?
or i guess u want it to be free in terms of overhead
upgraded to newest uacpi master and ive got 2993260, 3185403, 3112091 as first three runs under kvm (seems pretty consistent around 2.9-3.2 mil)
my newest bin, same cli as before
yes but i assume you can register Handlers for all sort of things so i need to handle an arbitrary amount of handlers
so i need a macro like register_RegionHandler!(something, handler)
which expands to code that registers and wraps the handler
thats with mutexes and semaphores implemented not stubbed
true
i get 4M with this
so like 50% speedup by just upgrading
so i have a internal function signature that is uacpi one just in rust and a public one that the kernel uses
what the fuck
apparently the zig gpa isnt as slow as id thought
again thats got full semaphores and mutexes
thats like second place now
only sleep and stall are still stubbed
but a lot of people still havent updated ig
(well and schedule/wait for work but thats not relevant to init benchmarking)
considering everything on the leaderboard rn is with unupdated uacpi, it'd probably be in between astral and menix
fair
we'll find out when more people update ig
either way im callin this good for now lmao
very very solid yes
i wonder what it'd take to get proxima to 7M
SSO perhaps 
using the nyaux allocator perhaps
what is sso?

i am half way through interpreter.c
slowly starting out using the nyaux allocator
storing small strings inside the pointer
types.c and utilities.c done
big
real meaning btw
i also use 7 bytes out of the length
daamn
leaving 7 bits for length and 1 bit for the flag
makes sense
I forgot to dump the tables 😦
and now instead of accessing buf->data, buf->text and buf->size you use thesec #define UACPI_INLINE_DATA_MAX_SIZE sizeof(void *) + sizeof(uacpi_size) - sizeof(uacpi_u8) #define UACPI_BUFFER_IS_INLINE(buffer) ((buffer)->inline_data.is_inline) #define UACPI_BUFFER_DATA(buffer) (UACPI_BUFFER_IS_INLINE(buffer) ? \ (buffer)->inline_data.inline_data : (buffer)->data.data) #define UACPI_BUFFER_TEXT(buffer) (UACPI_BUFFER_IS_INLINE(buffer) ? \ (buffer)->inline_data.inline_char_data : (buffer)->data.text) #define UACPI_BUFFER_SIZE(buffer) (UACPI_BUFFER_IS_INLINE(buffer) ? \ (buffer)->inline_data.size : (buffer)->data.size)
On an insane PC which broke Limine at some point
I really wanna see how fast my new locks will make it, uncontended it will be 1 cas for lock and unlock
compared to the shitshow it was before
im excited as well
especially with new uacpi
makes sense
I think pmOS is now faster than menix
lmao
risc v support soon ™️
I should've advertised RISC-V as well
I was the first RISC-V OS to support uACPI I think
does aml concatenation always result in a buffer/string?
yes
if i do everything i can think of to improve perf (including stuff like stubbing mutexes, compiling with -march=native -mtune=native, etc) i can get the current uacpi commit to 7,832,670/s
insane
I need to try uACPI with AVX512 
oh right i should remove -mgeneral-regs-only and see what that does
unholy
might invalid opcode if you arent careful
me when int + int = string
yeah i gotta move basic cr4 init to my asm entry
or is concatenation done using some special operator
if u look at opcodes.h for concatenate, it does a UACPI_PARSE_OP_OBJECT_ALLOC_TYPED, UACPI_OBJECT_BUFFER,
i have no idea what that means
what would u expect in this case
concatenate is Concatenate(123, 321)



