#uACPI - a portable and easy-to-integrate ACPI implementation
1 messages · Page 31 of 1
yeah
makes sense i guess
i wanted to make a separate uacpi barebones mode for this
with just the table api
so e.g. microkernels can have two instances of uacpi
one in the kernel for just table parsing
and the full one in userspace
If you did that I’d probably replace what we’re doing in Hal with it too
nice
User mode uACPI would be cool
well that exists already 
I wanted to design a micro kernel but ROS kinda took over life
e.g. pmos runs it in userspace
(personally im not a fan of microkernels lol but yeah)
yeah
theres no main stream microkernel os period
other than niche stuff
(switch etc)
the switch kernel is the most general purpose it gets i think
yeah turns out 10 ipc calls per disk read request is not that great
to allow one you need to bake disk drivers with filesystem drivers
I’m more likely to complete this terrible thing then ever make a micro kernel now
or mess around with ebpf or something like that
or have some sort of transparent handle that can dispatch directly to the nvme server
do you have a posix subsystem?
damn
linux subsystem for reactos?
ah
Binaries are PE,
It’s an NT personality that’s posix 1.1 compliant
before the NT people got mad at the open group for being annoying
and didnt implement the rest of posix
I’m not gonna implement the rest of posix either /s
whats more annoying is they expose some posix api but with underscores for some reason
This had a GDI TO X server wrapper thing
That I could compile xeyes
Without modifying the source really at all into an exe
That would work
Because this was based off another guys idea from 2002
And I just fixed it

still incredibly based
i mean isnt the posix layer for reactos fundamentally going to suck because e.g. fork takes 20 syscalls and still cant compete with native fork in terms of accuracy
they made one for wsl1 or something?
no they made it for the original posix subsystem
how well does it work
decent
Reactos’s terrible
lmfao
I’ve ported my code to windows 2000 before
And it was just Linux but better
(I’m bias)
but you know what I mean,
MS could have made the posix subsystem great
embrace extinguish.. whatever
Reactos is more likely to implement a WSL replacement
I init uACPI very late in pmOS
Like it's running in userspace so the kernel is fully inited
Pretty much
hyper-v for ros when?
I spent a lot of
Time on AMD-SVM
someone was working on it
The funny thing is
I want to see us make an android app box
Like how wsl works
the only downside of wsl2 is it uses virtio-fs which is slow as shit
So our mobile OS can take over the world
lol
yeah phones with acpi and uefi would be nice
instead of proprietary crap linux loader
They exist now
MacOS has a kernel which was a microkernel at some point 
i know but barely
You just cache disks to kernel (?)
nooooo
you’re right
We willl see if qcom makes good on their promises
They have some what projects popping up now taking the uefi blobs and porting mainline EDK
With the blobs acting under the driver architecture
one thing u can respect ms for is them pushing actual standards
instead of insanity we have now
That’s why I choose ROS tbh
I was either going to work on haiku or ROS
I wanted to do an nvidia gpu driver
Oh how plans changed
indeed
uDRM wanted to have an Nvidia driver (?)
if marvin doesnt lose motivation
I think reversing nvidia graphics will be easier with the WDDM stuff I’m doing so maybe that’ll be possible one day
also just found a new ACPICA bug
should probably fix it
they forgor an if statement
I wanted to look at AMD GPUs, but I have no idea how GPUs work at all so idk
amd gpus are pretty well documented
And Intel.
I started with messing with Intel HD graphics
They are not
The interesting parts are proprietary
i did at one point as well, did u see my baremetal hello world triangle?
no I didn’t show me
That’s most of the way there to be honest
i dumped the shaders from mesa and stuff
Super cool
then assembled the batch buffer and submitted it to the command streamer ring
a lot of trial and error and black screen or even cpu resets
its just a bare kernel with literally a main and nothing else
did you post it anywhere?
I’m curious for sure
I need to find my first projects with it
I promise it’s more of a mess

Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
lmfao
Ohh
i even patched the mesa disassembler while working on this
upstreamed some stuff
a fix for the igpu page table dump tool as well
fun times
ill get back to this after uacpi 1.0
I really need to get back to this too but :
As uDRM?
nah, my own thing
your own driver?
Yup
I didn’t really have to
Pan frost/panthor did a lot of
The reversing work
ah
all I had to do was take their driver and mesa implementation and port some stuff over to windows
This is actually the Mali mesa driver working on windows
As a dx10 UMD
I've had this way before uDRM
although its private now lol
until its anything interesting
ah cool
LHobbies OSdev projects can’t have gpu drivers”
Lies 
Lol we'll see
i think my strength is i stick to one project even if i get tired of it
like ive been working on uacpi for two years
Poor haiku
you’ve almost got a completely usable product too
basically yeah
at this point i can vouch for its stability
its been tested on so much hw thanks to this server
iirc they port linux drivers or something like that?
That was a proposed plan
L
what
it has contracts
Okay well if that is the line then ROS isn’t hobbiest either

