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

1 messages · Page 36 of 1

gentle peak
#

nah i noticed this yesterday as well and that was before the builtin was replaced

#

fair enough

fiery turtle
#

popcount was only used in one place in code

#

and its not triggered by proxima

#

the toshiba laptop right?

gentle peak
#

yes

fiery turtle
gentle peak
#

can't test, threw away the laptop battery a while ago due to expansion

fiery turtle
#

ah right

calm latch
#

You can try testing pmOS ultrameme

gentle peak
#

searched in my message history a bit and it seems like on dec 26 i did still get lid events

#

so i'm downloading an image from ci from that day and testing with that

left orbit
#

god bless continuous integration

fiery turtle
#

for GPE 02

#

the one with this

left orbit
#

holy hell

fiery turtle
gentle peak
#

maybe i downloaded the wrong build but i'm not getting lid events on this either

#

oh wait nevermind i am

#

i apparently just wasn't patient enough?

fiery turtle
#

uhh

gentle peak
#

maybe that was the issue with the newer build too lol

fiery turtle
#

can you retry the newer one lmao

gentle peak
fiery turtle
#

this while is probably so slow it takes a while

#

ah

fiery turtle
fiery turtle
#

or maybe a polling interval of some sort

gentle peak
#

yeah i'm getting LID_(0x80), VALZ(0x8F), LID_(0x80) on latest proxima (with uacpi master)

#

testing 1.0-rc now

fiery turtle
#

letsgo

#

pls no regressions ffs BlessRNG

gentle peak
#

getting them on 1.0-rc too

fiery turtle
#

i guess u just had to wait a bit?

gentle peak
#

yeah

fiery turtle
#

ok nice

left orbit
#

least broken laptop firmware

fiery turtle
#

probably some timeout to prevent false positives

#

or debouncing

fiery turtle
gentle peak
#

yes

fiery turtle
#

does it work?

gentle peak
#

it does

fiery turtle
#

and shuts down fine and stuff

gentle peak
#

yeah perfectly fine

fiery turtle
#

ok phew

#

thanks for extensive testing

gentle peak
#

no problem

fiery turtle
#

alright, I guess thats it, im adding davix to the leaderboard and merging this PR

#

then pushing the 1.0 tag

gentle peak
#

testing pmos too for the fun of it

#

because this laptop had broken fb before on there

#

still broken unfortunately

#

power button works fine regardless though

fiery turtle
#

most stable microkernel

calm latch
#

The framebuffer driver is in userspace, so technically the kernel is indeed stable galaxybrain

fiery turtle
#

it did shutdown so i guess

fiery turtle
calm latch
#

Still, needing to press enter in VMs is weird

#

Does QEMU use keyboard controller for shutting down?

fiery turtle
#

no

calm latch
#

It works in all vms (including bochs) and tripple faults on my laptop

fiery turtle
#

uACPI 1.0 is finally LIVE LETSFUCKINGGOOOOOO

kind mantle
fiery turtle
#

the 1.0 leaderboard

jaunty fox
#

Congrats on the big 1

fiery turtle
kind mantle
#

So e.g. they'd send you ISOs and you run it.

torpid root
#

that needs a volunteer with a good cpu

fiery turtle
#

i have a shitty cpu that doesnt perform well, plus people want to track progress relative to their cpu and not the cpu that i have

kind mantle
fiery turtle
#

the top1 score is definitely not the best cpu on the list either lol

loud ice
#

i'm really curious what the difference between proxima and the rest is

torpid root
jaunty fox
loud ice
kind mantle
#

I would be willing to run benchmarks, my CPU isn't the most recent but it's decent. It's a Ryzen 5 5600.

loud ice
#

its. a very large margin

vast kestrel
#

A fast path allocator does wonders

fiery turtle
#

what can i say monkuous is really good at what they do

jaunty fox
fiery turtle
#

this score is with smp support

jaunty fox
#

Good grief

#

I'll have to add magazines to keyronex

left orbit
#

the allocator actually is really that fast

fiery turtle
#

ikr

vast kestrel
#

Like, I think we saw that with a lock in the alloc path it dropped dramatically

fiery turtle
#

monkuous profiled every function call and micro optimized it

hasty plinth
#

Congrats on the 1.0 🎉

fiery turtle
#

thanks a lot!

fiery turtle
kind mantle
jaunty fox
sterile egret
#

May you never go crazy and smash up an expensive sports car meme

fiery turtle
jaunty fox
flat badge
#

infy, are you also updating the Managarm bindings?

jaunty fox
#

It should be someone with decent statistical skill

fiery turtle
flat badge
#

wtf lol

fiery turtle
#

its like 30gb

gentle peak
flat badge
#

no, it's 3 gb

fiery turtle
#

is it

gentle peak
#

So there's a lot of inlining

flat badge
#

you don't need to build every package ;D

fiery turtle
#

maybe ill give it a try

jaunty fox
flat badge
#

by now we also have automatic pulling of deps, so you only need to do xbstrap install --rebuild managarm-kernel in an empty build dir (after setting up xbstrap correctly ofc)

jaunty fox
#

I don't use 03 they say it makes hash out of good code

left orbit
#

yeah inlining the entirety of the kernel into kmain certainly helps trl

fiery turtle
#

yeah lto is insane

gentle peak
#

With LTO the allocator's fast path is a few instructions that are inlined basically everywhere

gentle peak
#

Slab

flat badge
#

building Managarm with LTO doesn't make a huge difference

jaunty fox
#

With magazines?

flat badge
#

but Managarm doesn't have a lock free allocator fast path

gentle peak
#

No magazines, but it doesn't matter because the benchmark is done with -smp 1

jaunty fox
#

They do at least let locking be elided

fiery turtle
#

i think their mutexes are 8ns to acquire

#

so it doesnt matter

gentle peak
#

With magazines you can replace 2*cmpxchg with pushf+cli+sti

#

It'd probably improve perf a bit but I doubt it's that much

mortal yoke
#

pushf/cli/sti also affects the score decently if you do it in alloc fast path

flat badge
#

yeah

calm latch
#

pmOS is -O3 lto

gentle peak
#

cli/sti isn't that expensive right? Iirc they don't cause vmexits at least (unlike cr8)

flat badge
#

putting another pushf cli sti in the managarm syscall path gives a measurable performance drop in glxgears

gentle peak
#

Not because of the acquire itself but because of the memory ordering requirements

fiery turtle
#

ah

mortal yoke
fiery turtle
flat badge
#

no, the cli sti are expensive

fiery turtle
#

that might sleep on the mutex

gentle peak
loud ice
#

yeah cli/sti is pretty pricey

fiery turtle
gentle peak
#

An ACPI IRQ simply signals a semaphore which a softirq task is waiting on

fiery turtle
#

ah ok

vast kestrel
#

If you don't use the allocator from interrupt handler you can replace cli/sti with a preempt count

gentle peak
#

Good point

mortal yoke
fiery turtle
vast kestrel
#

(while still keeping the per core semantics obviously)

gentle peak
# fiery turtle ah ok

Before I switched to a softirq task I just statically allocated enough to have 256 things in flight at a time

