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

1 messages · Page 31 of 1

winter orbit
#

Bootmgr has an error code for ACPI failure

#

That can be cause by well it’s initialization failing

#

Go figure

fiery turtle
#

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

winter orbit
#

If you did that I’d probably replace what we’re doing in Hal with it too

fiery turtle
#

nice

winter orbit
#

User mode uACPI would be cool

fiery turtle
#

well that exists already meme

winter orbit
#

I wanted to design a micro kernel but ROS kinda took over life

fiery turtle
#

e.g. pmos runs it in userspace

fiery turtle
winter orbit
#

Well there’s no main stream desktop os that uses that design for a reason

loud ice
#

lol

#

yeah

fiery turtle
#

yeah

#

theres no main stream microkernel os period

#

other than niche stuff

#

(switch etc)

loud ice
#

the switch kernel is the most general purpose it gets i think

fiery turtle
#

yeah turns out 10 ipc calls per disk read request is not that great

winter orbit
#

psh

#

it’s fineeeee

loud ice
#

you only need one

#

or two

#

if you are extremely careful about implementation

fiery turtle
#

u have to have insanely clean design to allow one

#

two is more realistic

loud ice
#

to allow one you need to bake disk drivers with filesystem drivers

winter orbit
#

I’m more likely to complete this terrible thing then ever make a micro kernel now

loud ice
#

or mess around with ebpf or something like that

fiery turtle
#

or have some sort of transparent handle that can dispatch directly to the nvme server

loud ice
#

damn

winter orbit
#

no

#

I made one

loud ice
#

ah

winter orbit
#

no not Linux subsystem

#

A NT style posix subsystem

loud ice
#

posix subsystem

#

it was a thing in nt a loooong time ago

winter orbit
#

Binaries are PE,
It’s an NT personality that’s posix 1.1 compliant

loud ice
#

before the NT people got mad at the open group for being annoying

#

and didnt implement the rest of posix

winter orbit
#

I’m not gonna implement the rest of posix either /s

fiery turtle
#

whats more annoying is they expose some posix api but with underscores for some reason

winter orbit
#

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

loud ice
#

wtf

#

thats based though

winter orbit
#

Only ever ran xeyes

#

but I could port most Linux console apps

loud ice
#

still incredibly based

fiery turtle
#

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

winter orbit
#

nah windows has a native fork

#

It’s just hidden

fiery turtle
#

they made one for wsl1 or something?

winter orbit
#

no they made it for the original posix subsystem

fiery turtle
#

how well does it work

winter orbit
#

decent

Reactos’s terrible

fiery turtle
#

lmfao

winter orbit
#

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

fiery turtle
#

embrace extinguish.. whatever

winter orbit
#

Reactos is more likely to implement a WSL replacement

calm latch
#

I init uACPI very late in pmOS
Like it's running in userspace so the kernel is fully inited

fiery turtle
#

i mean the way wsl2 is implemented is the most optimal way to do it

#

just a vm

winter orbit
#

Pretty much

fiery turtle
#

hyper-v for ros when?

winter orbit
#

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

fiery turtle
#

the only downside of wsl2 is it uses virtio-fs which is slow as shit

winter orbit
#

So our mobile OS can take over the world

fiery turtle
#

yeah phones with acpi and uefi would be nice

#

instead of proprietary crap linux loader

winter orbit
#

They exist now

calm latch
fiery turtle
#

i know but barely

winter orbit
#

Also I had a design for a DT.sys

#

and a Linux boot stub to start NT

#

Chaos

calm latch
fiery turtle
winter orbit
#

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

fiery turtle
#

one thing u can respect ms for is them pushing actual standards

#

instead of insanity we have now

winter orbit
#

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

fiery turtle
#

lol

#

yeah

winter orbit
#

Now I’m just running official one like a sane person

#

Well

More sane

fiery turtle
#

indeed

calm latch
#

uDRM wanted to have an Nvidia driver (?)

fiery turtle
#

