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

1 messages ยท Page 35 of 1

fiery turtle
#

Since its an old obos iso it can be an obos regression as well lol

north holly
#

not old

#

it's on master, but behind a commit for RTC support, which is used in zero places in obos

fiery turtle
#

Can u do more debugging pls?

#

The address spaces support one

north holly
#

I've debugged to my full extent

keen marsh
#

@ me if you need any more testing

north holly
#

and have found it's in uacpi_finalize_gpe_initialization

fiery turtle
north holly
#

sure

fiery turtle
#

This doesnt tell me much because this pr didn't change any event code

#

So it must be something else

#

Like an obos bug chad

north holly
#

obos on m68k-port-fixes doesn't hang

#

obos on master+updated uacpi does

fiery turtle
north holly
#

I'll do that

fiery turtle
#

If that still hangs pls put prints in uacpi, finalize gpe initialization is really small

north holly
#

bruh wtf is cmake smoking

#
fatal: unable to read tree (63ab369748db5764b59a728f54da0d7e5390f407)
CMake Error at /home/oberrow/Code/obos/build/x86_64-release/_deps/uacpi-subbuild/uacpi-populate-prefix/tmp/uacpi-populate-gitclone.cmake:61 (message):
  Failed to checkout tag: '63ab369748db5764b59a728f54da0d7e5390f407'
#

ah nvm

#

infy rewriting history

calm latch
#

I have to go in like 10 minutes...

fiery turtle
north holly
keen marsh
north holly
#

guess I'm adding prints to uacpi code

#

I can probably test on my own from now, then when I've actually found a bug*

#

I can ask you

calm latch
fiery turtle
calm latch
#

I can't test it nooo

calm latch
#

In the meantime I'll only have my Lenovo laptop

#

At least that's one which has GPIO meme

fiery turtle
#

Good test bed

north holly
#
        ret = set_gpe_state(event, GPE_STATE_ENABLED);
        if (uacpi_unlikely_error(ret)) {
            gp_event_toggle_masks(event, UACPI_FALSE);
            event->num_users--;
        }```
#

uacpi is last seen here

#
    ret = uacpi_gas_read(&reg->enable, &enable_mask);
    if (uacpi_unlikely_error(ret))
        goto out;

    switch (state) {
    case GPE_STATE_ENABLED:
        enable_mask |= event_bit;
        break;
    case GPE_STATE_DISABLED:
        enable_mask &= ~event_bit;
        break;
    default:
        ret = UACPI_STATUS_INVALID_ARGUMENT;
        goto out;
    }

    ret = uacpi_gas_write(&reg->enable, enable_mask);```
#

then hangs somewhere here

fiery turtle
#

Gas write dispatches into your code btw

north holly
#

in between the two locks

north holly
fiery turtle
#

Probably io_map and then io_write

#

But add more prints

north holly
#

uacpi is last seen during or after the gas write

#

I think it hangs in outb

#

writing 0x22 to I/O port 0x182a is the last thing I see

fiery turtle
#

Wtf

north holly
#

byte width is 1

fiery turtle
#

And that never returns?

north holly
#

so it's an outb

north holly
#

there was a previous write to that port:

writing 0x02 to I/O port 0x182a```
#

a read made right before that indeed returned to the caller

#

with 0x02 as the value read

fiery turtle
#

Huh

north holly
#

basically:

acquired [some random spinlock]
read 0x02 from 0x182a
writing 0x22 to I/O port 0x182a
HANGS
fiery turtle
#

Can u roll back to previous uacpi but keep these io traces? To see if the values written have changed or something

north holly
#

sure

fiery turtle
#

Thanks

#

Although I dont understand how outb can hang

#

Any chance u get an irq during that?

north holly
#

IRQL is at dispatch

#

so no timer/scheduler IRQs

fiery turtle
#

What about acpi

north holly
#

GPEs are blocked at IRQL 8 (some random IRQL, nothing special about it)

#

and IRQL_GPE > IRQL_DISPATCH

#

so it might get a GPE which throws stuff off, but it seems unlikely that it would happen every time

fiery turtle
#

Because that thing might enable a gpe with a spinlock held, if you dont actually disable irqs and call into uacpi again that will hang

#

Do u trace spinlock acquires?

north holly
#

spinlock acquires are being traced

#
uacpi_cpu_flags uacpi_kernel_lock_spinlock(uacpi_handle hnd)
{
    spinlock* lock = (spinlock*)hnd;
    printf("acquiring %p\n", hnd);
    irql r = Core_SpinlockAcquire(lock);
    printf("acquired %p\n", hnd);
    return r;
}```
#

and there are no logs related to spinlocks after the write

fiery turtle
#

I see

#

But yeah lets see the io traces with older uacpi

north holly
#

is master good?

#

or is that too old?

#

actually I'd ideally be on the commit that I knew to work before

#

1d636a34152dc82833c89175b702f2c0671f04e3

fiery turtle
fiery turtle
#

Compared to master

fiery turtle
#

Thats basically master

north holly
#

ye

#

HEAD~1

fiery turtle
#

Ye

#

And the last commit was cosmetic

north holly
#

cmake is being retarted

#

*restarted

#

huh what

#

it still hangs on old uacpi

#

same value written

fiery turtle
#

But u said it just worked on the old uacoi ๐Ÿ’€๐Ÿ’€๐Ÿ’€

north holly
#

it worked on old uacpi

#

on his PC

#

guess I never bothered to check my pc

fiery turtle
#

Bruh

#

Maybe try older uacpi or obos something?

#

And make sure u did overwrite the usb

north holly
#

yeah I did

fiery turtle
#

Oh also

north holly
#

overwrite the usb

fiery turtle
#

What if u dont do gpe set for wake stuff

#

And just do finalize

north holly
#

soo skip the call to OBOS_InitWakeGPEs

fiery turtle
#

Basically

#