vast kestrel
#

Yeah basically, if you get a preemption with the counter being non zero toy just return

#

And preempt manually at zero

fiery turtle
#

i see

vast kestrel
#

The cost is basically a per cpu count and an if at the decrement

fiery turtle
vast kestrel
#

Your slice is already up if it preempted in the middle

fiery turtle
#

but u dont know that

vast kestrel
#

You keep a mark

flat badge
#

the problem with preemption locks is that you probably don't want to acquire a spinlock while they are active though

vast kestrel
#

You increase the count, if a preemption interrupt happens toy mark it, and when decrementing and it's marked for preempt you preempt manually

#

Yeah

#

Preemption locks are obviously only for the per-cpu path

gentle peak
#

What I do for {enable,disable}_preempt:

  • Separate TASK_RUNNING and TASK_READY
  • On yield always set state to TASK_READY, even if preemption is disabled
  • When counter reaches 0 and state isn't TASK_RUNNING, yield
mortal yoke
gentle peak
#

Popf isn't used though

#

Pushf is, but it's popped into a regular register

#

At least usually

jaunty fox
#

In keyronex can do an ipl raise instead

gentle peak
#

Unless you do lazy IPL that has to write to cr8 which causes a vmexit

fiery turtle
jaunty fox
#

It won't be reflected with a cr8 write unless an interrupt arrives while ipl raised

gentle peak
#

That's even worse

vast kestrel
#

Cr8 is a bit more expensive than cli/sti iirc

fiery turtle
#

not a bit

gentle peak
#

Oh ok lazy ipl helps a lot with that yeah

fiery turtle
#

like a ton

vast kestrel
#

Ignoring vmexit

fiery turtle
#

in vms

gentle peak
mortal yoke
jaunty fox
#

If one does, cr8 is written and interrupt left unhandled for later

fiery turtle
mortal yoke
#

then you are going to get the irq again

fiery turtle
#

hmm

gentle peak
#

Level triggered IRQs + IRQs are already so expensive you might as well write cr8 and avoid further IRQs

fiery turtle
#

fair ig

#

in kvm at least it shouldnt be expensive

#

with irqfd or wahtever

flat badge
#

you could also just set the IF bit in the interrupted context

#

no need to write cr8

fiery turtle
#

who would unset it tho

gentle peak
#

Then you can't receive higher priority interrupts

fiery turtle
#

and that yeah

mortal yoke
#

I wonder why wouldn't they use the vmx tpr virtualization if its supported tho

flat badge
mortal yoke
#

that would avoid vm exits on cr8 writes/reads afaik

fiery turtle
#

i wonder why that needs a vmexit in the first place

#

why cant that be emulated by the virtual irq chip

jaunty fox
#

It shouldn't with vTPR or whatever Iots called now but unfortunately it seems that's not exploited

fiery turtle
#

i guess because its not a priority for kvm

#

since linux or bsds dont use cr8

#

and nt has lazy cr8 probably

flat badge
#

it's not clear that these strategies are worth it though

fiery turtle
#

which

flat badge
#

lazy IF / CR8 update

#

in contrast to just cli / sti

gentle peak
#

I doubt lazy IF update is worth it

flat badge
#

sure, they will improve the uacpi benchmark but they pessimize workloads that actually use interrupts

fiery turtle
#

its just a different system

gentle peak
#

CR8 probably because the only reason to use cr8 is because you want interrupt priority for other reasons

fiery turtle
#

cr8 vs cli/sti is like an entirely different approach

#

its not about perf i think

flat badge
#

lazy IF update is strictly superior to lazy CR8 update in terms of throughput

gentle peak
#

Yeah but lazy IF update doesn't preserve the priority stuff

fiery turtle
#

yeah

#

u use cr8 if u want to have interrupt priorities

gentle peak
#

From what I've seen the interrupt priority stuff is rarely done for performance reasons

fiery turtle
#

and masking of some interrupts at some ipls

#

yup

#

and cli/sti is better for uacpi benchmark too

gentle peak
#

Honestly the best part of uacpi 1.0 is that i can finally remove __popcountdi2.S

fiery turtle
#

ikr

flat badge
#

I'm aware that there are other uses of CR8

#

i'm only talking about the optimization here

fiery turtle
#

nah its not a superior approach for perf

gentle peak
#

Oh yeah for optimization it's definitely not worth it over just plain cli/sti

fiery turtle
#

i dont think there was an argument for that

flat badge
#

well, it is definitely faster in the uacpi benchmark

fiery turtle
#

why?

#

monkuous doesnt do cr8 i think?

flat badge
#

because cli / sti have a real (and non-negligible) cost while lazy IF=0 has no extra cost if there is no interrupt

#

and there are no (or very little) interrupts during namespace initialization

fiery turtle
#

during load u mean, yeah

#

on real hw you might get a few

gentle peak
#

I just stubbed out save_disable_irq and restore_irq (so no cli/sti at all during uACPI benchmark), performance is still ~within the same range

vale isle
#

why does cli / sti have a cost? is it that "sti doesn't apply until the next instruction is done executing" thing?

gentle peak
#

Except the ones that are absolutely required to

#

So it's not called particularly often

flat badge
#

for example, just inserting an irq lock + unlock into Managarm's syscall path is way more impactful than disabling LTO

#

not for the uacpi benchmark ofc but for performance in userspace benchmarks

gentle peak
#

I haven't used the profiler in a while but the last time I did, during the entire uacpi benchmark, save_disable_irq and restore_irq were called a grand total of 4 times each

#

Compared to for example mutex_lock (17k) and kalloc (10k)

flat badge
#

how do you protect against IRQs that interrupt a spinlock?

gentle peak
#

Spinlocks always disable IRQs, I just don't use spinlocks if I can avoid them

fiery turtle
flat badge
#

how does the 17k mutex_lock operations match with 4 cli then?

gentle peak
#

Mutexes don't disable IRQs unless they're contended

#

In the uncontended path lock and unlock are both just one cmpxchg

#

And given how early uacpi is initialized, if they're contended at all it's a bug and deadlock

flat badge
#

so what happens if CPU1 does mutex_lock (uncontended), then CPU2 locks (contended) and CPU1 receives an IRQ?

vagrant hull
#

congrats on the 1.0 lol

fiery turtle
gentle peak
#

Eventually CPU1 will get back into the critical section and unlock it

#

Same way userspace mutexes work at all

north holly
#

Ryurjr7dkryd

flat badge
#

so the task on CPU2 will sleep in this case?

north holly
gentle peak
#

Yeah

north holly
#

1.0 released

flat badge
#

ah

gentle peak
#

If mutex_lock is called while contended, the mutex state is updated to reflect that, and the thread sleeps on the mutex

#

Then in mutex_unlock it tries to cmpxchg the locked-uncontended state to unlocked, and if that fails it must be contended and it wakes up one of the sleeping threads

flat badge
#

yeah i get how the mechanism works i didn't think of this though

fiery turtle
#

yeah pretty smart

flat badge
#

also because we do quite a bit of work in contexts where we can't sleep

fiery turtle
#