if marvin doesnt lose motivation

winter orbit
#

I think reversing nvidia graphics will be easier with the WDDM stuff I’m doing so maybe that’ll be possible one day

fiery turtle
#

also just found a new ACPICA bug

#

should probably fix it

#

they forgor an if statement

calm latch
#

I wanted to look at AMD GPUs, but I have no idea how GPUs work at all so idk

fiery turtle
#

amd gpus are pretty well documented

winter orbit
#

And Intel.

I started with messing with Intel HD graphics

calm latch
#

The interesting parts are proprietary

fiery turtle
winter orbit
#

no I didn’t show me

fiery turtle
#

this is full 3d pipeline igpu triangle

winter orbit
#

That’s most of the way there to be honest

fiery turtle
#

i dumped the shaders from mesa and stuff

winter orbit
#

Super cool

fiery turtle
#

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

winter orbit
#

What OS is this on?

#

Or just like directly snapped on blob

fiery turtle
#

its just a bare kernel with literally a main and nothing else

winter orbit
#

did you post it anywhere?

fiery turtle
#

to leos dms meme

#

i have it available

#

its a mess

#

i can upload to pastebin if u want

winter orbit
#

I’m curious for sure

#

I need to find my first projects with it

#

I promise it’s more of a mess

fiery turtle
winter orbit
#

Still less code than a Vulkan triangle

fiery turtle
#

the most interesting thing is build_command_buffer

#

and ig render_ring_build

fiery turtle
winter orbit
#

That’s super neat

#

Is this 4th gen?

#

Like hd4000

fiery turtle
#

somewhere around that

#

actually no

#

its ironlake aka gen5

winter orbit
#

Ohh

fiery turtle
#

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

winter orbit
#

I really need to get back to this too but :

calm latch
winter orbit
#

This is a DX 10 surface functioning on a Mali g610

#

In arm64 windows 11

fiery turtle
fiery turtle
winter orbit
#

Yup

fiery turtle
#

damn

#

how did u reverse it?

winter orbit
#

I didn’t really have to

Pan frost/panthor did a lot of
The reversing work

fiery turtle
#

ah

winter orbit
#

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

fiery turtle
#

although its private now lol

#

until its anything interesting

winter orbit
#

LHobbies OSdev projects can’t have gpu drivers”

Lies trl

fiery turtle
#

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

winter orbit
#

Poor haiku

fiery turtle
#

without distractions

#

even though i did want to work on other stuff

winter orbit
#

you’ve almost got a completely usable product too

fiery turtle
#

basically yeah

#

at this point i can vouch for its stability

#

its been tested on so much hw thanks to this server

fiery turtle
winter orbit
#

That was a proposed plan

fiery turtle
#

L

winter orbit
#

is haiku considered hobbiest

#

I think so

fiery turtle
#

nah ofc not

#

since it has paid developers no?

winter orbit
#

what

#

it has contracts

#

Okay well if that is the line then ROS isn’t hobbiest either

fiery turtle
#

yeah

#

i dont think ros is a hobby os lol

#

maybe our definitions of hobby are different

winter orbit
#

It’s hard for me to consider it one when it’s rapidly getting more attention and funding

fiery turtle
#

ROS?

winter orbit
#

and haiku

#

Both of them

fiery turtle
#

haiku is getting more attention?

#

thats a new one for me

winter orbit
#

Both ROS and haiku are getting exponentiall more people using it

fiery turtle
#

Why is that btw?

#

ROS i understand since its doing cool things

winter orbit
#

Haiku is pretty solid these days

#

Firefox with discord

#

And some usb audio

#

And I use it in my framework 13

fiery turtle
#

ig

#

i just dont find it super interesting because i know nothing about beos

winter orbit
#

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

fiery turtle
#

MJD reactos videos 💀

winter orbit
#

hey his last one he talked with me a ton first

#

In his defense

fiery turtle
#

yeah good thing u contacted him

winter orbit
#

He spent nearly 36 hours with me