yeah
i dont think ros is a hobby os lol
maybe our definitions of hobby are different
It’s hard for me to consider it one when it’s rapidly getting more attention and funding
ROS?
Both ROS and haiku are getting exponentiall more people using it
Haiku is pretty solid these days
Firefox with discord
And some usb audio
And I use it in my framework 13
I guess it’s also because of people like action retro making more videos about its improvements
there’s not a lot of beos left in haiku
MJD reactos videos 💀
yeah good thing u contacted him
He spent nearly 36 hours with me
For me the distinction of hobby is that you can’t have (almost) full time paid developers, paid by the project. If you manage to hire that at least once you’re basically out for me (of the hobby sphere, project is still awesome!)

fix those damn Fast mutexes
“Fast”
That puts me in a predicament tho, I’d love to be paid by Managarm GmbH but then it’s no longer hobby 
Slowtexes
monkuous would vomit if you tell them your ops/s
It’s pretty funny
So I pay Managarm now 
lmao
tbh though I think more OSes paying for devs is cool
The top few have dominated too long
For sure
Any C++ experts? Is this necessary to get a zeroed buffer?
Recently I received an interesting question: what difference between " new T " from " new T() " in C++? Let's look at example: #includ...
If the new-initializer is omitted:
- If T is a (possibly cv-qualified) non-POD class type (or array thereof), the object is default-initialized (8.5). If T is a const-qualified type, the underlying class type shall have a user-declared default constructor.
- Otherwise, the object created has indeterminate value. If T is a const-qualified type, or a (possibly cv-qualified) POD class type (or array thereof) containing (directly or indirectly) a member of const-qualified type, the program is ill-formed;