And if even that doesnt work we can try pmos or astral

fiery turtle
north holly
#

without that

#

and I can confirm the usb was overwritten

#

I'm going to download pmOS

fiery turtle
#

Try that ig

#

That might have a fucked framebuffer tho

#

If that doesnt work will try proxima

north holly
#

I'll just see if the power button shuts down pmOS

fiery turtle
#

Yeah

north holly
#

which should be enough to see if it works

north holly
#

idk how new of uacpi it is

#

unless

#

it doesn't

#

idk if it's hanging or what

#

but the power button isn't shutting it down

#

it says that it enabled 11 GPEs

fiery turtle
fiery turtle
fiery turtle
north holly
#

you already have it

calm latch
fiery turtle
#

Which one is it

calm latch
#

Idk it only works in QEMU

north holly
north holly
north holly
calm latch
#

The only nice thing is that now it's consistently broken

calm latch
north holly
#

it isn't shutting down

calm latch
north holly
#

on power button

#

last thing I see if is a test exception log

calm latch
#

And nothing?

north holly
#

then nothing

calm latch
#

So the framebuffer is working

#

Does keyboard work?

north holly
#

also it seems to test the AHCI controller

north holly
calm latch
#

I'm not at home but will debug this evening

#

Maybe the AHCI driver is messing everything up

fiery turtle
#

@north holly can u try this?

north holly
#

k

fiery turtle
#

alothugh fuck i dont think it hooks up the power button

#

@gentle peak (sry for ping) where can we get the latest proxima build that shuts down on power button?

north holly
#

yeah it also doesn't boot

fiery turtle
#

wdym

#

it boots here

north holly
#

yeah it triple faults

fiery turtle
#

fuck

#

lmfao

gentle peak
fiery turtle
#

like in qemu?

fiery turtle
north holly
#

no, it triple faults in real hardware

fiery turtle
#

and doesnt shut down in qemu

gentle peak
#

anything built after dec 31 should have the power button stuff

#

2s

north holly
#

last thing I see is limine messages

fiery turtle
#

i tried looking for your ci image but i dont se the links in the repo

north holly
#

saying it's loading the kernel

#

then a triple fault instantly

gentle peak
#

apparently i lied in that message and the build was not for x86-64-v0

north holly
#

bruh

gentle peak
#

i'll get the latest from ci

north holly
#

my pc is x86_64-v3 iirc

#

either that or x86_64-v2

#

it's haswell

fiery turtle
#

maybe that was the SSE build

gentle peak
#

i believe that one was where i built with -march=raptorlake -mtune=raptorlake accidentally because i forgot you have to fully reconfigure with meson for those to apply

fiery turtle
#

makes sense

north holly
#

yeah I think haswell is a bit older than raptorlake

gentle peak
fiery turtle
#

hmm still no shutdown

#

is this the expected output?

gentle peak
#

that's the expected output yeah

north holly
#

still triple faults

gentle peak
#

i forgot currently it panics on init and therefore irqs are disabled

fiery turtle
#

bruh we dont have a single non broken kernel to test uacpi with ๐Ÿ’€

gentle peak
#

it's not really broken

north holly
#

astral

gentle peak
#

everything works as intended

#

that image just doesn't have a /bin/init

gentle peak
#

so it panics on init and disables irqs

fiery turtle
#

can u not do that?

#

well it also triple faults on oberrows pc

north holly
gentle peak
#

yeah give me like 2s

gentle peak
fiery turtle
north holly
#

not even finalize gpe init?

fiery turtle
#

there's managarm but its a 5gb iso

#

if u want to dd that

fiery turtle
gentle peak
gentle peak
fiery turtle
north holly
gentle peak
#

it counts down to 0 for me and then immediately shuts down

#

this is in qemu yeah?

fiery turtle
#

yeah

#

no invariant tsc here tho

fiery turtle
#

which ur pc should because its a fixed event i think

gentle peak
north holly
#

yeah it's fixed

gentle peak
#

because proxima ignores what cpuid says about invtsc presence

median crest
fiery turtle
#

nah thats a separate thing

median crest
#

Oh

fiery turtle
#

the thign that hangs on obos is not called on astral

#

astral doesnt call it because i forgor

median crest
#

:skull

gentle peak
#

oh the build i sent also triple faults on my own haswell test machine

#

that makes it easier to debug at least

fiery turtle
#

๐Ÿ’€

#

pls fix it so i can prove its an obos bug

gentle peak
#

give me like an hour

#

i should really set up pxe

fiery turtle
#

letsgo

#

although i mean pmos doesnt hang so

#

i kinda did prove its an obos bug

north holly
#

it is a outb

gentle peak
#

oh also this uses uacpi master not the 1.0 rc

fiery turtle
#

@north holly are u brave enough to try latest managarm?

north holly
#

idk how that would be bugged

fiery turtle
fiery turtle
north holly
fiery turtle
#

i suspect u get an irq and hang there

#

i can send u the link

north holly
#

I mask IRQs

#

now

#

still hung

fiery turtle
#

probably didnt mask well enough

#

because outb cant hang

#

unless it triggers and smi, which this one shouldnt i hope

north holly
#

it's at irql 15

north holly
#

and SMI

#

probably

fiery turtle
north holly
#

993.0M

fiery turtle
#

yes

north holly
#

too much time to download

fiery turtle
#

fuck

#

@kindred beacon do u have a small bootable managarm image perchance?

gentle peak
#

ok what the fuck?

#

if i set up an hdd image on the usb with the exact same kernel and initrd images it boots fine

#

but if i dd an iso onto it it's broken

fiery turtle
#

maybe its a limine bug with some memory map edge case again

#

or similar

gentle peak
#

i mean i saw it get into the kernel on the iso boot

#

it triple faulted after time: tsc is ... MHz

fiery turtle
#

ah

north holly
kindred beacon
gentle peak
#

i can confirm the shutdown works on my machine though