wind fiber
#

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!)

winter orbit
#

okay ROS isn’t hobby then and should get its shit together

wind fiber
fiery turtle
winter orbit
#

“Fast”

wind fiber
#

That puts me in a predicament tho, I’d love to be paid by Managarm GmbH but then it’s no longer hobby death

winter orbit
#

Slowtexes

fiery turtle
#

monkuous would vomit if you tell them your ops/s

winter orbit
#

It’s pretty funny

fiery turtle
winter orbit
#

tbh though I think more OSes paying for devs is cool

#

The top few have dominated too long

fiery turtle
#

its not like a bad thing to not be a hobby os lol

#

its the opposite

winter orbit
#

For sure

wind fiber
#

Oh I agree

#

The distinction is only useful for comparison work imho

fiery turtle
#

Any C++ experts? Is this necessary to get a zeroed buffer?

calm latch
fiery turtle
#

looking at this otherwise, the object is zero-initialized.

#

so i guess not?

calm latch
#

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;
fiery turtle
calm latch
#

POD -> plain old data, e.g. int

fiery turtle
#

yeah i know what a pod is

#

i spent like 3 years writing c++

calm latch
fiery turtle
#

back when SFINAE was cool

fiery turtle
calm latch
#

Why is it not cool now? ultrameme

fiery turtle
#

concepts

calm latch
#

Tbh I've spent 4 years so idk if I'm much of expert

fiery turtle
#

depends on what u did

#

i wrote like heavily templated shit all the time

fiery turtle
#

I wonder what the fuck they meant by this

calm latch
#

Like ACPI being able to read and write MSRs?

fiery turtle
#

yeah i found some intel docs

calm latch
#

I'll implement that in pmOS

#

Are there other operating systems, using uACPI and working on RISC-V?

fiery turtle
#

keyronex

#

although idk the state of keyronex-on-riscv

calm latch
#

My implementation is (should be) on par with x86

#

The only issue is that I don't have any physical hardware

fiery turtle
#

physical riscv hw is mostly trash

calm latch
#

But QEMU is boring

#

trash is fun sometimes

winter orbit
#

does your riscv build boot on uboot

fiery turtle
#

well theres riscv framework i think?

calm latch
#

uboot and ovmf

fiery turtle
#

idk if it does acpi

calm latch
#

through UEFI

#

But uboot doesn't (didn't last time I checked) give you ACPI

winter orbit
#

I don’t think there’s a full edk2 port for this yet

calm latch
#

?

winter orbit
calm latch
#

It works ok on QEMU

winter orbit
#

Is what I have on my desk

calm latch
calm latch
winter orbit
#

It has working GPU in Linux though with AMD GPUs

calm latch
#

I haven never ran it on physical hardware

winter orbit
#

Yeah I want more things to try

#

Would be cool if it had an edk2 port though… let me see

calm latch
#

efi uboot was working in qemu

winter orbit
#

EFI uboot works on this I think

#

I haven’t gotten haiku to boot

#

Only ROS bootloader

calm latch
#

Oh cool it's not that expensive

winter orbit
#

No it’s a great board too

calm latch
#

There was another board with Spacemit M1 though

#

But it says it's sold out everywhere

#

Do you have uart?

slim panther
calm latch
slim panther
winter orbit
#

And it has UART

calm latch
#

The kernel logs to it

winter orbit
#

Let’s see what chaos we can unleash

#

Gimme a moment

calm latch
#

I'm using limine

fiery turtle
slim panther
#

why should it

fiery turtle
#

windows

calm latch
#

Wait a sec I need to recompile everything

hasty plinth
slim panther
#

there is no windows

winter orbit
#

Well

calm latch
fiery turtle
#

hence the L

winter orbit
#

There is windows

slim panther
#

these are basically exclusively embedded cpus

calm latch
#

Which got archived

slim panther
hasty plinth
#

Ah lol, I remember that spec

winter orbit
#

Sorry to burst your bubble

#