POD -> plain old data, e.g. int
So like you do need that I think
back when SFINAE was cool
ah cool
Why is it not cool now? 
concepts
Tbh I've spent 4 years so idk if I'm much of expert
Idk I wrote pmOS as my flagship hobby project
I wonder what the fuck they meant by this
Like ACPI being able to read and write MSRs?
yeah i found some intel docs
I'll implement that in pmOS
Are there other operating systems, using uACPI and working on RISC-V?
My implementation is (should be) on par with x86
The only issue is that I don't have any physical hardware
physical riscv hw is mostly trash
well theres riscv framework i think?
uboot and ovmf
idk if it does acpi
I don’t think there’s a full edk2 port for this yet
?
It works ok on QEMU
Is what I have on my desk
You could try pmOS 
It has working GPU in Linux though with AMD GPUs
I haven never ran it on physical hardware
Yeah I want more things to try
Would be cool if it had an edk2 port though… let me see
efi uboot was working in qemu
EFI uboot works on this I think
I haven’t gotten haiku to boot
Only ROS bootloader
Oh cool it's not that expensive
No it’s a great board too
There was another board with Spacemit M1 though
But it says it's sold out everywhere
Do you have uart?
it does not
(if you're willing to try)
that's just a visionfive2 in laptop format
The kernel logs to it
I'm using limine
largest L ive seen
why should it
windows
Wait a sec I need to recompile everything
Still WIP and afaik it's just a vf2 in disguise
there is no windows
Well
There was a spec mandating it
hence the L
There is windows
these are basically exclusively embedded cpus
Which got archived
?
Ah lol, I remember that spec
unarchive the spec and mandate acpi for all riscv chips 😡
otherwise the impl is considered invalid
source?
NDA
they should have something like systemsready
something that mandates uefi
fuck device tree fw config
I’ve just seen some signs of it really nothing officially
there was something like it
I don’t think risc-v has a future if it keeps heading down the path it is
MIPS routers are still being made
they're fucking up everything
yes
did u see the format they wanted to use for the cpuid thing
💀 yea
idk which ass they pulled that out of
asn.1
The cpuid thing that was only meant for m mode
that's even more stupid
what's so hard in making a user-RO CSR
imagine you have a highly flexible and extensible ISA, only to not have a way to detect which extensions are actually available
like
who the fuck thought that would be a good idea
yeah lmao
dont worry they are planning to put some shit ass asn.1 in there
to make it so that you can detect them (in kernel mode of course)
especially not even the fucking supervisor has access to that info
how the hell is it supposed to know that
you have the DTB
Well they did (misa), except that's m mode only and only supports ~20 extensions
the dtb doesn't count
Yeah but how do you get the dtb
that is definitely how you do good device discovery
Its unspecified
m mode gives you
bootloader 
im not saying its a good solution btw
https://docs.kernel.org/arch/riscv/boot.html "$a1 to contain the address of the devicetree in memory."
Lmao
I guess that's as good as we get
i fucking hate that so much risc-v stuff is 100% linux-centric
it specifies the requirements from the kernel on the firmware
uefi specifies this shit too in a way that is 10 times more convoluted btw
i'd rather have a uefi spec than linux
tbh the linux boot proto on arm and riscv is like
actually not that bad
its a couple registers
multiboot3
if you want to read the ISA string from userspace, you just open("/proc/device-tree/cpus/cpu@0/riscv,isa", O_RDONLY)
problem solved
no flaws
do not think about this btw
or if you want to find out what kind of cpu that is you have /proc/device-tree/cpus/cpu@0/compatible
so for example my cpu is "apple,icestorm"
hmm i see one flaw with this approach 
Seems portable enough 
Lol
theres a lot of stuff under /proc/device-tree that is super useful too!
like /proc/device-tree/model
fucking stupid
i hate device trees
pmOS RISC-V build 
i dont think that is the official guidance btw
i don't want to use them
For some reason it still calls exit after fork but whatever
acpi is also a device tree
i have uacpi for that
and are native endian too
they also have names that arent four characters
god i hate acpi names so much
i thought fdts are big endian
i said native endian
i never specified the platform endianness
what does that mean
Here let’s move this to your channel
they are native endian
OF dts are a PowerPC thing
powerpc is big endian
FDTs arent OF dts
OF dts are basically ACPI/AML except with names that arent four or eight letters
then whatever the device tree spec defines
those are big-endian
aml doesnt have 8 letter names 
PNP IDs are
FDTs
well
and yes
and they are rather stupid in that way
but its also kinda not that big of an issue
idk why they did such stupid pnp id names
technically _HID can store any arbitrary string
which some devices do
fuck acpi
this shit is stupid
my devices are gonna have a PNP string that is pitust,...
and all the properties in the linux fwnode format
small pnp ids can be encoded in a dword
not that i have any i guess
memory is free
maybe thats why they did it this way
none of this is a concern
yes
this is like 20 bytes of overhead
max
this is why i dont like acpi
not that FDTs are better
if _HID was just normal names it would be way better i agree
tbh the real issue with FDTs is that they are not a thing on all platforms, and they don't have code so have fun doing your own drivers
basically yeah
the name "_HID" is in itself the ACPI name brain damage
if fdts had some sort of a sane bytecode to do the bare minimum platform config and stuff
yeah
honestly that is not a bad approach
i kinda hate it
ms is better than linux because they dont consider themselves the only os
but uh
acpi.sys is so full of bugs they may as well
fault of whoever implemented that crap 
risc-v needs microsoft
riscv needs Jesus
FDTs just fill a different design space compared to ACPI
FDTs are useful for small socs where you want to run a customized kernel on
No bytecode is a feature in this regard
The issue with that is that it's very Linux specific
How are they Linux specific?
I seen drivers breaking the meaning of fields (or just changing the content in general without replacing the compatibility) without any regard to others, so if you are not Linux and use a dtb, your driver might just break one day
Or even if you are a Linux of a different version
And when the "small" Arm/RISC-V SoCs appear in PC class computers or servers
That sounds unlikely given the backwards compat philosophy of Linux
Also, you're bundling the DT with the kernel anyway, so that's a non issue
Arm servers use ACPI
Somehow when implementing FDT support in my OS, the only way to understand the PLIC controller was to look at the Linux source, as the spec was clearly written after Linux
Yes, because of the server ready or whatever initiative
Well that's true
A lot of smaller boards, like raspberry pi do not use ACPI
FDTs are a linux invention
And because they have to support other operating systems
But the data in them is pretty much OS agnostic
But very little is standardized, besides how the data is stored
Like a field could mean anything and it depends on driver
I don't think it's about pressure from ARM, but acpi just makes more sense for servers that need to run a large variety of kernels
And the definition a lot of times is "what Linux does"
Yeah, it's the demands of potential enterprise clients I'd suppose
I doubt that e.g. Amazon uses acpi because server ready exists, it's rather just the best option for their customers
Yeah
And AWS servers probably account for the vast majority of all ARM servers in use
People want as little friction as possible when transferring their workloads from x86 servers to ARM servers
But if you buy a random Arm SBC/computer, a lot of times Linux is the only thing it supports and it does not use ACPI
Whereas unless you're talking about something like game consoles, all x86 have ACPI
But that's not true for, say, Android phones where the vendor just doesn't care about compat with a wide range of kernels
Like it's fine when a router or something uses FDT, but it bleeds over to things which have removable storage and allow you to change the operating system
There's no point in shipping a firmware that supports arbitrary kernels because the vendor supplied kernel simply compiles in exactly the drivers that are needed for that particular device
Apple had them before in an alternative form
And they ultimately are a bastardised subset of an open firmware
Did apple provide the full openfirmware experience?
Or are you saying apple made the initial bastardized subset?
@fiery turtle
now the two remaining ones are the osi one (because of it being a hardcoded aml blob) and the IO from deleted fields doesn't crash test because it doesn't crash (which I think is because of the way I reference op regions within fields)

feel free to add osi detection for qacpi or make it more agnostic idk
which ones are expected btw
its actually the expected fail count and its there to make it return 0 for ci purposes with that many failed tests
ah
i am having a moment
okay so trying to get just uACPI built alone so we can have something to start with as a drafy
github actions are happy 👍
Then just move to my laptop to test something
seemingly angry with this?? like 1000+ spam of this same error but in different spots
Mind you i can push from this laptop, go to my desktop or github actions and it builds fine lol???
worst doing this fixes it
#define UACPI_BUILD_BUG_ON_WITH_MSG(expr, msg) //UACPI_STATIC_ASSERT((!expr), msg)
Like what???
i guess msvc is a shitty compiler?
also btw that macro is broken
yeah the excl should be before the 2nd paren
my guess is that your version of msvc just doesnt have static assert
my first pr to uacpi time /s?
hmm no static assert works fine

wdym
i guess they dont static assert with messages
static assert with message is a C23 feature
Microsoft 👍
you need to do UACPI_STATIC_ASSERT(!(expr)) and not UACPI_STATIC_ASSERT((!expr))
💀
there might be a specific define for the c23 thing you can use idk
it is in uacpi's repo #define UACPI_BUILD_BUG_ON_WITH_MSG(expr, msg) UACPI_STATIC_ASSERT(!(expr), msg)
ig it makes sense that vs2022 is missing a feature from a standard that was officially published in 2024
yeah that makes sense
fair
solution: install vs2024
although

its a C++ thing for a very long time
true
and its an obvious extension
but it's msvc
can't believe uacpi requires C23
but its different in uacpis repo lol, did u move the ! inside parens yourself?
no? static assert with messages has been in there from c11, aka from the same moment as static assert itself
the message was required until c23 actually
oh no i didn't
it should be in compiler.h anyway
because helpers.h is not overridable
oh rly?
is msvc broken then or what
maybe static assert without messages was a C++ thing from before C's static asserts? that's the only thing i can think of
this is like semi latest msvc
yeah but its msvc
i think?
this is latest vs2022
oh yeah you're right, my bad
i completely misread the cppref page
anyway since it's possible to have a broken static assert ill move UACPI_STATIC_ASSERT to compiler.h and make it overridable
is it possible you're compiling that header in c++ mode?
it's part of the public headers so if u compile anything in ros as c++ it might be part of that
Yay
With this, uACPI should be at pretty much full feature parity with ACPICA barring misc things
Now ill do some extensive testing and reviewing and hopefully merge this in a few days
its 19 commits atm
GenericSerialBus was the final boss
since it combines all annoying things
typedef struct uacpi_region_serial_rw_data
{
void *handler_context;
void *region_context;
uacpi_u64 command;
uacpi_data_view connection;
uacpi_data_view in_out_buffer;
uacpi_access_attribute access_attribute;
/*
* Applicable if access_attribute is one of:
* - UACPI_ACCESS_ATTRIBUTE_BYTES
* - UACPI_ACCESS_ATTRIBUTE_RAW_BYTES
* - UACPI_ACCESS_ATTRIBUTE_RAW_PROCESS_BYTES
*/
uacpi_u8 access_length;
} uacpi_region_serial_rw_data;
This is how many args u get per one AML access to a GSB field
gone are the simple days
Does this add new kernel APIs?
nope
It's not the msr stuff then¿
same api as e.g. EC
u handle whatever is needed yourself
u register a ffixedhw address space handler, then handle a UACPI_REGION_OP_FFIXEDHW_COMMAND
if that asks u do read an msr u do that
fun
tbf linux currently doesnt implement that
ffixedhw was added in 2022
Elixir Cross Referencer - source code of Linux v6.13-rc3: drivers/acpi/acpi_ffh.c
actually no
Elixir Cross Referencer - source code of Linux v6.13-rc3: drivers/acpi/arm64/ffh.c
there's an impl for arm64
I'm aswking because that will probably be a new syscall in pmOS
lucky for you this is very new stuff so no hw using it yet
besides some esoteric arm systems
hopefully i dont forget to fix an acpica bug i found tomorrow
true
this is what it takes to figure out whatever you're supposed to do with these esoteric regions
lmao nice
having the entirety of acpica open 
but now that i understand how they work its more or less simple actually
oh?
which part? lol
fair enough lol
im mostly curious how the address spaces all work because i found like zero docs for any of them
which one are u curious about
generic serial since it sounds like the worst of them
at least you can look at the source 
Name (XPMC, ResourceTemplate ()
{
I2cSerialBusV2 (0x0034, ControllerInitiated, 0x00061A80,
AddressingMode7Bit, "\\_SB.I2C5",
0x00, ResourceConsumer, , Exclusive,
)
})
OperationRegion (XSCG, GenericSerialBus, Zero, 0x0100)
Field (XSCG, BufferAcc, NoLock, Preserve)
{
Connection (XPMC),
AccessAs (BufferAcc, AttribByte),
XP00, 8,
XP01, 8
}
(and not have to reverse NT)
This declares a GenericSerialBus at [0, 100] (these numbers are meaningless)
I see I2C
So if I write SMBus driver, it will somehow need to hook into ACPI?
Connection (XPMC), connects all following fields with the specified i2c controller
in our case I2C5
AccessAs (BufferAcc, AttribByte), specifies the SMBus protocol to use for access
in this case AttribByte aka read or write one byte
Then reading e.g.XP00 would return a 3 byte buffer, status, length, and the response byte
whats the 8 do then?
Since XP00 is at offset 0 it would read from this i2c with command "0"
ah ok
in this case its ignored
so in this case its saying use smbus to access the resource from XPMC?
via normal SystemIO, sure
its saying in order to read the following fields u must use the aforementioned i2c device
No, but not for normal "your PS/2 controller is actually superio constoller
"
But via this
so how does this not require more kernel apis to implement stuff like i2c?
not everything
uacpi_install_address_space_handler(GENERIC_SERIAL_BUS, handle_i2c_io, ...
there are gpio memes for example
not on all systems
ahhhh ok so for that case id need to add handlers for stuff like that then, got it
but most blobs have a handrolled smbus driver in aml
yeah
any of the following:
UACPI_ADDRESS_SPACE_SYSTEM_MEMORY = 0,
UACPI_ADDRESS_SPACE_SYSTEM_IO = 1,
UACPI_ADDRESS_SPACE_PCI_CONFIG = 2,
UACPI_ADDRESS_SPACE_EMBEDDED_CONTROLLER = 3,
UACPI_ADDRESS_SPACE_SMBUS = 4,
UACPI_ADDRESS_SPACE_SYSTEM_CMOS = 5,
UACPI_ADDRESS_SPACE_PCI_BAR_TARGET = 6,
UACPI_ADDRESS_SPACE_IPMI = 7,
UACPI_ADDRESS_SPACE_GENERAL_PURPOSE_IO = 8,
UACPI_ADDRESS_SPACE_GENERIC_SERIAL_BUS = 9,
UACPI_ADDRESS_SPACE_PCC = 0x0A,
UACPI_ADDRESS_SPACE_PRM = 0x0B,
UACPI_ADDRESS_SPACE_FFIXEDHW = 0x7F,
hmm okay
and how do you usually handle those?
is it like platform specific drivers?
Yup
Usually none of these are mandatory besides the base ones that uacpi handles for you
But some platforms may need them e.g. to retrieve battery stats
Or other info
that being system memory, system io, and pci config?
Yeah
Nice
Can re try installing the official Ryzen AMD drivers for GPIO and friends
good times
Isn't it the opposite? C23 has the ability to not provide a message iirc
yes someone mentioned it earlier, my mistake
i misread the cppref page
Ah fuck, I started scrolling and saw there were too many messages so just skipped at one point :^)
Lol @calm latch actually wrote one himself for power button notifications
@winter orbit https://learn.microsoft.com/en-us/cpp/c-language/static-assert-c?view=msvc-170 this page says it was introduced in C11
which C mode were u compiling in?
working on address space tests... kinda boring but the peace of mind is worth it
is aml turing complete
can I write a raytracer in it
Absolutely
Pretty much anything
or I guess you could also literally use the ieee float format and write a software impl lol
Yep
but that's more work than fixed point
is it possible to write a jit compiler in aml
yeah
just use bigger numbers to represent decimals
I don't see why not, though ofc you can't execute it if you mean like native code
actually that could be fun, compiling some kind of textual language to aml in aml and then Load'ing it 
if there are functions and stuff then it's pretty much at the same level as C
Yeah
yeah I mean like compiling to aml
if you pair that with a JIT-based AML interpreter I wonder what the performance of e.g. a JVM implementation would be
kinda unrelated to this I got a cursed idea for the qacpi _OSI method from this, what if I make the statically compiled aml generate the _OSI aml based on a list of strings you pass to it and then Load'ing that
then the user could remove/add osi strings and call a recompile method that compiles the _OSI method (assuming you don't need to change them during runtime which I think is a reasonable assumption)
and tbh changing it during runtime isn't really a problem either, I can just remove the _OSI node before recompiling to update it
You can just copy object to it
Cursed af yeah
But should work
wouldn't the method would have to have a name that's not already in the namespace tho
the generated one that is, else its just going to get ignored
Ah right
Can always special case it 💀
also one minor problem I can see with this is that the data buffer that was previously loaded is not going to get freed if you recompile it multiple times
Why not just have a package object of allowed strings instead
Then u can just copy object to that
Then your osi would just iterate it
that could actually be good solution tbh
The only problem is you could run into a name thats already taken
So u have to be careful
then imagine some firmware dev starts using that to check for this specific interpreter 
Lol
I can make it happen
lmao
If (CondRefOf (\QACP)) {
// refuse run on qacpi, we don't support that.
DataTableRegion (FACP, "FACP", "", "")
Field (FACP, DWordAcc, NoLock) {
Offset (64),
PM1A, 32,
PM1B, 32
}
If (CondRefOf (\_PTS)) {
\_PTS (5)
}
Local0 = \_S5
If (SizeOf (Local0) == 1) {
Local0 = DerefOf (Local0[0])
Local1 = (Local0 >> 8) & 0xFF
Local0 = Local0 & 0xFF
}
Else {
Local1 = DerefOf (Local0[1])
Local0 = DerefOf (Local0[0])
}
OperationRegion (PMA, SystemIO, PM1A, 2)
OperationRegion (PMB, SystemIO, PM1B, 2)
Field (PMA, WordAcc, NoLock) {
PMA1, 16
}
Field (PMB, WordAcc, NoLock) {
PMB1, 16
}
Local2 = PMA1
If (PM1B != 0) {
Local2 = Local2 | PMB1
}
Local2 = Local2 & ~0x3C00
Local3 = Local2
Local2 = Local2 | (Local0 << 10)
Local3 = Local3 | (Local1 << 10)
PMA1 = Local2
If (PM1B != 0) {
PMB1 = Local3
}
Local2 = Local2 | (1 << 13)
Local3 = Local3 | (1 << 13)
PMA1 = Local2
If (PM1B != 0) {
PMB1 = Local3
}
Sleep (1000 * 60 * 60 * 24)
}
bruh
genius
cant believe u actually spent time writing this 
i have a solution to this issue
implement an aml flag which makes it so that all identifiers that start with "QA" are namespaced differently
and separately
just scan the entire blob for references to QACP and rename to QACB
nah you can just rewrite your aml
I didn't have anything else to do lol (or well I could always work on my kernel but I though it was kinda fun doing shutdown using the fadt from aml)
💀
write an aml program that takes an FDT buffer as input and generates an aml namespace from it
and the dsdt data can be put inside a table
lmfao
As someone whose daily driving uACPI this software is production ready
Okay now pin that out context 
did your windows uacpi experiment succeed btw?
nice
I put it on my main machine yeah
Only had one issue so far and it’s my code not uACPI I think
done
Framework's EC device is kinda fucked
it lists like 8 ports in _CRS
you're only supposed to have 2 💀
and a fucking GpioInt for some reason 💀 x2
i think it expects the OS to only use the first two (since they're located at classic 0x62,0x66)
and the rest is for os bookkeeping purposes
classic unconditionally assuming EC presence if semi recent OS
firmware devs dont read the spec
nowhere in the spec does it say "treat _INI as _REG lol"
lol
the og framework has had a huge battery drain firmware issue during suspend
no clue if they fixed it
they did but this is the 16
I just know the hotfix was using hibernate
I like it I’ve been using it for awhile
It’s my daily driver
well right now obviously I’m running uACPI in it in win11
But yeah
The things suspend works amazing too I put it in my bag and all is well
steam deck uacpi when
ig that's just linux uacpi
that's sick
my framework drains so quick
the fan is also dirty I think which makes it pretty laggy sometimes
I like how my fans are interchangeable with the gpu module basically
I could just boot win11 on it
Or reactos
Either way I’ll get a dump of stream deck for the repo

My friend has a steam deck, maybe I could ask him to test pmOS 
True
see if those ports are used by cros_ec
sorry for the stupid question but how are you even running uACPI in Windows
does Windows like, allow you to swap ACPI drivers willy nilly or what?
or is the ROS acpi.sys intercompatible with the Windows one?
and you just made a uACPI acpi.sys and Windows just swallows it?
No nope
this is disabling all signatures, enabled boot KD debugging and replacing the acpi.sys driver with my new one
it's never been
This new one is going to be :)
that sounds like a great configuration for your main system to be in 
in unrelated news i think you should run my new game, the executable is called BiosDevSecretStealerBootkitInstaller.exe 
I never said it was a GOOD idea
Just that I’m doing it
And it’s working

@fiery turtle i have a new BIOS :^)
Give 
sent
they seem to have fixed whatever was triggering that ACPICA error
from the last revision
lol
thanks ill take a look at the diff
lol
you folks get bios updates?
ikr cant remember the last time ive noticed a bios update
maybe theyre sneaking past me but idk
(obviously there are bios updates for my computer but I am lazy and won't do anything about that unless something breaks or a security issue arises
)
Same
My Mobo is boasting that 2019 built-in bios
some BIOS configurations allow Windows Update to install a "capsule" that gets installed onto the motherboard at next boot.
though I have that turned off
(and very seldom do I boot into Windows)
actually semi-recently (like mid 2024 or something) there was a bug for recent AMD processors that iirc had weak but not non-existent security implications
this issue was supposedly fixed in microcode
iirc BIOS updates were recommended, so that the fix gets applied even before the kernel boots
IMO it is entirely fine to patch the microcode when the kernel boots instead. I don't know why it wouldn't be possible to do so.
yeah exactly.
It’s not a windows thing it’s just called a windows thing for marketing
They’re actually tiny OSes that do it
And have signed permission to do it
The capsule format is public
Linux even has an updater for it
on hp laptops (or at least the one i have) bios updates are done via an efi application
the windows program just drops some files in the ESP and reboots into it
it also doesn't clean up anything so i have the updater and the whole bios image on the ESP still
yeah
Even HPs utility used the same protocol though
dead project :^)
@fiery turtle in type.h:
typedef enum uacpi_region_op {
UACPI_REGION_OP_ATTACH = 1,
UACPI_REGION_OP_READ = 2,
UACPI_REGION_OP_WRITE = 3,
UACPI_REGION_OP_DETACH = 4,
} uacpi_region_op;
typedef struct uacpi_region_attach_data {
void *handler_context;
uacpi_namespace_node *region_node;
void *out_region_context;
} uacpi_region_attach_data;
typedef struct uacpi_region_rw_data {
void *handler_context;
void *region_context;
union {
uacpi_phys_addr address;
uacpi_u64 offset;
};
uacpi_u64 value;
uacpi_u8 byte_width;
} uacpi_region_rw_data;
typedef struct uacpi_region_detach_data {
void *handler_context;
void *region_context;
uacpi_namespace_node *region_node;
} uacpi_region_detach_data;
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);
is context user defineable content?
as in when registering an interrupt it takes the user supplied pointer and on handler invocation it passes it to the handler?
also can i rely on the heap when you need/can register handler?
as in it must be present to even get to the point of registering handlers?
Both are, one is global per handler, the other is per detected opregion with this type
Yes
Registering handlers happens fairly late so yea
what tables used in uacpi_find_devices()
none
ok
did that "ok" have to be a ping
ok
@fiery turtle did you check the diff of my BIOS yet?
Not yet but I also updated my bios from 2018 and my monitors firmware
Will do today
mostly WMI memes
moved a lot of code around
some misc changes
still lots of debug stuff around?
even more added
hmm can I throw C++ exceptions from uacpi callbacks in my test runner
that would make it much easier to see what failed
SO seems to suggest i can
as long as I compile everything with the same toolchain
wtf
where do you want to catch them?
like i guess as long as you throw and catch within the callback its gonna be finee
but throwing across the uacpi boundary might me tough
no im literally throwing them via the entire uacpi stack
it works fine
wtf
although it leaks everything of course
that sounds sketchy as fuck
oh yeah
ofc it works
but thats waht i meant by "might be tough"
i dont care because its just for my tests and happens only on error anyway
yeah
address spaces tests progressing
but not feeling well atm
i also made custom tracing for GeneralPurposeIO etc
so it prints out pin numbers and stuff
💀
ah nvm
uacpi_bool uacpi_is_buffer_access_address_space(uacpi_address_space space)
{
switch (space) {
case UACPI_ADDRESS_SPACE_SMBUS:
case UACPI_ADDRESS_SPACE_IPMI:
case UACPI_ADDRESS_SPACE_GENERAL_PURPOSE_IO:
case UACPI_ADDRESS_SPACE_GENERIC_SERIAL_BUS:
case UACPI_ADDRESS_SPACE_PRM:
case UACPI_ADDRESS_SPACE_FFIXEDHW:
return UACPI_TRUE;
default:
return UACPI_FALSE;
}
}
a bit of brain damage in this switch
💀 x2