kindred beacon
#

But we have a nightly image linked in the readme

fiery turtle
#

its 4 gigs tho

#

and oberrow cant download that

north holly
#

I mean I can but it takes many long time

kindred beacon
#

We default to 4 gigs lol

fiery turtle
gentle peak
#

i did not make any changes

#

that's the thing

#

i literally just switched from dd'ing an iso to setting up a proper hddboot on the usb for ease of debugging

fiery turtle
#

can u send over that raw hdd image?

slim panther
flat badge
#

It's not 4gigs compressed

fiery turtle
#

nah qookie was able to make a small one

#

of a few megs

slim panther
#

well yea compressed

#

it's mostly 0

#

but image-size is 4G

north holly
#

also, can't outb technically hang if you do a bad read/write

#

to an IO port

fiery turtle
#

nop

#

gimme a sec ill take a look at your dump

north holly
#

port in question is 0x182a

fiery turtle
#

is it ASUS?

north holly
#

ACER

fiery turtle
#

I have LENOVO, DELL, and ASUS

#

3 of your dumps

north holly
#

I don't own anything ASUS

fiery turtle
#

the motherboard might be asus

flat badge
#

Somebody with a managarm dev env could just do xbstrap install base && xbstrap run initialize-empty-image remake-image

#

to get a minimal image

north holly
#

the one I have is ACRSYS

#

in the dsdt

fiery turtle
#

with lenght 16

#

so yeah its correct

north holly
#

what's offset 0xa supposed to mean?

frank canopy
#

now I'm getting tempted to make a kernel that just dumps out the entire acpi tables to com1 or something just to make making the dumps easier

fiery turtle
#

half is status half is enable bits

gentle peak
# gentle peak i literally just switched from dd'ing an iso to setting up a proper hddboot on t...