It’s just not public

fiery turtle
#

unarchive the spec and mandate acpi for all riscv chips 😡

#

otherwise the impl is considered invalid

slim panther
fiery turtle
#

NDA

slim panther
#

they should have something like systemsready

#

something that mandates uefi

#

fuck device tree fw config

winter orbit
calm latch
winter orbit
#

I don’t think risc-v has a future if it keeps heading down the path it is

slim panther
#

yea

#

i would love for it to succeed but wtf are they doing

calm latch
#

MIPS routers are still being made

slim panther
#

they're fucking up everything

fiery turtle
#

did u see the format they wanted to use for the cpuid thing

slim panther
#

💀 yea

fiery turtle
#

idk which ass they pulled that out of

slim panther
#

asn.1

hasty plinth
slim panther
#

that's even more stupid

hasty plinth
#

I.e totally useless

#

Because firmware already knows that info

slim panther
#

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

loud ice
#

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)

slim panther
#

especially not even the fucking supervisor has access to that info

winter orbit
#

RIP risc-v

#

Then

slim panther
#

how the hell is it supposed to know that

hasty plinth
#

Well they did (misa), except that's m mode only and only supports ~20 extensions

slim panther
#

the dtb doesn't count

loud ice
#

thats basically complete

#

right?

hasty plinth
#

Yeah but how do you get the dtb

loud ice
#

that is definitely how you do good device discovery

hasty plinth
#

Its unspecified

loud ice
slim panther
loud ice
#

im not saying its a good solution btw

hasty plinth
#

Show me the spec meme

#

SBI is optional

loud ice
slim panther
#

the kernel expects

#

that's not a risc-v spec

hasty plinth
#

Lmao

loud ice
#

its not

#

it is however

#

the spec

hasty plinth
#

I guess that's as good as we get

loud ice
#

the only one, as far as i know

#

lmao

#

it also is a spec

slim panther
#

i fucking hate that so much risc-v stuff is 100% linux-centric

loud ice
#

it specifies the requirements from the kernel on the firmware

slim panther
#

like

#

what a fucking good idea to focus everything around a single kernel

loud ice
#

uefi specifies this shit too in a way that is 10 times more convoluted btw

slim panther
#

i'd rather have a uefi spec than linux

loud ice
#

tbh the linux boot proto on arm and riscv is like

#

actually not that bad

#

its a couple registers

slim panther
#

multiboot3

loud ice
#

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 meme

hasty plinth
#

Seems portable enough meme

loud ice
#

portable
riscv

#

lmfao

hasty plinth
#

Lol

loud ice
#

theres a lot of stuff under /proc/device-tree that is super useful too!

#

like /proc/device-tree/model

slim panther
#

i hate device trees

calm latch
loud ice
slim panther
#

i don't want to use them

loud ice
#

or all of them

calm latch
slim panther
#

OF dts

loud ice
#

acpi is also a device tree

loud ice
#

OF dts have AML except more sane

slim panther
#

i have uacpi for that

loud ice
#

and are native endian too

loud ice
#

god i hate acpi names so much

slim panther
loud ice
#

i never specified the platform endianness

slim panther
#

what does that mean

winter orbit
slim panther
#

fdts are always big endian

#

smh

loud ice
#

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

slim panther
#

those are big-endian

fiery turtle
fiery turtle
#

well

loud ice
#

and yes

#

and they are rather stupid in that way

#

but its also kinda not that big of an issue

fiery turtle
#

idk why they did such stupid pnp id names

#

technically _HID can store any arbitrary string

loud ice
#

wait is there constraint

#

what the fuck

fiery turtle
#

which some devices do

loud ice
#

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

fiery turtle
#

small pnp ids can be encoded in a dword

loud ice
loud ice
fiery turtle
#

maybe thats why they did it this way

loud ice
#

none of this is a concern

fiery turtle
#

Theres an EisaId macro in iasl

#

to do that

loud ice
#

memory is literally free

#

or close enough