monkuous is just huge brained

flat badge
#

you can only do this operation if all work happens on threads though

#

i.e., you need one stack per concurrent unit of work

#

which doesn't apply to us

fiery turtle
#

yeah with fibers this wont work

gentle peak
#

Ah you have stackless coroutines in kernel?

flat badge
#

yes

gentle peak
#

That'd make this more complicated yeah

fiery turtle
#

yeah managarm does all uacpi work in fibers too

#

get_thread_id is implemented as currentFiber() iirc

flat badge
#

fibers in the kernel do have their own stack though

#

but some stuff is done on work queues that don't have their own stack

#

but even on your kernel, this approach has the same performance characteristics than locking a spinlock with preempt disabled (but IRQs on), right?

#

in particular, CPU2 in my example will pay at least the latency of the IRQ on CPU1

#

in reality, it will pay more since a task switch is more expensive than spinning

gentle peak
#

It does

#

But the same performance characteristics apply to mutexes and spinlocks in userspace

#

Or well I suppose the spinlocks are a bit better in kernel because you can avoid the IRQ latency

#

Hm

#

I should test this once I've got a more active userspace

#

Anyway the general consensus for userspace mutex vs spinlocks is that it's not worth optimizing for the heavily contended case

flat badge
#

your strategy is probably good for workloads where you always have enough tasks to run on all cpus

gentle peak
#

Yeah I tend not to consider multi-CPU workloads beyond "does it work"

#

Hydrogen is intended to be a single-CPU kernel with multi-CPU functional but not super great

gentle peak
#

If you want to have a good multi-CPU kernel your scheduler will get very complicated very quickly due to hyperthreading and heterogenous CPUs

#

I didn't want to deal with that, and I decided that if I was gonna half-ass multi-CPU support in the scheduler I wasn't gonna focus on good multi-CPU support in other areas either

fiery turtle
#

hm

leaden fox
gentle peak
#

If you have two CPU-intensive threads you have to take care not to schedule them on the same physical CPU

#

Otherwise you will have terrible performance

leaden fox
#

oh yeah

#

makes sense

frank canopy
#

or at least the wdk headers I have irql as macros that set cr8 directly

calm latch
#

(which is how I use cr8)

torpid root
#

uACPI updates are showing me how much I suck

#

every new pull breaks the kernel

fiery turtle
#

breaks how?

torpid root
#

page fault

#

invalid opcode

fiery turtle
#

bruh

#

lol

torpid root
#

gpf

fiery turtle
#

how 💀

torpid root
#

idk
the current one just switches between pf and inv opcode

fiery turtle
#

which opcode even

torpid root
#

idk neither addr2line nor objdump shows anything at rip

#

stack trace doesn't work

fiery turtle
fiery turtle
torpid root
#

yeah I'm not in the mood for debugging

#

why do I even do this

#

I'll go play factorio

fiery turtle
#

lol

torpid root
#

congrats on v1 btw
uacpi in linux 2025 letsgo

fiery turtle
#

thanks!

slim panther
#

is v1 out yet?

slim panther
#

LETS GO letsgo

slim panther
#

we shall be implementing

strong heath
#

@fiery turtle I have upstreamed support if you want to add Ironclad now

fiery turtle
#

Nice

#

Can you give me ops/s, short description and cpu?

strong heath
#

actually dont add it, the ops/s are too slow for now and its going to look like shit

#

ill optimize it and give them to you

fiery turtle
#

Lmfao

#

Sure sure

strong heath
#

I have self respect

fiery turtle
#

Its an Ada kernel so I think its fair

#

Reactos is also in that neighbourhood I think

strong heath
#

I can speed it up a lot ill just do so

fiery turtle
#

Sure

strong heath
#

what does CR: not found mean

#

and why does it error because of it

#

im scared infy

fiery turtle
#

context?

north holly
#

did ironclad have acpi before this

strong heath
#

I did some myself

#

but it did not have a formal AML interpreter

strong heath
# fiery turtle context?
(0000000007) unable to attach (PCI_Config) operation region \_SB_.PC00.THC0.TH  
(0000000007) CR: not found                                                      
(0000000007) aborting table load due to previous error: not found               
(0000000007)     #0 in \()                                                      
fiery turtle
#

CR: not found is a bug in your logging probably

#

its probably THCR: not found

strong heath
#

oh no the new line is expected

#

sorry I forgot that I am splitting them

#

yeah its THCR not found

fiery turtle
#

this means you returned NOT_FOUND from your pci_device_open

strong heath
#

I see, but I am not... I will check it out

#

thanks

fiery turtle
#

is this qemu?

strong heath
#

nah this is real hardware

fiery turtle
#

ah ok

strong heath
#

its a decently new intel board

fiery turtle
#

yeah no i just checked

#

thats the only way how this is possible

strong heath
#

thats the only error though so thats encouraging

fiery turtle
#

well considering it aborted the entire table load due to it

#

or maybe it was one of the SSDTs, since u didnt paste the entire log idk

strong heath
#

nah its the DSDT

fiery turtle
#

i mean

+   function PCI_Device_Open
+      (Address : PCI_Address;
+       Handle  : out System.Address) return Status
+   is
+      Ret     : constant uACPI_PCI_Acc := new uACPI_PCI;
+      Success : Boolean;
+   begin
+      Arch.PCI.Search_Device
+         (Bus     => Address.Bus,
+          Slot    => Address.Device,
+          Func    => Address.Func,
+          Result  => Ret.Dev,
+          Success => Success);
+      if Success then
+         Handle := C3.To_Address (C3.Object_Pointer (Ret));
+         return Status_OK;
+      else
+         Handle := System.Null_Address;
+         return Status_Not_Found;
+      end if;
+   end PCI_Device_Open;
#

u do return not found here

strong heath
#

yeah I do, it is not coming from nowhere

fiery turtle
#

can u send the dump btw?

strong heath
#

ill do when I can

fiery turtle
#

sure

strong heath
#

I gotta sort some other stuff right now that should let me debug it easier

fiery turtle
#

btw your github mirror is severely outdated

strong heath
#

yeah it is, thank you

fiery turtle
strong heath
#

I was fixing another thing, ill let you know when I get around debugging that

rustic compass
#

does uacpi support acpi 1.1? asking for a friend

fiery turtle
#

It supports acpi 6.5

#

What are you asking about specifically tho

rustic compass
#

i'm thinking about buying a am2 board with an athlon 64X2

#

and i would like to test uacpi sometime in the future on that

fiery turtle
#

uacpi should work on any piece of hw

#

and id be curious to see some of the old more fucked up aml

slow drift
winter orbit
#

i just got a pentium 3

#

that has an ACPI EC

#

i cant wait to dump it

fiery turtle
#

Damn

fiery turtle
#

But yeah 2009 is pretty old

leaden fox
slow drift
#

is there any image (OS) that I can test uACPI with on that notebook? I haven't ported uACPI to my kernel and even if I did, I'd have to write some proper tests...

#

I mean there are a bunch but like a non-cursed one

left orbit
#

managarm, pmOS, proxima, astral

north holly
#

obos trl