so i guess the fix is ```sh
DEVICE=/dev/...
LIMINE=$(limine --print-datadir)

sfdisk "$DEVICE" << EOF
,+,0c,-
EOF
limine bios-install "$DEVICE"
mkfs.fat "${DEVICE}1"
mount "${DEVICE}1" /mnt
mkdir -p /mnt/EFI/BOOT
cp "$LIMINE/BOOTX64.EFI" /mnt/EFI/BOOT
cp "$LIMINE/limine-bios.sys" /mnt
cat > /mnt/limine.conf << EOF
timeout: 5

/Proxima
protocol: limine
kernel_path: boot():/boot/hydrogen
module_path: boot():/boot/proxima.tar
EOF
umount /mnt

echo "Now copy /boot/hydrogen and /boot/proxima.tar from the ISO to the USB"

fiery turtle
#

offset A is GPE 0xA - (16 / 2)

north holly
#

so 0x182a is GPE 10 of GPE block zero?

fiery turtle
#

no, its at least GPE 16

#

each bit is one gpe

#

0xA - (16 / 2) is 2

#

so 16 bits

#

and then we would check the bit that it sets in that reg

north holly
#

I see

fiery turtle
#

btw the oem id is dell @north holly

north holly
#

wrong ACPI tables

fiery turtle
#

bruh

north holly
#
[000h 0000   4]                    Signature : "FACP"    [Fixed ACPI Description Table (FADT)]
[004h 0004   4]                 Table Length : 0000010C
[008h 0008   1]                     Revision : 05
[009h 0009   1]                     Checksum : F5
[00Ah 0010   6]                       Oem ID : "ACRSYS"
[010h 0016   8]                 Oem Table ID : "ACRPRDCT"
[018h 0024   4]                 Oem Revision : 01072009
[01Ch 0028   4]              Asl Compiler ID : "AMI "
[020h 0032   4]        Asl Compiler Revision : 00010013
fiery turtle
#

dont have this dump

#

is it same gpe block base?

north holly
#

yes

fiery turtle
#

and length?

north holly
#
[050h 0080   4]           GPE0 Block Address : 00001820
#
[05Ch 0092   1]            GPE0 Block Length : 10
fiery turtle
#

ye

north holly
fiery turtle
#

64 gpe regs, 128 bits total, 64 status bits, 64 enable bits

north holly
#

for future reference

fiery turtle
#

thanks

north holly
#

bro wtf is this

fiery turtle
#

wdym

north holly
#

it just wants to hang

#

on outb

gentle peak
fiery turtle
#

@north holly ^

#

inb4 also hangs

north holly
#

at least when I dd the image

#

I'm gonna go get something to eat now

fiery turtle
#

bruh

#

so unlucky

#

@gentle peak btw if you have time, could you test out the 1.0rc pr?

gentle peak
fiery turtle
#

yup

#

I wonder why proxima triple faults on obos tho

#

oberrows pc i mean

gentle peak
#

if i had a bit more patience i'd investigate it

#

but i have literally nothing to go off of given that (presumably) the triple fault occurs before the display "recovers" from limine's modeset

#

so it'd take a long time to narrow down

fiery turtle
#

true

gentle peak
#

not receiving the power button event

#

i'm getting the VALZ no listeners warning

#

but the actual handler isn't getting invoked

fiery turtle
#

ok this is actually good

north holly
#

I have found out it's tryna do something to GPE 21

#

it's trying to enable it

#

now time to see what GPE 21 is

gentle peak
#

on qemu i mean

#

sorry

#

i'm not getting the valz no listeners thing on qemu obv because that's a toshiba thing

#

but the power button handler isn't getting invoked either

fiery turtle
#

nice because i can probably repro it in astral locally and then debug from there

gentle peak
#

yeah it happens on debug builds running in tcg and everything

fiery turtle
#

as a quick guess, perhaps reverting dfd92d5d87acadc574619b1b0401dc59a92da422 could fix it

#

potentially followed by e7ffcaa016515e4857630af6ae342fb0eb97ceb6

calm latch
# calm latch

Power button's also broken in QEMU for some reason...

fiery turtle
#

yeye same in proxima

calm latch
fiery turtle
#

its a uacpi bug in the pr

#

some caching logic might be incorrect i think

#

ill debug it soon

north holly
#

I'm gonna test a really old obos commit

#

before I even had an EC driver

#

to see what happens there

#

seriously infy

#

you gotta stop rewriting git history

#
Cloning into 'uACPI'...
fatal: unable to read tree (cc2ac5f788d81874b9c677c763b803aa375e9395)
CMake Error at /home/oberrow/Code/obos-old/build/_deps/uacpi-subbuild/uacpi-populate-prefix/tmp/uacpi-populate-gitclone.cmake:61 (message):
  Failed to checkout tag: 'cc2ac5f788d81874b9c677c763b803aa375e9395'
fiery turtle
#

i think i know whats going on

#

but for that i have to fix astral builds

fiery turtle
gentle peak
#

i'll try that in a sec but i'm stepping through the code a bit and i noticed that when do_read_one(mapping, 0, &value0) calls uacpi_gas_read_mapped, gas->total_bit_width is 0 so it doesn't read anything, and do_read_one(mapping, 1, &value1) does an early exit because it isn't in REGISTER_MAPPING_STATE_MAPPED

#

this is while reading PM1_STS

#

which seems wrong

north holly
#

obos 3783b02138985e269bceb137233328b658411427 works

fiery turtle
#

yeah because PM1_STS can have two separate registers

#

and pm1b is not implemented on qemu

north holly
#

which is the commit right before any sort of EC driver was added

fiery turtle
#

so it just skips reading it

fiery turtle
gentle peak
#

oh great the revert has a merge conflict

fiery turtle
#

yeah nvm dont even try to revet it, obv thats the bug

#

im not sure why it gets a zero there tho

gentle peak
#

in map_one for PM1a, the temp_gas has 0 for register_bit_{width,offset}

#

spec->access_width is 0

fiery turtle
#

thats correct

#

its only specified for non-gas

#

gas_validate somehow returns 0 for total_width i guess?

gentle peak
#

yeah but that info is then copied into the mapping by uacpi_map_gas_noalloc

fiery turtle
gentle peak
#

the total_width calculated by gas_validate is align_up(bit_offset + bit_width, uacpi_size)

#

both of which are 0

fiery turtle
#

yeah, but it aligns up to computed access width

#

or i guess it aligns the zero up to zero?

gentle peak
#

this is in gas_get_access_bit_width

#

and again register_bit_width is 0

fiery turtle
#

wait a sec

#

why is bit_width zeroed out even

#

it shouldnt be i think

gentle peak
#

spec->access_width is 0

#

(the one passed to map_one)

fiery turtle
#

but pm1 is REGISTER_KIND_GAS no?

gentle peak
#

access_kind is 1

#

REGISTER_KIND_IO

fiery turtle
#

whats the backtrace?

gentle peak
#
#0  gas_validate (gas=0xffffffff9034ee84, access_bit_width=0xffffffff9034ee4b "", bit_width=0xffffffff9034ee4a "") at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/io.c:727
#1  0xffffffff800437e0 in uacpi_map_gas_noalloc (gas=0xffffffff9034ee84, out_mapped=0xffffffff8004f500 <g_register_mappings>) at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/io.c:837
#2  0xffffffff80044d76 in map_one (spec=0xffffffff80003da0 <g_registers>, mapping=0xffffffff8004f500 <g_register_mappings>, idx=0 '\000') at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/registers.c:139
#3  0xffffffff80044e39 in ensure_register_mapped (spec=0xffffffff80003da0 <g_registers>, mapping=0xffffffff8004f500 <g_register_mappings>) at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/registers.c:168
#4  0xffffffff80045064 in uacpi_read_register (reg_enum=UACPI_REGISTER_PM1_STS, out_value=0xffffffff9034ef20) at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/registers.c:236
#5  0xffffffff80046773 in handle_fixed_events () at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/event.c:205
#6  0xffffffff8004877a in handle_sci (ctx=0xffff800007f37440) at ../../../../../packages/hydrogen/src/subprojects/uacpi/source/event.c:2099
#7  0xffffffff80011835 in acpi_irq_dispatcher (ptr=0xffff800007d53980) at ../../../../../packages/hydrogen/src/kernel/src/drv/acpi.c:374
#8  0xffffffff80023665 in sched_init_task (func=0xffffffff800117de <acpi_irq_dispatcher>, ctx=0xffff800007d53980, task=0xffff800007d3d800) at ../../../../../packages/hydrogen/src/kernel/src/sched/sched.c:439
#9  0xffffffff8000eb7e in task_init_stub () at ../../../../../packages/hydrogen/src/kernel/src/sched/sched.S:42```
#

here's the raw one from gdb