fiery turtle
#

yes

loud ice
#

this is like 20 bytes of overhead

#

max

#

this is why i dont like acpi

#

not that FDTs are better

fiery turtle
#

if _HID was just normal names it would be way better i agree

loud ice
#

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

fiery turtle
#

basically yeah

loud ice
fiery turtle
#

if fdts had some sort of a sane bytecode to do the bare minimum platform config and stuff

loud ice
#

yeah

fiery turtle
#

but they dont care because linux is the only kernel

#

and it has every driver

loud ice
#

honestly that is not a bad approach

fiery turtle
#

i kinda hate it

loud ice
#

linux is the only (important) kernel

#

i know it sucks for everyone except linux

fiery turtle
#

ms is better than linux because they dont consider themselves the only os

loud ice
#

but uh

loud ice
fiery turtle
#

fault of whoever implemented that crap meme

loud ice
#

yeah

#

oh right its the firmware people

#

which did not care about other people existing

fiery turtle
#

i see a pattern

calm latch
#

risc-v needs microsoft

vast kestrel
#

riscv needs Jesus

flat badge
#

FDTs are useful for small socs where you want to run a customized kernel on

#

No bytecode is a feature in this regard

calm latch
#

The issue with that is that it's very Linux specific

flat badge
#

How are they Linux specific?

vast kestrel
#

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

calm latch
#

And when the "small" Arm/RISC-V SoCs appear in PC class computers or servers

flat badge
#

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

calm latch
# flat badge How are they Linux specific?

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

calm latch
flat badge
#

Well that's true

calm latch
#

A lot of smaller boards, like raspberry pi do not use ACPI

flat badge
#

FDTs are a linux invention

calm latch
flat badge
#

But the data in them is pretty much OS agnostic

calm latch
#

But very little is standardized, besides how the data is stored

#

Like a field could mean anything and it depends on driver

flat badge
calm latch
#

And the definition a lot of times is "what Linux does"

calm latch
flat badge
#

I doubt that e.g. Amazon uses acpi because server ready exists, it's rather just the best option for their customers

calm latch
#

Yeah

flat badge
#

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

calm latch
#

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

calm latch
flat badge
#

But that's not true for, say, Android phones where the vendor just doesn't care about compat with a wide range of kernels

calm latch
#

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

flat badge
#

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

jaunty fox
#

And they ultimately are a bastardised subset of an open firmware

deft canopy
#

Or are you saying apple made the initial bastardized subset?

mortal yoke
#

@fiery turtle letsgo 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)

fiery turtle
#

feel free to add osi detection for qacpi or make it more agnostic idk

mortal yoke
winter orbit
#

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???

loud ice
#

i guess msvc is a shitty compiler?

gentle peak
#

yeah the excl should be before the 2nd paren

loud ice
#

my guess is that your version of msvc just doesnt have static assert

winter orbit
#

oh this is just in uacpi repo

#

this is vs2022

#

so id assume it would

loud ice
#

lol

#

the msvc people are the firmware devs of the compiler world

winter orbit
#

hmm no static assert works fine

fiery turtle
hollow elm
#

i guess they dont static assert with messages

#

static assert with message is a C23 feature

winter orbit
#

Microsoft 👍

loud ice
#

you need to do UACPI_STATIC_ASSERT(!(expr)) and not UACPI_STATIC_ASSERT((!expr))

fiery turtle
loud ice
#

its a C moment

winter orbit
#

welp

#

it is what it is

frank canopy
#

there might be a specific define for the c23 thing you can use idk

fiery turtle
hollow elm
#

ig it makes sense that vs2022 is missing a feature from a standard that was officially published in 2024

hollow elm
#

solution: install vs2024

loud ice
#

although

hollow elm
loud ice
#

its a C++ thing for a very long time

hollow elm
#

true

loud ice
#

and its an obvious extension

hollow elm
#

but it's msvc

winter orbit
fiery turtle
#

@winter orbit do u want to pr msvc compat for that header or should i fix it