gentle peak
#

Is it 64 bit?

north holly
slow drift
slow drift
calm latch
#

this is a semi-recent build

slow drift
#

yeah it's 64-bit

slow drift
#

for whatever reason it just shows a black screen - no Limine menu
I've previously booted Limine with no issues on this laptop so idk what's up
also on my PC it boots fine so it isn't an issue with the bootable media

#

the ISO supports legacy BIOS, right?

calm latch
#

It should

#

I've booted it on bios-only PCs

slow drift
#

weird

calm latch
#

From USB drive

#

I've just changed my build system to generate a hard disk image instead

gentle peak
#

i had to put it in uefi mode to even get to limine

calm latch
#

I can upload it when I come home

vagrant hull
#

check how you build it and see if it is like the template

#

worth noting that a bunch of legacy BIOS systems won't boot GPT partitioned devices in legacy CSM mode but that's usually only if they know what a GPT is

slow drift
#

it doesn't have UEFI or CSM support, it's a BIOS system, so most likely it's an issue with the ISO

#

managarm does a thor panic related to AHCI or sth, so I couldn't test uACPI FeelsBadMan

#

but Limine does boot, no issues on that

fiery turtle
#

Obos time

#

Or proxima

slow drift
#

yeah but I've got to sleep rn

#

so I'll test tomorrow morning

fiery turtle
#

Gn

slow drift
#

ty

calm latch
#

I'm too dumb for this, how do I install limine onto the image?

vagrant hull
#

did you run limine bios-install on it?

#

also you said it was a hard disk image?

calm latch
#

where do i get limine?

left orbit
#

either v8.x-branch or compile it yourself

#

binary branch i think

#

sorry

#

v8.x-binary is the branch name

#

if you get that you can run make to build the host limine tool

calm latch
# vagrant hull did you run `limine bios-install` on it?

I was running xorriso -as mkisofs -b boot/limine/limine-bios-cd.bin -no-emul-boot -boot-load-size 4 -boot-info-table --efi-boot boot/limine/limine-uefi-cd.bin -efi-boot-part --efi-boot-image --protective-msdos-label isodir -o $(ISO)

gentle peak
#

if you only do that, the iso's only bootable on bios if you're actually booting from a cd (or if you have a weird bios)

#

limine bios-install is necessary to make it bootable from a usb as well

calm latch
#

Does this look right?

limine/limine bios-install pmos.img
Physical block size of 512 bytes.
Installing to GPT. Logical block size of 512 bytes.
Secondary header at LBA 0x3ffff.
Secondary header valid.
GPT partition NOT specified. Attempting GPT embedding.
New maximum count of partition entries: 44.
Stage 2 to be located at 0x1a00 and 0x7ffd600.
Reminder: Remember to copy the limine-bios.sys file in either
          the root, /boot, /limine, or /boot/limine directories of
          one of the partitions on the device, or boot will fail!
Limine BIOS stages installed successfully!
#

(I mean I can just try it...)

gentle peak
#

seems fine yeah

vagrant hull
#

i mean assuming pmos.img is the previously created iso, yes

calm latch
#

It seems to have created a bunch of GPT entries...

left orbit
#

GPT partition NOT specified. Attempting GPT embedding.

#

limine embeds itself in the GPT

vagrant hull
#

you need to respect the size of the partition table

#

you're likely reading past the end of it

calm latch
vagrant hull
#

lol

calm latch
#

it's probably wrong*

#

I am supposedly respecting the size

#

Which booted in QEMU with bios

#

bruh my wifi is so bad it can't push the commit over ssh

#

I'm doing this ```C++
struct GPTHeader {
uint8_t signature[8];
uint32_t revision;
uint32_t header_size;
uint32_t header_crc32;
uint32_t reserved;
uint64_t current_lba;
uint64_t backup_lba;
uint64_t first_usable_lba;
uint64_t last_usable_lba;
uint8_t disk_guid[16];
uint64_t partition_entry_lba;
uint32_t num_partition_entries;
uint32_t partition_entry_size;
uint32_t partition_entry_array_crc32;
};

// ... read gpt
auto gpt_entry_size = gpt->partition_entry_size;
auto gpt_entry_count = gpt->num_partition_entries;
auto gpt_partition_array_size = gpt_entry_size * gpt_entry_count;

// ... read gpt array

std::vectorDisk::Partition partitions;
for (size_t offset = 0; offset < gpt_partition_array_size; offset += gpt_entry_size) {
auto *entry = reinterpret_cast<GPTPartitionEntry *>(reinterpret_cast<char *>(gpt_ptr) + offset);
if (guid_zero(entry->type_guid))
continue;

std::string guid = guid_to_string(entry->type_guid);
printf("GPT partition: type %s, start %" PRIu64 ", end %" PRIu64 "\n", guid.c_str(),
        entry->first_lba, entry->last_lba);
partitions.push_back({entry->first_lba, entry->last_lba});

}

calm latch
#
./partitions.hh:42:15: error: static assertion failed due to requirement 'sizeof(GPTHeader) == 92'
   42 | static_assert(sizeof(GPTHeader) == 92);
      |               ^~~~~~~~~~~~~~~~~~~~~~~
vagrant hull
#

num_partition_entries

calm latch
vagrant hull
#

yeah

calm latch
#

shouldn't it be 2?

#

I don't get it

vagrant hull
#

why should it be 2?

calm latch
#

I'm creating 2 partitions

#

am I looking at wrong field?

vagrant hull
#

it's the number of partition entries the table holds

#

free or non-free

#

44 means there are 44 available slots

calm latch
#

why am I reading past the table though

vagrant hull
#

idk, i am just assuming you are if you're reading garbage data

#

GPT isn't hard

#

you can easily figure it out with wikipedia alone, really

#

it's way more than enough

calm latch
#

I'm reading that stuff from entries 0, 1, 2, 3, 4, 8, 9

#

Maybe my AHCI driver is reading bogus data

#

And entries 8 and 9 contain the right data....

#

Which are lba_size * 2 Thonk

#

(my theory is that my driver is ignoring the start sector and reading from 0)

frank canopy
#

uacpi feature request (not a huge deal but might be nice): let me have (by a define probably) a separate alloc function for smallish object allocations compared to larger or variable size allocations

north holly
#
if (sz < some dumb size)
    do shit one