fiery turtle
#
    [UACPI_REGISTER_PM1_STS] = {
        .kind = REGISTER_KIND_GAS,

๐Ÿ’€

gentle peak
#

yeah it gets changed somewhere

fiery turtle
#

its const too

#

so it should be mapped RO

gentle peak
#

oh wait i was looking at access_kind not kind

#

you should really make the fields in the struct themselves enums instead of chars so the debugger prints them nicer

#

yeah kind is 0

fiery turtle
#

the struct would be huge then

#

like u cant have typed enums in c

#

unless its c23

gentle peak
#

i mean

#

not really

#

right now it's 3*u8 followed by a pointer

#

if you changed them to enums you'd only be wasting 4 more bytes

fiery turtle
#

on 64-bit platforms

#

but yeah

gentle peak
#

ah i see you made the same mistake i did

fiery turtle
#

bruh

#

brain damage

gentle peak
#

if i change that to spec->kind it works perfectly

fiery turtle
#

nice

#

lemme make the fix

#

alright fixed

#

thanks for your help

gentle peak
#

no problem

fiery turtle
#

does real hw work as well now?

gentle peak
#

testing now

fiery turtle
#

(ideally on current pr head)

gentle peak
#

did you rewrite git history or something? git's saying the local and origin branches have diverged

#

it's not an issue but still

fiery turtle
#

yeah ofc, i just pushed the fix into the commit which introduced the bug

gentle peak
#

works on real hw

fiery turtle
#

nice

#

there's another behavior change which i dont like

#
    total_width = UACPI_ALIGN_UP(
        gas->register_bit_offset + gas->register_bit_width,
        *access_bit_width, uacpi_size
    );
#

previously this wasnt getting aligned up when doing io

#

not that it should matter in this case

#

@north holly ive just fixed a relatively important bug, can u retest

#

probably not the one that caused your hang but

frank canopy
#

it might be

#

who knows

gentle peak
#

i mean it could've been the cause, since the bug had the potential to access mmio as pio

fiery turtle
#

the other way around

#

but yeah

frank canopy
#

with how interconnected everything is i still wouldnt be shocked if it was related to the hang in obos

fiery turtle
#

thing is, obos hangs even on master

#

before any of these changes

gentle peak
#

fair

frank canopy
#

oh true

fiery turtle
#

and e.g. latest pmos did make it past the spot where obos hung

#

but didnt shutdown because of this bug that monkuous found

#

@calm latch btw can u git fetch && git reset --hard origin/address-spaces-support and rebuild the image?

#

so oberrow can retest on his pc

#

because proxima triple faults on that

frank canopy
#

upsides of using zig fetch & co for dep management:
- zig fetch --save=uacpi git+https://github.com/uACPI/uACPI#address-spaces-support and its done without having to deal with git history management on a submodule
downsides:
- no local copy to edit for adding printfs

fiery turtle
#

no local copy kinda sucks yeah

frank canopy
#

i think it stores one in the build cache but thats checksummed so cant edit it and hard to find

#

but if i dont need to edit uacpi then dang is it nice

#

can also put in a path instead of a url to do it with submodules or whatever in case of emergency

#

thats what i do for other deps i have needed to edit

fiery turtle
#

True

north holly
fiery turtle
#

nice

#

vanilla or modded

north holly
#

Hypixel

#

My computer is too shit for mods

#

And I don't want to make a new world

#

bruh 1.13 still doesn't work on debian sid

#

I'll just send a crash report

fiery turtle
#

ah

north holly
#

hopefully they fix that (they won't)

#

but anyway, I guess I'll play hypixel in the meantime

north holly
left orbit
#

it's java

#

how can it not work on debian

median crest
#

And use like 2 render distance

north holly
#

nvm I'm not playing hypixel anymore

north holly
#
library initialization failed - unable to allocate file descriptor table - out of memoryAborted (core dumped) 
#

hm

#

huh changing the command to use java instead of whatever the mc launcher packages

#

gets it to work

calm latch
#

(I think I need a better build system, but whatever)

calm latch
#

Though it might have been unrelated

flat badge
calm latch
#

I mean it's just make all to get an iso

#

After you build clang trl

north holly
#

minecraft break done

north holly
#

bro why would an outb hang

#
uacpi_status uacpi_kernel_io_write8(
    uacpi_handle hnd, uacpi_size offset, uacpi_u8 in_value
)
{
    uintptr_t port = (uintptr_t)hnd;
#if defined(__x86_64__) || defined(__i386__)
    outb(port+offset, in_value);
#endif
    return UACPI_STATUS_OK;
}```
frank canopy
#

did you put a printf after the outb?

#

and is it just triggering an interrupt the instant the outb goes out and then thats hanging?

fiery turtle
#

That was my assumption

fiery turtle
north holly
#

UACPI_STATUS_OK

#

my IOAPIC code has struck again

#

this is the second time this has happened

#

on that same computer

fiery turtle
#

Wdym

#

Like doesnt hang anymore?

#

I guess it was hanging because your polarity was bogus

#

And u did get an irq right after the outb

north holly
#

It doesn't hang without irqs

fiery turtle
#

fix your goddamn gsi routing code

north holly
north holly
#

In a few hours tho

#

Gtg now

fiery turtle
#

sure

north holly
#

Weird that it worked in a very old obos commit, even though I hadn't changed any ioapic code

#

Since then

fiery turtle
#

u probably did

#

by accident maybe

#

or maybe ur corrupting your redirect table

north holly
fiery turtle
#

u mean git log

north holly
#

I used git diff

#

To compare whatever the commit that I tried was

#

To master

#

And the ioapic code wasn't changed except for one small detail which I am sure doesn't matter

fiery turtle
#

inb4 memory corruption

frank canopy
#

one small detail which i am sure doesn't matter
๐Ÿค”

strong heath
#

does uacpi support modern standby

fiery turtle
#

its up to the os to support it

#

but uacpi has all the primitives to implement it

strong heath
#

what does it entail

fiery turtle
strong heath
#

thanks ill give it a look

fiery turtle
#

npnp

strong heath
#

does uacpi need to be initialized to return tables with uacpi_table_find_by_signature

gentle peak
#

you can use early table access

strong heath
#

what do you mean by that

fiery turtle
strong heath
#

oh thats neat

#

thanks

fiery turtle
#

np!

north holly
#

From low first then high to high first then low

frank canopy
#

ok yeah that shouldnt be an issue lol

strong heath
#

(0000000000) successfully loaded 1 AML blob, 1712 ops in 10ms (avg 171200/s)

fiery turtle
#

q35 + kvm?

strong heath
#

for the sake of my ego ill just not say

fiery turtle
#

btw do u want me to add ironclad to the mentioned projects list

strong heath
#

ill tell you when to do it since its not upstreamed yet

#

if you care about that

fiery turtle
#

sure

#

yeah

calm latch
#

It gets power button notification, but doesn't shut down untill I press the keyboard button for some reason

fiery turtle
#

did u update to latest pr head

#

wait what does that even mean

calm latch
#

I have very fast internet

fiery turtle
#

no like

calm latch
#

It sent messages in wrong order

fiery turtle
#

u get the notification

fiery turtle
#

not when u press the power button?

calm latch
#

*keyboard button

#

not power button

#

maybe it's qemu thing

fiery turtle
#

i dont think its a qemu thing

calm latch
#

I press power button, it gets notification and doesn't do anything

#

untill I press enter

#

weird

fiery turtle
#

pmos regression?

#

what if u revert to old uacpi btw

calm latch
#

I've removed the old api

#

wait a sec

fiery turtle
#

i doubt it matters but

#

because it sounds like it hangs in userspace

#

until u press a key

calm latch
#

which old

#

maybe my interrupts delivery is broken

fiery turtle
#

master

calm latch
#

or scheduler idk

fiery turtle
#

but u get the notif

calm latch
#

Maybe broken timers

#

Idk, it does sleep(3);

#

Lemmy check master

#

I added 3 new syscalls and changed my IPC stuff

#

maybe I broke something

#

in the process

fiery turtle
#

That would explain it

calm latch
#

(more messages to compete with Nyaux thread)

calm latch
#

bruh wtf is going on with my wifi

#

I can't even push a commit

fiery turtle
#

You can have both so its easier to test

#

These APIs dont conflict with each other

calm latch
#

I know

#

Oh I have a very old API

#

It's the same on master

#

It's weird

fiery turtle
#

Remove the star

calm latch
#

no, it's the old thing

#

I've fixed it

#

Idk what's going on

#

I'm blaming qemu

fiery turtle
#

Doubt

#

Try bisecting your IPC changes

calm latch
#

I think my timers code is broken

#

If I open QEMU monitor it does it as it should

#

sleep() that is

fiery turtle
#

Yeah potentially

calm latch
north holly
#

At the mosque

#

Can't test

fiery turtle
#

But why is pressing a button needed

calm latch
#

It gets keyboard interrupt, which reschedules and restarts lapic timer, probably

#

I don't remember, but I think I might be disabling the timer in idle thread Thonk

#

(I've also changed the timers' code)

fiery turtle
#

The Hamming weight of a string is the number of symbols that are different from the zero-symbol of the alphabet used. It is thus equivalent to the Hamming distance from the all-zero string of the same length. For the most typical case, a string of bits, this is the number of 1's in the string, or the digit sum of the binary representation of a g...

#

i think im going to do this

#

instead of relying on __builtin_popcnt

strong heath
#

What advantages does it bring

fiery turtle
#

not relying on libgcc or x86_64-v1

#
// https://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation
uacpi_u8 uacpi_popcount(uacpi_u64 x)
{
    x -= (x >> 1) & 0x5555555555555555ull;
    x = (x & 0x3333333333333333ull) + ((x >> 2) & 0x3333333333333333);
    x = (x + (x >> 4)) & 0x0F0F0F0F0F0F0F0Full;

    return (x * 0x0101010101010101) >> 56;
}
#

this should work

strong heath
#

Please do

fiery turtle
#

yeah

#

everyone compiles for x86_64 base so it produces an undefined reference which is annoying

#

wait

#

this is used in like one place to count set bits of a 16 bit number

#

i can just get rid of this

#

for some reason i was under the impression that aml had a popcount instruction

frank canopy
#

nice to get rid of things

fiery turtle
#

yeah ill just do this ad-hoc loop, which is used on a very cold path anyway

frank canopy
#

is has_builtin false if you compile without the instruction, for however popcout was implemented?

#

if so id use that just in case

fiery turtle
#

the has_builtin is always true

#

because it falls back to the libgcc implementation

frank canopy
#

ah ok

#

yeah if its a cold path then probably not worth it then

fiery turtle
#

yeah this is resource conversion

#

so very very cold path

#

@north holly @calm latch I just made a few last minute optimizations (for GPEs) and popcount removal, so if you can pls retest

#

EC stuff might've regressed

north holly
#

uh soon

#

in 5-6 hours probably

fiery turtle
#

sure sure

#

im doing the final review pass and fixing small things atm

fiery turtle
#

alright, I think that's it, if oberrow and mishakov dont find new regressions im merging it

north holly
fiery turtle
#

and monkuous (if they're available to test)

north holly
#

uacpi 1.0 tomorrow then ๐Ÿฅบ

fiery turtle
#

yup

#

as soon as i wake up

north holly
#

that's enough before banter mutes me

fiery turtle
#

lol

north holly
#

@stone reef I'm going to spam and there is nothing you can do about it!!21111!!!

fiery turtle
#

this PR is one month old now

#

very good time to merge

pine leaf
#

if there's some builds that can be tested on hw, I'll try them on a few different machines of mine

fiery turtle
#

sure that would be cool

pine leaf
#

I have desktops and laptops from a very wide range of eras and manufacturers

fiery turtle
#

how old are these machines

pine leaf
#

oldest is a Core 2 Duo from 2007
newest 2 are an AM4 board from ASRock and an LGA1700 board from ASUS

#

and several in between

fiery turtle
#

core 2 duo could have pretty insane aml so thats nice

#

pre-vista aml was insane

pine leaf
#

I can test on all of these

  • Dell Optiplex 755 - C2D E8400
  • Dell Precision T1650 - Xeon E3-1240v2
  • HP ProBook 4540s - i5-3210M (sadly has known but unfixed graphics issues in Limine - iirc only when booting via legacy BIOS?)
  • HP EliteDesk something or other - some 4th gen i7 (I haven't touched this one in a while, I forget what exactly it is)
  • Dell Latitude E5250 - i5-5200U
  • ThinkPad T14 Gen 1 AMD - Ryzen 7 PRO 4750U
  • Beelink SER5 - Ryzen 5 5500U
  • ASUS PRIME H610M-E D4 - i3-12100f
  • ASRock B450 Steel Legend - Ryzen 5 3500X
fiery turtle
#

damn

#

obos uses hyper so

#

limine problems might not affect it

pine leaf
#

well that's only on that one machine, and it's purely a graphical issue

#

it actually executes fine, but the fb pitch is wrong or some nonsense

fiery turtle
#

but yeah would be great ofc

#

for obos, pmos and proxima

calm latch
#

I can also make a build with 32 bit userspace (and uACPI)

fiery turtle
#

pls do

#

from the new PR head tho

calm latch
fiery turtle
#

core2duo probably supports 64-bit stuf tho

calm latch
#

(it doesn't work half the times)

calm latch
#

There's stuff like athlon 64

#

which is like early 64 bit

calm latch
#

anyway

#

time to recompile llvm

#

git fetch && git reset --hard origin/address-spaces-support?

fiery turtle
#

yup

#

should see thisstdlib: get rid of uacpi_popcount

calm latch
#

/home/misha/llvm-pmos/libcxx/src/memory.cpp:102:43: error: size of array element of type '__libcpp_mutex_t' (aka 'pthread_mutex_t') (32 bytes) isn't a multiple of its alignment (64 bytes) bruh

fiery turtle
#

what the fuck

calm latch
#

Idk

#

llvm insanity

#

It's defined as ```C
typedef struct {
__pmos64u_t block_count;
__pmos64u_t blocking_thread_id;
struct __pthread_waiter *waiters_list_head;
struct __pthread_waiter *waiters_list_tail;
unsigned long recursive_lock_count;
int type;
#ifdef i386
} pthread_mutex_t attribute((aligned(64)));
#else
} pthread_mutex_t;

north holly
#

@fiery turtle this new commit caused obos to shutdown on suspend

#

Either that or I forgot to do something

fiery turtle
#

which commit lol

#

u did i think

north holly
#

Ah nvm I forgot something

fiery turtle
#

but that would be a funny bug

north holly
#

I forgot to put the wake gpe registering code back

left orbit
#

lmao

north holly
#

Silly me

calm latch
#

clang's -E is refusing to work bruh

north holly
#

Ah nvm it still broke

#

@fiery turtle

fiery turtle
#

what

north holly
#

The HEAD of the PR broke suspend

fiery turtle
#

can u please triple check

north holly
#

Yes

fiery turtle
#

that its not an obos bug

north holly
#

I will be going back in time to make sure

calm latch
#

I am going insane ```C

230 "/home/misha/pmos/sysroot/usr/include/__posix_types.h" 3

typedef struct {
__pmos64u_t block_count;
__pmos64u_t blocking_thread_id;
struct __pthread_waiter *waiters_list_head;
struct __pthread_waiter *waiters_list_tail;
unsigned long recursive_lock_count;
int type;

} pthread_mutex_t attribute((aligned(64)));

typedef pthread_mutex_t __libcpp_mutex_t;

#

what the fuck

#

cpp output by clang

#

I need clang wizzards

slim panther
#

hello

dense steppe
#

also what is strange about this CPP output?

calm latch
#

Which needs to go because of priority inversion issues, and besides the point

dense steppe
#

are pointers 64-bit?

#

sanity question

calm latch
#

32 bit

dense steppe
#

ahhh

calm latch
#

64 bytes Thonk

#

not 64 bits

#

I'm dumb...

dense steppe
#

Ahh

#

you meant to do _Alignas (__pmos64u_t)?

calm latch
#

yeah

dense steppe
#

easy to get wrong :p

fiery turtle
#

@north holly did u figure it out?

north holly
#

I'm trying

fiery turtle
#

is it an obos problem?

north holly
#

Idk at this point

fiery turtle
#

what happens exactly

north holly
#

The signs do not point anywhere

calm latch
#

Are there operating systems with i686 uACPI?

fiery turtle
#

not besides reactos

calm latch
#

fuck ld.lld: error: unable to find library -lclang_rt.builtins-i386

#

not this shit again

dense steppe
calm latch
#

I'm trying to build 32 bit userspace

fiery turtle
#

can you make a normal 64-bit pmos build as well?

calm latch
#

Yeah

#

It shouldn't matter

north holly
#

Ok I think it works

fiery turtle
north holly
#

Idk

#

I'm on an old commit for uacpi

fiery turtle
#

which

north holly
#

I forgot

#

Wait

fiery turtle
#

can u do the pr head

north holly
#

I'm on my phone

north holly
calm latch
#

-- Compiler-RT supported architectures: nooo

#

Why is it so difficult to compile compiler-rt?

#

clang makes me want to go back to gcc

#

which is not the vibe

north holly
#

wat da shit

fiery turtle
#

wtf is going on

north holly
#

Page fault

fiery turtle
#

in the allocator?

north holly
#

Wait I think the IRQL is too high to handle page faults

#

Yup

north holly
#

I put a restriction on what IRQL you can page fault on

#

Because like swap n'shit

#

That might need to block

fiery turtle
#

why do u get a pf there

north holly
#

Demand paging

#

Using the non paged allocator should be the solution

fiery turtle
#

how did this work previously

#

did u never get ec events

north holly
#

I didn't get an irq during that ig

north holly
#

It's a timing issue

#

Or well

#

The irq is at the wrong time

fiery turtle
#

maybe its a regression and u arent supposed to get an irq at that time?

#

whats even the event

north holly
#

Beats me

#

Ok it works

fiery turtle
#

do u get ec events?

north holly
#

Whatever happened to the light on suspend

north holly
fiery turtle
#

how is literally everything breaking LULW

north holly
#

There is usually a light that's turned on at suspend

#

It doesn't turn on

dense steppe
#

at this rate there will be davix suspend before obos suspend works trl

north holly
#

But it's still in suspend

fiery turtle
#

did it wake up at least

north holly
#

Yes

fiery turtle
#

try ec events and see if that light not turning on repros

dense steppe
north holly
#

So it's fine

fiery turtle
north holly
#

Yes

fiery turtle
#

ah

#

im curious about ec as well

north holly
#

kk

fiery turtle
#

and also the ioapic fix so we can test on other pc

north holly
#

EC events worked

north holly
fiery turtle
#

ah

#

well once you're back

north holly
#

My laptop's EC events work

fiery turtle
#

like lid and stuff?

north holly
#

Yes

fiery turtle
#

ok thats nice at least

#

charger too?

north holly
#

Yes

fiery turtle
#

letsgo

#

im assuming u shutdown after wake so that worked as well?

north holly
#

Yes

#

Only thing untested is reboot

#

But whatever y'know

fiery turtle
#

ok cool at least this laptop didnt regress

north holly
#

Ye

hollow elm
fiery turtle
fiery turtle
fiery turtle
#

yeah this laptop doesnt care

calm latch
#

I think I won

north holly
#

What even happened?

calm latch
#

32 bit userspace broke kernel

north holly
#

Damn

#

Anyway uacpi thread message count is above obos' thread

calm latch
#

ok 32 bit userspace uACPI seems to be kinda working

#

I need to fix a pagefault

#

(fork is broken)

north holly
#

hey mishakov I'm bored, can you throw at me some random thing I could implement in my kernel that only takes a few hours

#

@calm latch

calm latch
#

idk

#

my estimations are always off

#

(is that the whole point?)

calm latch
north holly
#

no

#

(t yet)

#

but for that I'd need an i686-obos toolchain which I don't feel like doing

#

I recently added CMOS RTC support because I was bored

#

but no gettimeofday syscall to go with that

calm latch
#

then do that

#

idk

north holly
#

yeah

calm latch
#

@fiery turtle

#

@pine leaf ?

#

fork is broken but it shouldn't matter

pine leaf
#

yeah gimme a bit
I can test it later today

calm latch
#

btw what's your timezone?

pine leaf
#

GMT-7

calm latch
#

since ugh

#

Bruh it triple faults on my laptop

#

Which is something new

#

I think the last time I saw pmOS triple fault was a year ago...

#

@fiery turtle it only shuts down when I press enter in QEMU KEKW

calm latch
calm latch
#

EC + AMD GPIO

#

(like power button + lid)

#

And it shuts down in 3 seconds, as it should

frank canopy
#

took until literally now but i think i finally have an understanding in my brain of how to make my mm work so i can go back to acpi and drivers and actually fun things

fiery turtle
fiery turtle
calm latch
fiery turtle
calm latch
#

Lemmy double check

fiery turtle
#

how did u manage to have it regress on qemu but not real hw

calm latch
#
misha@Yoga:~/pmos/devicesd/uACPI$ git log
commit 199b625a347e8f91efad3ec6c7a2200903a24f01 (HEAD -> master, origin/address-spaces-support)
Author: Daniil Tatianin <[email protected]>
Date:   Sat Jan 25 00:17:39 2025 +0300

    stdlib: get rid of uacpi_popcount
#

Is this the right one?

fiery turtle
#

yup

calm latch
#

I think I've managed to catch the framebuffer bug/kernel panick in virtualbox...

fiery turtle
calm latch
fiery turtle
#

ok nice

#

why does 32-bit build die tho

calm latch
#

it works in qemu

#

probably gdt is messed up or something

#

[ OK ] Loded GDT

fiery turtle
#

lol

#

anyway looks like the pr should be good to merge then

#

@gentle peak if you're here maybe a final proxima test, since I've updated the PR since last time

#

especially curious about that laptop with legacy GPEs

#

because i added pre-mapping for GPE registers

fiery turtle
#

whats the opcode?

gentle peak
fiery turtle
#

npnp

#

not in a hurry anyway

calm latch
#

216001: c5 f8 77 vzeroupper

fiery turtle
fiery turtle
gentle peak
#

kernel and libc shouldn't belong in the same repo imo

calm latch
#

Yeah why is it broken on everything but my Zen 4 laptop...

fiery turtle
#

i guess

strong heath
#

I would like to thank infy for making me able to remove all copied libgcc code from Ironclad, not used for anything else but uacpi, with the latest commit in the dev branch

#

a toast for you infy

fiery turtle
#

lol thanks

fiery turtle
gentle peak
fiery turtle
gentle peak
#

yeah

fiery turtle
#

cool cool

#

thx for testing

strong heath
fiery turtle
#

i was worried for a sec

calm latch
gentle peak
#

interestingly, while i do still get the valz notify when pressing the power button, i don't get it when opening/closing the lid anymore

#

i don't install handlers for those events but i used to get them anyway

calm latch
fiery turtle
#

does it happen if you revert?

calm latch
#

only shuts down when I press enter

fiery turtle
#

(or maybe try rebooting as well)

calm latch
#

it was working fine before

loud ice
fiery turtle
calm latch
#

idk on old versions

#

like several months old

fiery turtle
#

of pmos?

strong heath
calm latch
#

maybe I did something in kernel

strong heath
#

since GNAT is GCC only for the time being

calm latch
fiery turtle
#

ah

loud ice
fiery turtle
#

what can it do other than calling the builtin tho?

strong heath
#

I rather just slap the C popcnt

#

which I dont have to do anymore!

gentle peak
fiery turtle
gentle peak
#

interestingly though, 1.0-rc seems to be a minor performance regression (very minor, 7.2-7.4M -> 7.0-7.2M on kvm)

fiery turtle
#

lemme take a look at your dump if u have that at all

gentle peak
#

it's on the acpidumps repo

fiery turtle
#

yeah i have it

loud ice
# loud ice fair enough
#[unsafe(no_mangle)]
extern "C" fn __popcountdi2(a: i64) -> i32 {
    a.count_ones() as i32
}
``` my shitty test os had it implemented like this lul
fiery turtle