winter orbit
#

it's fine i'd leave it as is

#

the _STATIC_ASSERT im using here is NT_ASSERT wrapped

fiery turtle
gentle peak
#

the message was required until c23 actually

winter orbit
#

oh no i didn't

fiery turtle
#

because helpers.h is not overridable

fiery turtle
#

is msvc broken then or what

gentle peak
#

maybe static assert without messages was a C++ thing from before C's static asserts? that's the only thing i can think of

loud ice
#

doubtful

#

i bet its just average MSVC jank

fiery turtle
#

this is like semi latest msvc

loud ice
#

yeah but its msvc

fiery turtle
#

i think?

winter orbit
#

this is latest vs2022

hollow elm
#

i completely misread the cppref page

fiery turtle
#

anyway since it's possible to have a broken static assert ill move UACPI_STATIC_ASSERT to compiler.h and make it overridable

fiery turtle
winter orbit
#

yup

#

wait

#

nope

fiery turtle
#

it's part of the public headers so if u compile anything in ros as c++ it might be part of that

fiery turtle
#

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

calm latch
#

Does this add new kernel APIs?

fiery turtle
#

nope

calm latch
#

It's not the msr stuff then¿

fiery turtle
#

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

calm latch
#

fun

fiery turtle
#

tbf linux currently doesnt implement that

#

ffixedhw was added in 2022

calm latch
#

return -EOPNOTSUPP;
?

#

boring of linux

fiery turtle
#

actually no

#

there's an impl for arm64

calm latch
fiery turtle
#

lucky for you this is very new stuff so no hw using it yet

#

besides some esoteric arm systems

calm latch
#

there was a spec for risc-v though

fiery turtle
#

hopefully i dont forget to fix an acpica bug i found tomorrow

fiery turtle
#

this is what it takes to figure out whatever you're supposed to do with these esoteric regions

frank canopy
#

lmao nice

fiery turtle
#

having the entirety of acpica open LULW

#

but now that i understand how they work its more or less simple actually

frank canopy
#

oh?

fiery turtle
#

which part? lol

frank canopy
#

fair enough lol

#

im mostly curious how the address spaces all work because i found like zero docs for any of them

fiery turtle
#

which one are u curious about

frank canopy
#

generic serial since it sounds like the worst of them

fiery turtle
#

okay so

#

I can give u a real world example i guess

calm latch
#

at least you can look at the source KEKW

fiery turtle
#
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
}
calm latch
#

(and not have to reverse NT)

fiery turtle
#

This declares a GenericSerialBus at [0, 100] (these numbers are meaningless)

calm latch
#

So if I write SMBus driver, it will somehow need to hook into ACPI?

fiery turtle
#

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

frank canopy
#

whats the 8 do then?

fiery turtle
#

Since XP00 is at offset 0 it would read from this i2c with command "0"

fiery turtle
#

but it means 8 bits

frank canopy
#

ah ok

fiery turtle
#

in this case its ignored

calm latch
#

Can ACPI write to PS/2? Thonk

frank canopy
#

so in this case its saying use smbus to access the resource from XPMC?

fiery turtle
fiery turtle
calm latch
#

No, but not for normal "your PS/2 controller is actually superio constoller trl"

#

But via this

frank canopy
left orbit
#

everything is done over mmio or system io

#

uacpi implements it all for you

calm latch
#

not everything

fiery turtle
calm latch
#

there are gpio memes for example

fiery turtle
frank canopy
fiery turtle
#

but most blobs have a handrolled smbus driver in aml

left orbit
#

what else could it be, msr on x86?

#

or like a proper driver?

fiery turtle
# left orbit what else could it be, msr on x86?

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,
left orbit
#

hmm okay

#

and how do you usually handle those?

#

is it like platform specific drivers?

fiery turtle
#

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

frank canopy
winter orbit
#

Can re try installing the official Ryzen AMD drivers for GPIO and friends

#

oof good times