else
    do other shit```
#

is your solution

frank canopy
#

ig

#

i was thinking more for possibly pooling some of the structs vs variable sized stuff

#

but that would probably take a lot more work to add

#

maybe im just used to zig and passing around allocators lol

#

like it also might be cool to have support for an arena for if theres a lot of short-lived allocations during init or whatever

left orbit
#

just do it in ur alloc function

frank canopy
#

yeah ig

slow drift
calm latch
#

Even EC works, nice

slow drift
#

yep

vast kestrel
fiery turtle
#

daamn

fiery turtle
calm latch
#

I can try porting pmOS real quick ultrameme

vale isle
#

fastest port in the west??

strong heath
# fiery turtle Did you figure it out?

So far all I have found out is that uacpi is asking to find a device going by (segment, bus, device, func) (0. 0. 0x10, 0x6), both Ironclad and Linux do not find such device

#

you will have my acpi dump on your dms shortly

fiery turtle
#

Some hw checks non existent devices and then checks if VDID == FFFF

#

but ill take a look

#

So tldr you must support that

strong heath
#

so what should I return in my bindings for those cases, should I check that, and if it is true, report a fake device?

fiery turtle
#

Make a fake device object that just reads at the correct place where that device would've been

strong heath
#

thats very stupid

north holly
#

Stupid hardware

fiery turtle
#

That's aml for you

fiery turtle
#

But Linux just does what I suggested first

#

Aka it uses the raw pci helpers

strong heath
#

yeah that fixed it

#

very stupid

fiery turtle
#

@strong heath lol i was right

Device (THC0)
{
    Name (_ADR, 0x00100006)  // _ADR: Address
    Name (RSTL, Zero)
    OperationRegion (THCR, PCI_Config, Zero, 0x0100)
    Field (THCR, ByteAcc, NoLock, Preserve)
    {
        VDID,   32
    }

    If ((VDID != 0xFFFFFFFF))
    {
#

it basically creates the body of the device only if its actually present

#

otherwise the body is skipped

hollow elm
#

amazing

fiery turtle
#

least cursed aml

#

maybe i should add a comment about it to pci_open

deft canopy
#

@fiery turtle

fiery turtle
#

nice

#

how old are these

#

oh wait damn this is itanium

#

daamn GPE blocks live in system memory on it

#

its not hardware reduced acpi

#
[0ACh 0172 00Ch]          PM1A Control Block : [Generic Address Structure]
[0ACh 0172 001h]                    Space ID : 00 [SystemMemory]
[0ADh 0173 001h]                   Bit Width : 10
[0AEh 0174 001h]                  Bit Offset : 00
[0AFh 0175 001h]        Encoded Access Width : 00 [Undefined/Legacy]
[0B0h 0176 008h]                     Address : 00000000FF5C100C
#
Method (_PTS, 1, NotSerialized)  // _PTS: Prepare To Sleep
{
    Debug = Arg0
}

lol

north holly
#

lol

#

most sane AML blob

fiery turtle
#

Huh

[094h 0148 00Ch]            PM1A Event Block : [Generic Address Structure]
[094h 0148 001h]                    Space ID : 01 [SystemIO]
[095h 0149 001h]                   Bit Width : 10
[096h 0150 001h]                  Bit Offset : 00
[097h 0151 001h]        Encoded Access Width : 00 [Undefined/Legacy]
[098h 0152 008h]                     Address : 0000000000000400
#

SystemIO on itanium?

#

thats the only mention of SystemIO

❯ grep -rni 'SystemIO'
rx2800-i2/dbgp.dsl:27:[028h 0040 001h]                    Space ID : 01 [SystemIO]
rx2800-i2/facp.dsl:106:[094h 0148 001h]                    Space ID : 01 [SystemIO]
rx2800-i2/facp.dsl:120:[0ACh 0172 001h]                    Space ID : 01 [SystemIO]
rx2800-i2/facp.dsl:141:[0D0h 0208 001h]                    Space ID : 01 [SystemIO]
rx2800-i2/facp.dsl:148:[0DCh 0220 001h]                    Space ID : 01 [SystemIO]
rx2800-i2/spcr.dsl:27:[028h 0040 001h]                    Space ID : 01 [SystemIO]
#
Debug = "Dumping OpReg Info..."
Debug = " DSIX is: "
Debug = DSIX /* \DRBL.SET_.DSIX */
Debug = " DCIX is: "
Debug = DCIX /* \DRBL.SET_.DCIX */
Debug = " SVNP is: "
Debug = SVNP /* \DRBL.SET_.SVNP */
Debug = " DBLL is: "
Debug = DBLL /* \DRBL.SET_.DBLL */
Debug = "Storing DSIX"
DCIX = DSIX /* \DRBL.SET_.DSIX */
Debug = "Storing SVNP"
SVNP = One
Debug = "Storing DBLL"
DBLL = One
#

most production ready aml

#

lol take a look at this

#

its hilarious

#
[uACPI][TRACE] [AML DEBUG] String => "Init of scratch RAM complete!"
[uACPI][TRACE] [AML DEBUG] String => "Fatal Error: "
[uACPI][TRACE] [AML DEBUG] String => "_SB_._INI"
[uACPI][TRACE] [AML DEBUG] String => "SCRAM Data struct access init failed."
[uACPI][TRACE] [AML DEBUG] Integer => 0x00000003
Fatal firmware error: type: 1 code: 1 arg: 1
[uACPI][ERROR] loop time out after running for 3 seconds
[uACPI][ERROR] aborting method invocation due to previous error: hanging AML while loop
[uACPI][ERROR]     #0 in \CLIB.ERRR()
[uACPI][ERROR]     #1 in \_SB_.SBA0._INI()
#

it literally

#

calls Fatal

#

then hangs

While (Ones)
{
    Sleep (0x03E8)
}
#

are u insane

#

very cool to see anyway

#

server hw is built differently

north holly
#

I can tell KEKW

dense steppe
#

Sleep (COM3)?????

north holly
#

0x3e8 = 1000

vast kestrel
#

It has a method named strc that compares two strings

#

It has a mutex object it uses for protecting some communication buffer

#

It has a power button device and an acpi power source device (whatever that is)

#

I might be able to export it, not sure

fiery turtle
fiery turtle
vast kestrel
#

It's complex cause its a work machine

#

I can def test something on it, not sure I can bring stuff out of it

dense steppe
#

so I was looking through uACPI sources, and I found this:

#

Some kernels may want to use an in-kernel implementation of the rwmutex.

#

so... feature request (can make an issue on GitHub if you want me to): the ability to define a macro somewhere that tells uACPI to use an additional kernel API for rwmutexes.

fiery turtle
#

i mean sure that could be added ig, not sure how common that is tho

frank canopy
#

I will be having an rwlock in kernel idk about others

calm latch
#

I have full posix api in userspace so...

fiery turtle
#

barely anyone bothers reading about other existing uacpi options so im not sure its worth it

#

but ill think about it

deft canopy
fiery turtle
#

not many people even replace libc stuff

fiery turtle
vast kestrel
#

I mean, is the rwlock used that much and is implemented that differently

fiery turtle
#

basically yeah, its used once in uacpi for ns walks

#

and if your kernel has it, is it like much faster or

vast kestrel
#

Big brain, instead of mutex and event just take a futex like api :^)

dense steppe
# fiery turtle and if your kernel has it, is it like much faster or

It would really only replace (up to) two mutex acquisitions with one rwmutex acquisition (which can potentially be faster on high reader contention). It may in fact pessimise the writer (I find it hard to imagine an rwmutex writer acquisition being faster than a normal mutex acquisition).

dense steppe
fiery turtle
#

true

dense steppe
fiery turtle
deft canopy
fiery turtle
#

interesting

deft canopy
#

if you need to access the IO ports from outside of x86 mode then you need to map them into a 64KiB region of the address space or smth

#

but idk if you can map them if the x86 compat mode isn't implemented on the processor

fiery turtle
#

another reason why uacpi should have map api for ports

deft canopy
vast kestrel
sterile egret
slim panther
#

@fiery turtle wow

#

3.2mil on my weakest laptop since 1.0

#

(used to be ~1.5M)

fiery turtle
median crest
dusky glade
left orbit
#

does anyone have any insight into how uacpi uses memcpy/memset/memmove? i wonder if small copies are more dominant than bigger copies (>64 bytes)

#

i "wrote" (not exactly, with a little help of llvm meme) some very optimized memory operation routines and i wonder if uacpi will make good use of that

#

not sure how fast they are in practice, but on paper (according to IACA 3.0) they should be able to process roughly 5-7x more data than a naive memcpy/memmove imlpementation, so i hope my work is not gonna go to waste

loud ice
#

i think most of the impact is from clang recognizing memcpy/memset as an intrinsic

#

and not from it being extra fasts

left orbit
#

i hope this will at least speed up my allocator

#

when i have to copy/zero out big blocks of memory

#

but honestly this doesn't happen very often, so idk

#

maybe i am just overengineering it 😭

rustic compass
#

could be usefull on process creation when copying elf segments around

left orbit
#

yeah i am quite far from that

#

but it will maybe slightly speed up my prekernel, since i am loading the kernel and modules manually :^)

rustic compass
#

could you share the algorithm?

left orbit
#

i am basically doing 64, 32, then single byte copies

#

unrolling those loops apparently produces very fast code

#

it's like 200 lines of assembly compared to 10-20 but yeah

#

i also addiitonally prefetch the next 64 byte blocks using prefetcht1, idk if that has any significance but it's there for both 64- and 32-byte cases

#

and the bytewise copy is done using a jump table where each case falls through, so basically a duff's device

rustic compass
#

could be significant as the cpu can copy stuff around in cache and at the same time fetch from ram

left orbit
#

hopefully, the IACA analyzer shows significant throughput increase for my optimized version

#

also my naive versions were backend bound where this one is frontend bound

#

though tbf it was tested against skylake uarch so idk how well it compares to modern uarches

#

uICA (https://uica.uops.info/) doesn't seem to support anything newer and i cant be bothered to set up the tools myself

#

my memmove (as i said, i helped myself a little bit with LLVM) was actually unrolled into a 128 byte loop so there's a little discrepancy between that and the memcpy, and i was too lazy to go back and unroll my memcpy too lol

rustic compass
#

tbh its somewhat annoying that cpus dont feature buildin memcpy/set engines like programming a vector register and the cpu does it in the background

#

like a simd extension just for memcpy/set

torpid ferry
#

it's called rep movs/stos

#

arm now has that too

fresh laurel
#

good lord

#

my eyes hurt

north holly
#

Uacpi dead

fiery turtle
#

last commit yesterday

north holly
#

Uacpi thread dea

fiery turtle
#

and more like complete meme

calm latch
#

I'll try and test uACPI on my friend's Asus EEE 700 in a few days

fiery turtle
#

nice

north hull
#

I think the AML on my laptop is cursed

#

I get a good few errors with uacpi and acpica on linux too

urban galleon
#

where is the post for uDRM or the gpu thing

calm latch
fiery turtle
north hull
urban galleon
#

thanks

north holly
#

Infy when will you make a uDRM library

#

One that's actually worked on

fiery turtle
#

5 years

calm latch
#

After UltraOS gets Mesa? trl

fiery turtle
#

nah ill use one of the osses from here as the test bed

north holly
#

By then I would definitely have a mesa port

#

100%

fiery turtle
#

nah by 5 years i mean a usable library

left orbit
#

uacpi 1.0 out, can't wait for the ukernel :^)

kind mantle
#

uLibc when? troll

north hull
#

uboot when?

left orbit
slim panther
#

already exists

hollow elm
#

there's uclibc but i'm not aware of ulibc

slim panther
#

oh i probably mean that then

left orbit
#

\\\\

#

sorry my cat typed that

slim panther
#

\\\\\

hollow elm
#

\\<

vale isle
#

miaow

north hull
#

@fiery turtle

#

I dont get the wording on this

#

what is a successful wait

gentle peak
#

unsuccessful = timed out

#

oh and if the timeout is 0 you're supposed to do it without blocking at all

north hull
#

thats fine

#

wait so am I waiting for the counter to go to zero

#

and if it goes to zero before timeout its successfull

gentle peak
#

you're waiting for the counter to be non-zero

north hull
#

ah

gentle peak
#

if that happens before timeout, decrement it and return success

#

it's just a semaphore

north hull
#

@fiery turtle a bit late but here you go

left orbit
#

least fucked firmware

north hull
#

there's even some more that wraps the fb

north hull
frank canopy
#

ran into an issue finalizing my new MM stuff and hooking it into uacpi

#

that being that uacpi doesnt support sized unmap

fresh laurel
#

hey im thinking on using uACPI on my project

#

does it need an allocator or specific stuff?

vagrant hull
#

yes

#

it needs an allocator

frank canopy
#

theres a header, kernel_api.h. you need to define the things in there

fresh laurel
#

oh ok

#

i already have an allocator so i guess im done

#

it uses a page allocator right?

#

or its byte based

hollow elm
#

it needs more or less malloc/free

fresh laurel
#

well shi, my allocator is page based

#

i guess its fixing time

#

i could make a suballocator

#

that allocates more pages if there are not enough bytes

frank canopy
fresh laurel
#

yeah

#

i still need to make a new allocator

#

the bitmap allocator is kinda bad for efi memory maps

frank canopy
#

does uacpi need to do mallocs bigger than a 2M large page?

#

if so then fuck that but if not then my new mm can at least handle every allocation it needs

fiery turtle
fiery turtle
#

Does your linux dmesg look similar?

#

Although acpica would abort the entire table on first duplicate method

fiery turtle
fiery turtle
north hull
#

it throws less errors

#

but yes

#

its absolutely cooked

fiery turtle
#

yeah thats because acpica cant handle graceful skipping of some ops and aborts right away

#

idk what your firmware developers were smoking

#

do they not test at all

north hull
#

idk

#

lmao

fiery turtle
#

did u update your bios?

north hull
#

havent in a while

#

I probably should do that huh

fiery turtle
#

then again ive seen a person here who has multiple copies of the same SSDT in their pc

north hull
#

lmao'

fiery turtle
north hull
#

ill give that a shot

#

considering this is the main thing I use for testing

#

I'd like not to get blasted with errors every boot

#

lol

#

ah of course they ship bios updates as fucking windows executables

#

fuck

fiery turtle
#

💀

vale isle
#

I was browsing around in the coreboot docs as a girl does on a random friday

#

it looks like coreboot people have their own DSL for device trees that compiles to AML?

#

probably also compiles to FDT?

#

very interesting

#
device pci 15.0 on
    chip drivers/i2c/generic
        register "hid" = ""ELAN0000""
        register "desc" = ""ELAN Touchpad""
        register "irq" = "ACPI_IRQ_LEVEL_LOW(GPP_A21_IRQ)"
        register "detect" = "1"
        register "wake" = "GPE0_DW0_21"
        device i2c 15 on end
    end
end # I2C #0
Scope (\_SB.PCI0.I2C0)
{
    Device (D015)
    {
        Name (_HID, "ELAN0000")  // _HID: Hardware ID
        Name (_UID, Zero)  // _UID: Unique ID
        Name (_DDN, "ELAN Touchpad")  // _DDN: DOS Device Name
        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            Return (0x0F)
        }
        Name (_CRS, ResourceTemplate ()  // _CRS: Current Resource Settings
        {
            I2cSerialBusV2 (0x0015, ControllerInitiated, 400000,
                AddressingMode7Bit, "\\_SB.PCI0.I2C0",
                0x00, ResourceConsumer, , Exclusive, )
            Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, ,, )
            {
                0x0000002D,
            }
        })
        Name (_S0W, ACPI_DEVICE_SLEEP_D3_HOT)  // _S0W: S0 Device Wake State
        Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
        {
            0x15, // GPE #21
            0x03  // Sleep state S3
        })
    }
}
#

for acpidumps we could probably compile all mainline device trees in coreboot to AML

#

that would be lots of chromebooks

#

so this is a great source of production arm AML

#

probably pretty much all chromebooks out there

fiery turtle
#

damn i thought this was gonna be a unique feature for shkwve

sterile egret
frank canopy
#

ok yeah im just stupid apparently

fiery turtle
#

Lol

gentle peak
#

non-sized unmap would be horrible to deal with

frank canopy
#

yeah for whatever reason the zig export for it that ive got has never had a length param and ig last night i wasnt thinking enough to double check the header

#

i still gotta figure out why my new map thing does a safety-checked index out of bounds (which panics because im on a safe build mode) but thats a thing for later today

vagrant hull
#

i tested Ironclad on my laptop and trying to shutdown made it turn off the fans only but the laptop stayed on

#

and i had to force turn it off

#

i was scared it would overheat lol

#

i wonder if it's an Ironclad or uACPI issue

#

maybe missing EC handling or some crap?

fiery turtle
#

Pmos/obos/managarm

fiery turtle
fiery turtle
#

Anything in logs BTW

#

The fact that it stayed on tells me prepare to sleep probably failed

vagrant hull
#

i see

fiery turtle
vagrant hull
#

no

fiery turtle
#

That would explain it

#

Can u test the latest proxima ISO? It has no ec as well

vagrant hull
#

alright

gentle peak
#

don't use the latest one from github actions, that one's using a just-started kernel rewrite

fiery turtle
#

Wait

gentle peak
#

doesn't have uacpi yet

vagrant hull
#

this?

fiery turtle
#

A rewrite AGAIN?

gentle peak
#

yeah well the rewrite was kinda necessary considering i'm completely changing what i want the kernel/userspace boundary to look like

fiery turtle
#

it was going so well sunglass_cry

gentle peak
#

microkernel

fiery turtle
#

Nooo

#

Why BTW

vagrant hull
#

i love how it's always like "yeah just go dig in logs and determine which of the many arbitrarily thrown around ISOs from days ago is safe to test with"

gentle peak
#

wanted to be able to write drivers in funny languages like java and python

#

that's really the main reason

fiery turtle
#

Interesting

gentle peak
fiery turtle
#

Although proxima might not shutdown because your laptop probably routes the power button via ec so it just won't get the notif

vagrant hull
#

alright ty

#

it has a PS/2 keyboard

#

idk if that helps lol

fiery turtle
#

Is it a pc or a laptop

vagrant hull
#

laptop

#

but the keyboard is wired as PS/2

fiery turtle
#

Probably out of luck

#

Is it amd

vagrant hull
#

no

fiery turtle
#

Then its not routed via gpio at least

gentle peak
#

you never know

fiery turtle
#

True

gentle peak
fiery turtle
#

💀

mortal yoke
#

I mean probably not that bad

#

assuming you have a decent jit like v8

gentle peak
#

yeah probably

#

but then what if the mmap regions for libuacpi.so are backed by an ahci driver written in python

#

this is the kinda stuff i wanna experiment with

fiery turtle
#

💀💀

#

Maybe a separate os and keep this one intact

gentle peak
#

i thought of that but the old plan for proxima was Yet Another Monolithic Unix Clone and i realized that i would lose motivation to work on that extremely quickly

vagrant hull
#

i booted it, it says uncompressing init, then it doesn't say anything after that, then i press the power button, it says shutting down in 3/2/1, and it shuts down (i assume successfully)

fiery turtle
#

Does the laptop shutdown?

vagrant hull
#

yes

fiery turtle
#

Ironclad bug ig

gentle peak
vagrant hull
#

your thing wraps around right

#

then i guess so

#

it's just confusing lol

gentle peak
#

yeah

fiery turtle
#

Lol

vagrant hull
#

because the hello world is at the top

gentle peak
#

i guess it could wrap around if your laptop has a very large number of acpi tables

fiery turtle
#

I mean if it says shutdown in 3 it did init successfully

vagrant hull
#

it has a bunch of ACPI tables

gentle peak
#

this is the qemu output for that iso fwiw

fiery turtle
vagrant hull
#

btw for the curious it does 1.2M

fiery turtle
gentle peak
#

also side note i have no idea what happened because i changed literally nothing in the kernel (i've mostly been working on userspace) but a few days ago the uacpi performance spiked up from 7.0-7.2M to 7.5-7.6M

gentle peak
gentle peak
#

it's uacpi 1bd2930030ef819519de32dd1f7a8f999440308f

#

which is the first commit of 1.0

fiery turtle
#

Ok nice

frank canopy
#

ok time to start adding printfs to uacpi i guess, this is looking like a use-after-free of map/unmap stuff in early table access rn and i cant get my interrupt handler to give me the last few stack frames correctly sadly

fiery turtle
#

F

#

I wonder what ironclad does wrong on that laptop

#

Since its definitely not ec

frank canopy
#

...it also might help if i set the log level so my printfs actually get executed

fiery turtle
#

Your issue confused me since I read it right as I woke up and I was like wait it doesnt have a length?

gentle peak
fiery turtle
#

Indeed

gentle peak
#

gonna miss that

fiery turtle
#

That's why I want this ukernel to be a separate project

gentle peak
#

well it's not like i'm deleting the repo or something, right now the rewrite's a separate git branch and once it's mature enough i'll just rename main to pre-rewrite

fiery turtle
#

Is it gonna have full smp support btw

gentle peak
frank canopy
vale isle
fiery turtle
#

Lol

fiery turtle
vale isle
frank canopy
#

oh ok cool it isnt a bug in uacpi that im getting rn at least

#

its my own problem that i dont know where its coming from despair

#

but at least i managed to confirm it isnt trying to unmap the address it then page faults on

#

so back to my own thread for debugging hell ig

fiery turtle
#

Noo

#

Gl

frank canopy
#

if i comment this one line out and it fixes it im gonna be mad ngl

#

the line in question being the unmap-the-ptes line

#

it didnt \o/

fiery turtle
frank canopy
#

oh i bet i know it

frank canopy
#

ok so dump prints fine and debug prints fine and memcpy page faults accessing the header and i dont know why

#

tables.c L563

fiery turtle
#

well the header is the virtual address you have mapped right

#

whats the value of cr2

frank canopy
#

fffffc001ffff324 which is the thing that map returned

fiery turtle
#

so it gets unmapped somehow?

#

just run info tlb ig or whatever

dense steppe
#

does your memcpy return dst?

frank canopy
#

my memcpy is builtin_memcpy

dense steppe
#

throwback to a bug I had while integrating ACPICA into a previous kernel of mine. it failed because my (then nonconformant) memcpy impl didn't return dst

fiery turtle
#

that calls into normal mecmpy

frank canopy
dense steppe
#

and no compile error because the impl was in asm and C land used the builtin

frank canopy
fiery turtle
#

what if u disable your libc overrides entirely and let uacpi run with builtins

frank canopy
#

testing that now

#

same error exactly

fiery turtle
#

thats good ig

left orbit
#

fwiw my zig kernel used builtins and it worked fine

frank canopy
#

unless this is some compiler nonsense

left orbit
#

so that shouldn't be the problem here

frank canopy
#

i think it cached wrong gimme a sec

#

idk why it wouldnt have invalidated build cache on changing the headers tho

#

ok yeah same error using uacpi's version

#

in case anyone sees something im missing

#

ig ill put a debug after the memcpy call just in case its a different one somewhere idk

#

alright no i was wrong its a different memcpy call

#

ok it turns out it was this one on line 105

fiery turtle
#

btw why cant u just use gdb

frank canopy
#

i cant figure out how to get it to breakpoint in my code booting from limine

fiery turtle
#

disable kaslr

frank canopy
#

it isnt on gdb just refuses to let me put in the breakpoint

dense steppe
#

gdb + qemu is in general just goddamn awful to setup lol. been there, tried that, gave up and did hcf debugging instead

left orbit
#

you need hbreak with kvm

fiery turtle
#

with tcg it should work flawlessly

frank canopy
#

ig i can try again at some point

#

also with qemu+gdb being annoying i find printf stuff easier

#

oh GOD if this is the problem im gonna feel so dumb

calm latch
left orbit
#

i want to make one too...

frank canopy
#

turns out using max instead of min is a problem sometimes

#

i needed it to clear up to the first two of a thing with given length. put in max instead of min so it was overrunning when length was 1 and nuking the next pte along which was the rxsdt

fiery turtle
#

bruh

frank canopy
#

and it took me a while to find the issue because the table load was recursing to get the dsdt and that made me think the problem was later than it was

#

anyway now its getting past all the uacpi things and then i think dying in my code later

#

yep dying in my code now

#

so all good here

fiery turtle
#

nice

mortal yoke
north holly
#

Same

#

obos rewrite 6 microkernel

hallow marten
#

I'm already past my microkernel phase

#

it was in like 2022 for me

mortal yoke
#

I could theoretically still turn the nt thing to a microkernel because its that early but eh I don't think I want to do that

gentle peak
#

yeah the reason i didn't make the new proxima iteration a separate project is because it'd have been my 3rd one lmao

dense steppe
#

I haven't really understood what would make microkernels easier to develop than monolithic kernels.

like, sure, the 'kernel' is much smaller and doesn't have to contain IO or filesystem drivers, but you've still got to do that work somewhere, except now it is in userspace and your kernel needs an appropriate form of IPC.

gentle peak
#

it's not easier to develop

#

it is more fun imo

mortal yoke
#

also kinda forces you to have a decent driver interface lol

north holly
#

obos rewrite 6 will be an astral fork trl

left orbit
#

yeah splitting everything into smaller pieces doesn't make development easier but it does at the same time

gentle peak
#

it forces you to have good abstraction layers

left orbit
#

yeah

#

in a monolithic kernel you can just link any symbol and not give a fuck

gentle peak
#

with microkernels you can't make a quick hack that bypasses a bunch of abstraction and oops 100k loc later it's very tightly integrated

left orbit
#

but with a microkernel if you want some piece of information you need an api to get it out of the kernel

north holly
#

Hey kernel give me this shiy

#

Best microkernel abstraction there

gentle peak
#

except 'this shiy' is in a different userspace process and the kernel doesn't even know it exists or how to find it

dense steppe
#

currently I am writing a monolithic kernel, and I will continue with that until it is self-hosting and has actually good userspace. but there might come a day when I decide to rewrite (or atleast redesign core subsystems). I believe that I learn things about everything that I implement in every iteration that gives me the ability to make the next iteration better. and I believe this is mostly true regardless of whether you're writing a monolithic or a microkernel.

frank canopy
#

oh crap i forgot i set it to debug level to find that bug earlier

calm latch
left orbit
#

or that, yeah

#

you usually need some sort of protocol so processes can talk to each other

#

so i guess that's the abstraction

dense steppe
#

the thing with that is, you're still going to have to implement everything that you'd need to implement in a monolithic kernel.

#

tradeoffs

calm latch
#

the kernel just needs to have a good IPC interface

#

and some other things

#

i think minix does pmm and vmm in userspace

left orbit
#

yeah, all the kernel really needs is a way to create a thread, start executing user code and manipulate virtual memory

#

oh

#

interesting

left orbit
#

i prefer memory management in kernel though

calm latch
dense steppe
#

yeah but like... you don't have to write device drivers inside of the kernel... but if you want an OS, you're still going to have to write device drivers

calm latch
#

but you can write drivers in userspace

left orbit
#

yeah but the abstractions needed to write them wont write themselves

calm latch
#

which implies you can do cursed things

left orbit
#

and that generally determines the quality of everything

#

and how enjoyable writing new drivers is

hallow marten
#

a microkernel system is more complex and slower

calm latch
hallow marten
#

you can have a perfectly fine driver interface in the kernel

calm latch
#

and doesn't matter probably

dense steppe
#

with modern CPUs it doesn't matter tbh

gentle peak
jaunty fox
#

they don't have to be

kind mantle
jaunty fox
#

as we saw in #ipc message microkernels (or microkernel-like systems) were looking at these issues historically

hallow marten
#

the problem is constant context switches

#

and cache invalidation

jaunty fox
#

but microkernels have suffered probably from their unfortunate relegation to mostly embedded applications

#

and embedded people do not look at scalability

calm latch
#

you have pcids

gentle peak
#

I think they're talking about general cache invalidation, afaik the main issue with microkernels for that is that what would be syscalls on monolithic kernels often get processed by daemon threads running on different CPUs

dense steppe
#

if a microkernel achieves the same end result as a monolithic kernel, are they not one and the same thing? thonk

gentle peak
#

so the inputs and outputs of those 'syscalls' aren't in the cache for the server and the client

calm latch
#

I don't see it as an issue

gentle peak
#

yeah but most microkernels don't bother making sure that the server thread that accepts the message is running on the same cpu as the sender

calm latch
#

but it's an implementation issue

#

not the problem of microkernels

gentle peak
#

most microkernel problems are implementation issues yeah

jaunty fox