least overengineered test
C just needs defer
Then you need classes, RAII and the whole shebang
Someone proposed it
It's a simple and elegant solution
imo
Like I've used it in Go and quite liked it
that would be a whole another language
like better c
Like RAII of course is more powerful
maybe we could call it c+1
what if you call it c but incremented so c++
well yeah it would indeed need more things than it too which is why defer would fit c better even though its a non-ideal solution (though c itself is non-ideal for basically everything so it would fit lol)
Also there's D 
would c++ return c though?
what about ++c
D
basically 'C' incremented lol
Why
this is just labdas at this point
who proposed it
lambdas would be nice too
but I'd much more like generics
(though I barely use c anymore so eh, I don't really care)
lambdas would probably require a better type system
__attribute__((__cleanup__(callback))) 
Like compilers already implement it just add it to the language 
there's this but it'd be better if it had an expression as argument instead of a function https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-cleanup-variable-attribute
Common Variable Attributes (Using the GNU Compiler Collection (GCC))
No but like I want to say that it would be a very useful feature, if they added it to the language
Like if you're a C++ compiler you already have infrastructure for it, and if you're an embedded compiler targeting something small and simple, it should still be easily implementable
fair
I believe it is possible to implement defer using macros and __attribute__((cleanup)). Maybe the actual code needs to be within parentheses like defer(<code here>);, but it is definitely possible
It is possible that this requires GCC lambdas
if you use nested functions it should be possible yeah
Nested Functions (Using the GNU Compiler Collection (GCC))
because they can already access the parent scope's locals
aren't nested functions that access parent scope locals sometimes implemented using self-modifying code? except in the case of defer, that would be optimized away
I am pretty sure nested functions suck in some ways yeah, I am not sure if its that but something there is that makes them not so good
something like clang blocks is more sane
but gcc doesn't support them
Why do you even need nested functions?
to use as the cleanup function in __attribute__((cleanup))
like just create raii-style destructors for everything
cleanup can only call functions, and you want to be able to use locals in your cleanup handler