vast kestrel
hollow elm
#

i misread the cppref page

vast kestrel
#

Ah fuck, I started scrolling and saw there were too many messages so just skipped at one point :^)

fiery turtle
fiery turtle
#

which C mode were u compiling in?

fiery turtle
#

working on address space tests... kinda boring but the peace of mind is worth it

hallow marten
#

can I write a raytracer in it

fiery turtle
fiery turtle
hallow marten
#

are there floats

#

I doubt it but would be fun meme

mortal yoke
#

no

#

but you could do fixed point

fiery turtle
#

^

#

You could write a soft float library

mortal yoke
#

or I guess you could also literally use the ieee float format and write a software impl lol

fiery turtle
#

Yep

mortal yoke
#

but that's more work than fixed point

gentle peak
#

is it possible to write a jit compiler in aml

hallow marten
#

just use bigger numbers to represent decimals

mortal yoke
#

actually that could be fun, compiling some kind of textual language to aml in aml and then Load'ing it KEKW

hallow marten
#

if there are functions and stuff then it's pretty much at the same level as C

gentle peak
#

if you pair that with a JIT-based AML interpreter I wonder what the performance of e.g. a JVM implementation would be

mortal yoke
#

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 KEKW 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

fiery turtle
#

Cursed af yeah

#

But should work

mortal yoke
#

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

fiery turtle
#

Can always special case it 💀

mortal yoke
#

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

fiery turtle
#

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

mortal yoke
#

that could actually be good solution tbh

fiery turtle
#

The only problem is you could run into a name thats already taken

#

So u have to be careful

mortal yoke
#

then imagine some firmware dev starts using that to check for this specific interpreter troll

fiery turtle
#

Lol

frank canopy
#

lmao

mortal yoke
#
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)
}
fiery turtle
#

bruh

fiery turtle
#

cant believe u actually spent time writing this LULW

loud ice
#

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

fiery turtle
#

just scan the entire blob for references to QACP and rename to QACB

loud ice
#

nah you can just rewrite your aml

mortal yoke
loud ice
#

idea

#

FDT parser in AML

#

so you can use uACPI for FDT

fiery turtle
#

💀

#

write an aml program that takes an FDT buffer as input and generates an aml namespace from it

loud ice
#

yeah

#

thats what i meant obviously

fiery turtle
#

thats surprisingly doable

#

u can even load that program as an SSDT dynamically

mortal yoke
#

and the dsdt data can be put inside a table

loud ice
#

yeah

#

its surprisingly doable

#

and that is the scary part

fiery turtle
#

lmfao

winter orbit
#

As someone whose daily driving uACPI this software is production ready

#

Okay now pin that out context trollface

mortal yoke
#

did your windows uacpi experiment succeed btw?

winter orbit
#

its still going

#

im using it rn

mortal yoke
#

nice

loud ice
#

damn

#

daily driving uacpi

winter orbit
#

I put it on my main machine yeah

#

Only had one issue so far and it’s my code not uACPI I think

fiery turtle
#

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

winter orbit
#

This is my daily driver btw

fiery turtle
#

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"

winter orbit
#

I think I know one of the people that worked on this

#

Let me go punch him

fiery turtle
#

lol

leaden fox
#

the og framework has had a huge battery drain firmware issue during suspend

#

no clue if they fixed it

winter orbit
#

they did but this is the 16

leaden fox
#

I just know the hotfix was using hibernate

winter orbit
#

it’s a very different firmware

#

This is far closer to the steam deck

leaden fox
#

how's the big one

#

any good?

winter orbit
#

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

vale isle
#

ig that's just linux uacpi

leaden fox
#

my framework drains so quick

#

the fan is also dirty I think which makes it pretty laggy sometimes

winter orbit
#

I like how my fans are interchangeable with the gpu module basically

winter orbit
#

Or reactos

#

Either way I’ll get a dump of stream deck for the repo

vale isle
#

the elgato stream deck meme

#

uacpi on the stream deck

winter orbit
calm latch
loud ice
#

i think

fiery turtle
loud ice
#

see if those ports are used by cros_ec

vagrant hull
#

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?

winter orbit
winter orbit
vagrant hull
#

i see

#

ty

loud ice
#

in unrelated news i think you should run my new game, the executable is called BiosDevSecretStealerBootkitInstaller.exe meme

winter orbit
#

Just that I’m doing it

#

And it’s working

vagrant hull
#

@fiery turtle i have a new BIOS :^)

fiery turtle
#

Give meme

vagrant hull
#

sent

#

they seem to have fixed whatever was triggering that ACPICA error

#

from the last revision

fiery turtle
#

thanks ill take a look at the diff

left orbit
#

my bios update today added 80KB of shit related to audio???

#

to the DSDT

fiery turtle
#

lol

dense steppe
#

you folks get bios updates?

frank canopy
#

ikr cant remember the last time ive noticed a bios update

#

maybe theyre sneaking past me but idk

dense steppe
#

(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 meme)

fiery turtle
#

My Mobo is boasting that 2019 built-in bios

dense steppe
#

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.

left orbit
#

it is though

#

kernels do load microcode on boot

dense steppe
#

yeah exactly.

winter orbit
#

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

hollow elm
#

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

winter orbit
vagrant hull
#

dead project :^)

fiery turtle
#

writing tests for the 1.0 PR

#

its mostly done

#

also irl work soo

rustic compass
#

@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?

fiery turtle
fiery turtle
thorny orbit
#

what tables used in uacpi_find_devices()

fiery turtle
#

none

thorny orbit
torpid root
#

did that "ok" have to be a ping

slim panther
vagrant hull
#

@fiery turtle did you check the diff of my BIOS yet?

fiery turtle
#

Not yet but I also updated my bios from 2018 and my monitors firmware

#

Will do today

fiery turtle
#

moved a lot of code around

#

some misc changes

vagrant hull
#

still lots of debug stuff around?

fiery turtle
#

even more added

fiery turtle
#

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

calm latch
#

i think you can

#

I've read somewhere that malloc throws exceptions with some libc s trl

hasty plinth
#

I guess its not marked nothrow

#

wtf though

calm latch
#

Ok maybe not malloc

#

But I remember reading something about it

fiery turtle
#

malloc has special rules in c++

#

so it throwing wouldnt surprise me tbh

left orbit
#

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

fiery turtle
#

it works fine

left orbit
#

wtf

fiery turtle
#

although it leaks everything of course

left orbit
#

that sounds sketchy as fuck

#

oh yeah

#

ofc it works

#

but thats waht i meant by "might be tough"

fiery turtle
#

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

calm latch
#

C just needs defer

mortal yoke
#

defer sucks

#

well its better than nothing but proper destructors are way better

calm latch
calm latch
#

It's a simple and elegant solution

#

imo

#

Like I've used it in Go and quite liked it

torpid root
calm latch
#

Like RAII of course is more powerful

torpid root
#

maybe we could call it c+1

calm latch
#

Thonk what if you call it c but incremented so c++

mortal yoke
calm latch
#

Also there's D KEKW

torpid root
calm latch
#

D

torpid root
#

basically 'C' incremented lol

calm latch
#

this is just labdas at this point

#

who proposed it

mortal yoke
#

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)

calm latch
#

lambdas would probably require a better type system

#

__attribute__((__cleanup__(callback))) Thonk

#

Like compilers already implement it just add it to the language nooo

gentle peak
calm latch
#

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

gentle peak
#

fair

dense steppe
#

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

gentle peak
#

because they can already access the parent scope's locals

dense steppe
#

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

mortal yoke
#

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

calm latch
#

Why do you even need nested functions?

dense steppe
#

to use as the cleanup function in __attribute__((cleanup))

calm latch
#

like just create raii-style destructors for everything

gentle peak
#

cleanup can only call functions, and you want to be able to use locals in your cleanup handler