#uACPI - a portable and easy-to-integrate ACPI implementation
1 messages · Page 56 of 1
alright sounds good
thanks
lmao
oh wait i should change the error message for the pointer size thing
any pr is tiny compared to that one
very nice, this fixes a lot of code style issues basically
yeah, pretty cool
decided to make that the subject of the pr anyway since there is one owc-exclusive change (the __386__ one)
i'm diffing rdos's fork against upstream and wtf
at least change it in fucking config.h
fuck config.h amirit
god windows ci is so slow
yeah
bruh

alright i rebased test-runner-rewrite on top of watcom-c90
and made it compile in c89 mode
nice!
one thing that does leave a slightly bad taste in my mouth is that the resource tests will never get executed on owc because they're 64-bit only and owc is 32-bit only
like i'm sure it's fine since all the other test cases pass but i don't really like it
hmm true thats kinda unfortunate
the only thing gating it is pointer offsets i guess, which is annoying
and due to the pointer size being different the native blobs have different sizes in 32 bit mode
true
like i commented out the return; to see what would happen and even a bunch of resources without pointer offsets fail due to different sizes
makes sense
in any case, this is a delight to see in upstream gh actions
very cool
wtf
just some small pull request
hmm
Weird that I didn't get those on CI since it's supposed to be on max warning level with warnings as errors
They might be getting disabled by the options I added to disable unused parameter warnings
I should probably remove those and use uacpi_unused() instead
yeah i guess
right, when those ones are fixed you get the same for table_array_calloc, table_array_pop, and table_array_last
and i don't think UACPI_MAYBE_UNUSED can be implemented for owc
i could mark those inline as well but that's a bit ugly imo since they're in a .c file instead of a .h file
and they're not particularly small functions
owc does have unused warning suppression, but it's via pragmas so it'd have to be something like #define UACPI_MAYBE_UNUSED(decl) _Pragma("on (unreferenced)"); decl; _Pragma("off (unreferenced)");
that'd require refactoring every use of UACPI_MAYBE_UNUSED
bruh
tbf i just looked and uacpi_maybe_unused is only used in dynamic_array.h
so it wouldn't be a huge change
is this only for unused symbols or parameters?
maybe_unused is only used there iirc yeahy
uacpi_maybe_unused is only used for marking dynamic array functions as potentially unused
it's not used for parameters anywhere (which is good because with this change it wouldn't be possible to use it for that)
i could also see UACPI_NO_UNUSED_PARAMETER_WARNINGS_BEGIN being an issue, there's no separate pragma for parameters and the pragma in question isn't on a stack
so it'd conflict with UACPI_MAYBE_UNUSED(...)
oh and it seems like the pragma doesn't even work lol
unreferenced warnings are still being emitted even with the pragma
ffs lol
oh wait seems like there is a stack for it at least
not really useful given that the pragma appears to be a no-op, but still
i guess i could make UACPI_MAYBE_UNUSED expand to inline
it seems that's the only way to block unused warnings
lol
there's also #pragma warning <num> <level> but that can't be pushed/popped
Man supporting this compiler is such a chain around your neck
uACPI 4.0.0: deprecate openwatcom 
defining uacpi_maybe_unused as inline seems to work well enough
nice, left a small nit
fixed
once it's merged i'll rebase the ci pr on top of this so that i can get rid of the warning suppression options
yeah nice
@trim frost hey I have your PR noted, I'll add you to the leaderboard a bit later when im doing readme changes or other leaderboard additions (since i try to batch them)
keep it open, ill close myself later
@gentle peak i swear ill get to that pr, work has been a bit insane this week
dw about it lol
darkfire is taking a break from power managment
the haiku guy always disappears for a month after a bit of activity
whats the issue
but i thought rust was safe :(
no issue (well technically there is an issue as putting uacpi init on a thread makes the os hang in debug mode for some reason but i dont plan on doing that))
it's a bit concerning to run SMP that early lol
I still dislike the limine smp feature because u have to do SMP yourself anyway if you wanna support CPU hotplugging or suspend
also for e.g. large systems linux recently did a big upgrade which improved smp startup speed by a ton
so it can be a bottle neck for large systems
id rather do it myself in this case
wow the GitHub mobile app's review stuff is horrible
the mobile app is pretty crappy overall
you can't jump to the quoted code at all so all you get is the 3 or 4 lines of context
lmao
Apparently win32 doesnt have a way to sleep for less than a millisecond
event their STL does milliseconds for the C++ stdlib api i've been using
that's not really too surprising is it?
this can be quite unreliable
it is reliable if you use the api correctly
it's not for precise waits, but rather specifying the minimum amount of time you want to sleep
I mean the scheduler might not schedule you for a ms or two anyway
sure, who cares, it's an implementation detail
if it can tho, thats still better than making it not schedule the thread because it thinks it wanted to sleep for a ms instead of say 500 us
POSIX has nanosleep and they survived
Yeah it's annoying
Although in this case the microsecond_sleep is only used by kernel_stall, kernel_sleep, and some lock/wait-with-timeout emulation that would still work if the sleep period was 1 ms
I might just increase said sleep periods to 1 ms and make stall actually stall instead of sleep
Then I don't have to do the waitable timer BS
yeah I guess thats better, I was just too lazy to implement stalling initially
so i used the easy api
but now it doesnt exist
I think I addressed everything that can be addressed without changing code, I'll do the rest tomorrow
No it is not.
It's easier to make an SMP kernel from the start than a single processor kernel that's then upgraded to SMP
Pretty sure he meant the point within the init sequence, not within development
^
That's true
Yeah makes sense, thx
i meant a scheduler thread lmao
addressed all the comments
I mean, I basically setup memory management and then immediately start the scheduler and smp, and the rest runs from an init thread, and I initialize uacpi from there
i do memory management, uacpi early table access, interrupts, timing, scheduler, vfs, smp, uacpi proper
i've been thinking of implementing something similar
thanks, will take a look in a bit
does it detect recursive dependencies?
wdym by recursive dependencies?
The kernel will only run a step once all deps are done
what if there's a dependency of a step that has depedencies that accidentally depend on this step
this is how i handle that (i just started implementing an init task thing)
makes sense
Then it errors out before running anything
Cyclic deps are not allowed
it was because my dumass also moved lapic init to the thread
@gentle peak LGTM as far as contents, but i think the per-commit split is broken atm
how do u usually add changes to commits?
normally an interactive rebase to the commit i want to edit and change pick to edit
but in this case my split was broken in a different way that i tried to fix
i find that its easier to just do them on top of the last commit and name them as "fixup! <target-commit>" then just git rebase -i HEAD~N --autosquash and it automatically puts stuff where it needs to go
oo didn't know that existed
yeah it really helps with this sort of stuff
also you can make that a git fixup you can run with the changed added + an interactive thing using fzf where you can choose the target commit ```
[alias]
fixup = "!git log -n 50 --pretty=format:'%h %s' --no-merges | fzf | cut -c -7 | xargs -o git commit --fixup"
idr where I got this from but its nice
damn, no idea what fzf is but thats interesting
you get this kind of thing where you can select with arrow keys or mouse + enter to choose
ohh damn
is this in your .gitconfig thing?
yes
ill definitely try this
I found the site where I got that from, https://jordanelver.co.uk/blog/2020/06/04/fixing-commits-with-git-commit-fixup-and-git-rebase-autosquash
Fixing commits with git commit --fixup and git rebase --autosquash | Jordan Elver | Ruby on Rails Developer, Bristol, UK
alright fixed
ill be stealing this
didnt know autosquash could be on by default
my fingers hurt from typing it all the time
nice
alright merged

I hope that completes the OpenWatcom journey lol
almost 1k commits now
i hope so too lol, it's been interfering with my proxima momentum
yeah i saw that
"why do mutexes have timeouts" when aml literally exposes an acquire with timeout op
like he has been using acpica previously and it literally has the same api
has that never occured or something
Somehow the uACPI thread has 250k views on osdev forums
wtf
lol
vibe coding acpica
it's the only acpica maintainer doing it too
crazy stuff
rip out ACPICA from linux, replace with uACPI
unironically
ACPICA has been lost entirely now, there's no going back
lmao
I think I should try and implement that to see how it works...
he's right tho, you must use refcounting here unfortunately
Though it would have been more convenient if it was per thread
I don't know/haven't though much about how to do it globally
while unlikely, there might be multiple opregions in aml mapping the same io range
that is not the issue
How do you handle one thread mapping io port, and then other one using it?
u must synchronize the tss for all threads
I guess it's a similar issue to paging
Wait, does x86 look into TSS every time IO port is accessed?
u can do it lazily as well but u would need an instruction decoder in kernel lol
probably
IO instructions shouldn't be too difficult to decode
probably
I have that already for RISC-V 
why
For lazy FP/vector stuff
My kernel doesn't enable them for threads until they're used for the first time
Then it's eager
hm fair but probably still useless work
unless risc-v is not like x86 and compilers dont use sse unconditionally
Not that much work
They don't
Also vector extension has only been standardized very recently?
And on LoongArch it's undocumented and to be replaced
you need that for virtualization stuff too 
Though their exceptions are nicer
I guess I could allocate TSS per thread
But that's anoying
I guess I could use my TLB shootdowns mechanism
Or something similar
To make sure CPUs use the latest IO bitmap
Though it would be kinda annoying, since the scheduler would have to take locks and stuff...
Maybe I can make per-thread TSS conditional
Since it would only be used by drivers
microkernel problems 
tru
Just a couple more syscalls 
(I have too many of them)
Also, how does this work on ia32?
Doesn't this break disassembly?
Oh, it's the same
basically
are u saying u dont trust chatgpt slop to review PRs?
Have copilot create a pr and chatgpt review it
I think I'll just do conditional TSS and handles for IO port ranges
And slap a lock on that whole thing
The C++ and Rust abstractions should also be nice 
wtf, how??
is the timer just off by a factor or something??
no lol i was messing around with memcpy and other mem functions
how did you even manage to make it so slow??
not accidentally
lol
i actually tried spinlooping inside them but couldnt get it to work
crashes
so i did something else
I think emulating RISC-V and whatnot also gives very low scores
x86 emulation on the gameboy?
on my nonexistent toaster
What does vibe coding even mean
I’ve genuinely never used Ai for programming besides the intellisense which idek if that counts
it's when you just ask an llm to do everything for you
i have no idea why they call it "vibe coding"
rarted terminology
because you're vibing while someone something else codes
It was coined by a really corny tech bro tweet about how like "i feel so much more in touch with my program... im freed from the irrelevant little details that make programming so tedious... im just vibing with the big picture..." or something
isn't it a good idea to use appropriate caching modes for different mappings?
yea
may I ask why uacpi doesn't use it?
I think there was already discussion about it, but I can't find it
Iirc ACPI just doesn't give you that information?
ah
caching modes also differ heavily between different architectures, and ideally we would keep that away from the kernel interface
the one thing i would like to maybe have if possible actually is a way to differentiate temporary vs long-term mappings
just because of how my memory management works
Though on x86 you can probably just get away with mapping everything as cached, wt?
not a big deal to not have but would be nice
the lowest-hanging fruit that I see is a flag passed to uacpi_kernel_map_memory that tells it whether or not this is an ACPI table mapping
but even then you've got to modify the tables sometimes
basically the problem is AML just tells you: map this with this length
uacpi cant possibly know what the hell its mapping
it could be normal ram, or device memory
only the os can know by looking at the memory map and deciding based on that
thats what linux does with acpica mappings for example
yes
even the global lock is in FACS?
proxima does this :)
yep
I have to change pmOS to do this as well
it checks whether the range is fully occupied by ram and if so uses wb, if not uc
AML is also allowed to request table mappings via a special opcode
and write to them all it wants
The issue is that I don't have good abstractions for memory types across architectures
But like it's probably gonna be super important when I begin porting to ARM
i just use the x86 memory types and let each arch map them to whatever it uses
(I mean RISC-V is also probably broken)
with risc-v you should have PMA taking care of it for you
but i don't know whether that actually happens in practice
beware that these don't map one-to-one to e.g. arm
I've started with RISC-V types, and it didn't translate well to x86 types, so I just map all normal memory as cached, and everything else as UC
I think I'll have RAM, MMIO, DMA and framebuffer
i really want to get the FACS mapped somewhere separate so it doesnt stay long term in syspte space tbh. other than that i just map everything as writeback and it seems to work for now
yeah i might need to change them to intent flags (i.e. ram/mmio/framebuffer instead of wb/uc/wc)
(i rely on MTRRs to be set up correctly by the loader/bios)
i feel like dma memory being a separate memory type would get very annoying for zero-copy i/o (aka io directly into the page cache)
I'm pretty sure the FACS resides in normal RAM
There's two types of mmio
Strong and normal
Well technically more but
These should do it
what's the difference?
What's the difference?
just based on the semantics of the global lock
(specifically, iirc on x86 the MTRRs can prevent caching even if i say writeback for the cache type on the mapping)
Idk what to do then
oh neat. doesnt actually help my case here because the issue is fragmentation of a buffer of PTEs but still good to know
Aarch64 has ridiculously precise caching controls, some devices work with ngnre some require ngnrne iirc
Maybe I should just add flush caches syscall or something?
I do have zero copy
How do you know the difference then?
on sane platforms you just use fences and the platform takes care of it, on arm you need to run cache flushing instructions on the range iirc?
You just do
Its device specific
Its normal unless you know otherwise
E.g. most M1 devices require strong mmio
So the mapping syscall should take normal ram/mmio/strong mmio/framebuffer/guess argument?
Yea
I think I'll just do it per page, since my kernel maps everything lazily anyway
how does it know which one to use?
ah
(in this case ram includes acpi reclaimable and such regions)
(actual kernel-owned ram is not allowed to be accessed by acpi, and the kernel enforces this)
one more entry in my todo list
ok now i want to know why the debug info thinks uacpi_set_waking_vector is at address 0
lol
I have a couple of issues/suggestions: Physical memory mappings would be improved if the OS knows what the memory will be used for. For instance, ACPI tables should be mapped as read-only, while me...
part of me just wants to ignore him
let me just quickly disable semaphores 
What's the issue with having them in the first place?
cant he just admit his kernel is trash
Does he not have multithreading?
Like even if the kernel is complete trash, you can implement those in userspace
what a great os
yk how im always shitting on the forums boomers
me when I'm stupid
i 100% bet that this guy does not have the skills to write assembly that's faster than gcc
no idea tbh
i mean it makes sense that he says that because owcc doesn't seem to do any optimizations 
If I had to work with that compiler id be tempted to use asm instead too...
wonder if hes even aware of the concept of mapping a file into kernel space as demand-paged memory and doing cached io by memcpying through that window
which bypasses toooooons of layering machinery in the cached case
reduces it to a window lookup and copy
I can't imagine anyone reasonable would write page cache in asm honestly
some say you don't need to optimize the file-system since the disk drives are slow anyway
some say? who says that
the voices in his head
what a lot of people really say: you need to optimise BECAUSE the disk drives are slow
like the rest of his delusions
his buffer cache appears to be http://svn.rdos.se/rdos/trunk/kernel/fs/dev/vfsbuf.asm
bro what
this guy has been at it for over 20 years???
what is that copyright date
rdos is ancient
and no fucking acpi?????
appears to be what
a traditional buffer cache
wow this guy has actually lost the plot
he had acpica before i think
still
it might not be, i haven't looked in any depth
anyway his fat driver is written in c++ http://svn.rdos.se/rdos/trunk/kernel/fs/fat/

so i'm not sure why he slates C for filesystems so much if his in C++
i must outdo the 20 yr old boomer project in like 2 years
it's not that bad
why put the name in the fucking comment when it's right above the member it's documenting

Does he have SMP?
lmao
oof, he is back
btw I tested this again because I couldn't get it to work last time I tried it but now I got it to work on an alderlake igpu with these changes to qemu on top of the changes those patch introduced which are now upstreamed to make it set up the opregion for it even when its not the boot gpu as its not reported as vga compatible if its not + this https://github.com/tomitamoeko/VfioIgdPkg (with the other patch applied because of the same reason) + IntelGopDriver.efi extracted from a bios update (also needs a patch to nop out a check at 0xa3d when the igpu is not the primary boot gpu as it checks for the vga class)
now the real question is whether the shotplug register is broken with this, hopefully not
maybe upstream it as well?
there were some new patches i saw on the mailing list
about igd stuff i think
like literally today
looks like there is some typo fix + a patch to respect x-igd-opregion=off
yeah I should probably upstream these (though I can't really do anything about the IntelGopDriver patch except make a mention of it somewhere)
Redundancy
Because what if you document the wrong function with your comment
/j
good point
lol
also for tables you have basically no way of knowing which ones you can make read-only (except the ones that are defined by acpi as static tables you don't write to ig)
also aml might remap them and write to them if it wants to
via DataRegion or wahtever its called
how does an AML interpreter deal with self-modifying AML at all?
like it just sounds like a nightmare to wrap your head around
methods are stored in heap allocated buffers (at least in uacpi and nt) so its not possible
well it could technically modify the dsdt as it's being loaded
that would not go well
Have a template ssdt that patches and loads as required :^)
Also imagine deprecating Unload 😔
Can't have dynamic code loading/unloading smh
self modifying AML is not supported
AML has explicit opcodes that you could use to load code
at runtime
well, everything that is in AddressRangeACPI can be maped as r/o
The world is not ready for it 
Aml is ahead of its time
nah AML is just completely broken
Shh
bro just give up
Don't try with acpica instances near you 
aren't you supposed to write to the FACS at times? or is that not in addressrangeacpi?
seriously though, the main problem is that nobody designed AML in a consistent way
it's basically just Intel and Microsoft adding whatever adhoc stuff they needed to solve their next problem
It was designed by incompetent firmware devs, not language designers
it's object model is completely broken
the core VM is also completely broken
like, why are there 8 registers available
without any compiler support to do register allocation
that's just lazy AF
Or any non recursive bytecode with well defined semantics
jvm is one of the best
wasm as not a thing at that time but the jvm was
Shhhhh
The V stands for virtual machine
Yeah I'm not gonna reply, I'm really tired
Of this guy
he should learn how to code his kernel and apis properly

(and use a good compiler)
tell him that uacpi requires a mature kernel

This seems like the kind of person to think they know everything but actually not
mine is not mature but still works, lol
you just need to implement the apis
lol
i still need to add PCI tho
mine is damn near the slowest one on the leaderboard 
how fast?
I am a prophesshional kernle dev trust me (fr fr)
1.02M ops/s
The next up is 1.5M ops/s
that's still better than most
Uacpi-os was done in a weekend :^)
well, still better than Nyaux
The slowness was probably down to my mutexes, which I have re-worked since.
I'll measure again later but first I need to fix a lot of other stuf f
(and prob bc i am using PIT to measure the time too)
Well you see not by much
i hope to finish the scheduler soon
so i can add threads to uACPI
and then finish the APICs
@fiery ice can you try this one
k
that just uses the old bitmap allocator
if it doesn't work, the problem is somewhere else
btw did we end up settling on a standard way to test kernel performance for uACPI?
what's your memcpy and memset?
still GPF
lemme send the pic
it's a different RIP
do movsb
I don’t even think he knows any mnemonic besides mov
mov is turing complete
This is non arch-specific, I won't hardcode something like that
BadgerOS has both RISC-V and x86_64 support
make that a weak symbol and define memcpy/memset in x86_64 code
my mem things if you want
try with these
or just use phd memcpy from mammogram
mammogram
as if that memcpy was that complicated
what
it's just thinking about how it'd work in asm and then hacking C until it generates the desired asm :^)
that's not needed afaik
Managarm memcpy does misaligned access if the pointers are misaligned, mine doesn't. On RISC-V, misaligned access can be slow or even cause a trap.
^
uacpi points are x86_64 only
I know
Either way, though, I'm going to phinnish my device refactor first.
x86_64 probably won't boot before then
what do you do instead? fall back to single byte accesses?
If misaligned, yes, single-byte access. I don't bother measuring unaligned access speed on RISC-V yet.
i'm aware that Managarm's memcpy does this but i don't think it's a problem: unless misaligned accesses are implemented in software, doing the misaligned accesses will still be faster than single byte accesses. you're correct that RISC-V allows M mode to implement them in software and hence they can be very slow. however, a physical CPU that does implement them in SW will likely not be powerful enough to run Managarm anyway
SiFive FU740 SOC has no hardware misaligned access and it's definitely capable of booting Managarm provided the drivers appropriate work, which they didn't seem to last time.
are you sure that it has no hw misaligned access?
Yes. I read the datasheet.
I'm gonna get a 9950x3d soon and I'm gonna remove all leaderboard scores
Will do all tests on my desktop probably
ah, you're right
To remove that CPU column
tbh that surprises me
https://www.sifive.com/document-file/freedom-u740-c000-manual page 52 for anyone wondering.
yeah me too
That's why I remembered that in the first place
yeah in that case you have to do the check first and resort to single byte accesses or similar
There's probably slightly more optimal things possible but yeah
Like cursed bit shift memes
Will be faster on any RISC-V cpu larger than a literal microcontroller.
Well that's what we're avoiding in a memcpy routine
fwiw all rva profile implementations will need to support this going forward
Zicclsm Misaligned loads and stores to main memory regions with both the cacheability and coherence PMAs must be supported.
Good.
Trying to squeeze every penny to save
RISC-V really didn't put their foot down enough for profiles meant to be desktop or server or whatever chips.
that's true, but it sounds kinda annoying to implement
- the more conditions you need to test for the slower the fast path gets
It probably would be, but still faster than single-byte.
For large sizes at least.
unclear if it's worth it tbh
idk.lol
you can still do pipelining with single byte accesses
like, load ~16 bytes or so, store 16 bytes
Yeah but the memory ports can usually still do word-sized accesses.
sure but you need at least 3 instructions or so to do the shift
I love that we somehow went from an ACPI discussion to discussing how unaligned memcpy would be implemented on a CPU without HW misaligned access
#lounge2
true
"i don't keep that information" then either start keeping it or accept that you're mapping everything as rw and relying on mtrrs for caching
how is that our problem that his kernel is poorly designed
why even support acpi if you dont want power management
enumeration of devices yeah
He said he was using it for PCI interrupts routing
for discovering ioapics then or something? ig?
You don't need AML for that
yeah i know
thats why im confused
so far im only using AML support for device discovery/enumeration
He has issues with making a decent kernel
It’s dogshit
Like
Holy crap
Do not even look at his PR’s
Like , I know I’m not the best at it, but damn, rdos is cancer
@fiery turtle https://github.com/uACPI/uACPI/blob/master/include/uacpi/kernel_api.h#L358
when should scheduled work be executed?
"as soon as possible?"
i.e. as soon as interrupts are enabled AND the IPL is low (in my case)
yes
uacpi_status
uacpi_kernel_schedule_work (uacpi_work_type type, uacpi_work_handler fn, uacpi_handle ctx)
{
(void) type;
fn (ctx);
return UACPI_STATUS_OK;
}

XD
in any sane kernel, this doesn't work, for obvious reasons.
define sane kernel 
Something impossible is a good description
There’s no os kernel without some dogshit bits
Even Linux, its TTY is ATROCIOUS and its build system is… yeah.
WONTFIX
#if defined(__RDOS__)
return UACPI_STATUS_WONTFIX;
#endif
-EWONTFIX sounds like an errno
luckily i have this machinery already so easy
except that uacpi_kernel_schedule_work doesn't give me a DPC object to enqueue
which sucks
i need to dynamically allocate them or some shit
yeah
and i do not really want to allow memory allocation in interrupt unsafe regions
you can do the very valid solution which is to use threaded IRQs
what's that?
that's what I intend to do once I figure out how to do those
basically you do IRQ handling in a "normal" thread
My kernel does that
so switch to a separate "fake" interrupts thread when handling interrupts
for each processor
right?
I just create a thread for each interrupt, and when I get one, the thread gets woken up and dels with it
oh my
for each interrupt???
But they are normal threads
I mean not allocated during interrupt
like it should just be
- interrupt handler ("top half" in Linux parlance) is entered
- the handler disables the relevant IRQ line before unblocking a kernel thread and returning from the IRQ handler
- when the kernel thread has finished handling the IRQ, it enables the IRQ line and sleeps
okay, i should mention that my kernel allows you to enqueue DPCs during interrupt routines so that you have access to some more services than you normally do, in those DPCs
My kernel uses 1 stack per CPU
What.
Like no kernel stacks for threads
Threaded interrupts? That's new to me.
yeah but to do that you need free DPC blocks
How do system calls execute then
As normal
Do you just never preempt a thread if it's running a system call?
\approx you need malloc
Not necessarily
Like I don't switch stacks during task switches
my plan is to give each interrupt a preallocated DPC object to use
Just enqueue the same DPC
What's a DPC?
and re-setup the dpc each time
If it wasn't processed by the time a subsequent enqueue call is made then nothing happens
Deferred procedure call
deferred procedure call
ah
Basically it defers a procedure call to an interrupt safe context
isn't one of the uacpi_kernel_schedule_work()'s lost in that case?
runs at a lower IRQL and gets enqueued for whatever
Like actual notmal userspace threads created with pthread_create
Oh I was talking about what my kernel already does
With no strings attached
NT runs them at IRQL 2 (dispatch level), i think by scheduling a self-ipi but not sure
I was just gonna allocate a buncha structs ahead of time for uacpi_kernel_schedule_work
Depends on architecture I think
And use them with a spinlock for protection
@calm latch is this similar to what you've done?
my plan is to use a self-ipi for dpc scheduling which then gets hit once i drop out of the true ISR
Boron does it in software even on x86_64
It used to do a self IPI but I think it's slower
I should do a latency benchmark at some point
Yeah
but in userspace
Since my kernel only deals with timers
i can only imagine self-ipi is slower but it makes it real easy to handle the irql stuff
it is probably different in emulators vs bare metal
there are other ways to do this?
It's honestly not that hard the way I did it
yes
you check "are there any DPCs" before exiting the IRQ handler
Ok, I need to stop with ?
if there are, run them
it was supposed to be a statement, not a question
i initially had a system where the return from interrupt would drop to dispatch level and then check dpcs yeah
Basically, if the preempted IPL is < IPL DPC, then lower down to IPL DPC and see if you have any DPCs running, if so, then run them, and return from the interrupt handler
lol
The hardware interrupt "becomes" the DPC interrupt, so to speak
yeah
You can emulate irql and stuff afaik
Like you would ususally assume that the the kernel can be preempted
its not hard i just couldnt be bothered to implement a good way to handle checking preempted ipl stuff
But you can toggle a cpu-local variable, and if you get an interrupt, you just exit immediately as if there wasn't one in the first place
so self-ipi is easiest
I was thinking about making timers preempt my kernel
yeah.
but you do have to remember to enable interrupts and also ensure that the ppr is correct if you do priorities like that
when entering the hardware interrupt, before updating IPL to your new level and enabling interrupts, store the old one somewhere
(but I have too many things that I want to do)
Yes, interrupts are enabled for every hardware interrupt routine
So that a higher priority interrupt can preempt this one of course
https://github.com/dbstream/davix/blob/master/arch/x86/kernel/irql.cc I'm pretty sure this is where I do the "dispatch DPCs if there are any" stuff in my kernel
My kernel core (read: scheduler) is "preemptible" in the way that it can be interrupted by hardware
I guess it is also possible to instead enqueue a DPC, removing the need for a full-blown kernel thread
wait but even if you do this, how are you adding the DPC to the list? Do you just have some fixed-size list somewhere?
Linked list
Where do you get the memory for the links
There is a list of enqueued DPCs for each CPU
You're in an interrupt
The DPC struct
It's an intrusive linked list
So you mean yes, you do have a fixed size list, or a static allocation anyway.
this is kinda a "fake" IRQL system
It's not a fixed size list
It's a linked list
it's more similar to preempt_{disable,enable} really
https://github.com/iProgramMC/Boron/blob/master/boron/include/ke/dpc.h#L27 here is the thing that's added to the linked list representing the DPC queue
I mean static (or relatively static anyway) allocated
Actually a device driver can do whatever the hell it wants
its 23:37 i can misspeak ok?
As long as the memory the DPC is in is nonpaged it's fair game
00:37 here
lmao
It's fine
oh yea and I also do soft/lazy interrupt disabling, which is fun
we are good at sleeping 
thinking about it, one advantage of fully threaded IRQs is that you can now grab any lock whatsoever, e.g. a mutex, from the IRQ handler without fear of deadlocking against someone you've preempted
@dense steppe https://github.com/dbstream/davix/blob/master/kernel/dpc.cc#L51 why dont you typedef the function pointer
to raise the barrier of entry into understanding my kernel 
no but I probably should do that, actually.
definitely do look at arch/x86/kernel/irq.cc and arch/x86/include/asm/irql.h too
honestly I should abandon the IRQL parlance and just do dpc_{disable,enable} and irq_{disable,enable}
because this right now is just unnecessary and annoying
thinking about it even more, from the type of work uACPI can enqueue, it probably needs to run at thread level.
Linux just creates a new thread for it every time?
(my OS does as well since it was the easiest thing to do)
(for enqueue work callback)
dont open xnu source

Forth is would be less horrible than AML, yes
no, Linux has very nice workqueues for this sort of thing
and I should not do kernel design at 23:48 because the time probably contributed to me getting the interrupt handler and work scheduling mixed up.
my new motheboard prints ACPI-related codes at runtime, pretty cool
damn, debugging S3 should be nice
Does it let you write to 0x80 like my motherboard?
It's probably 0x80 display yeah
That's pretty cool for debugging gpu drivers lmao
Serial port is more convenient though
ofc, but its not a thing on my mobo
neat
nice
@fiery turtle do you think multi-cpu systems would be interesting to you?
i might be building a dual epyc testbench
u mean uacpi-wise? yeah any special hw is interesting
acpi dump appreciated :^)
and test some OSes from here
I'm building it mostly because numa is going to be interesting
and I've never owned a pc with more than one cpu xd
you can just emulate numa in qemu
free in fact
ebay really wants me to buy them
friday is paycheck day
wait aren't intel x99 xeons also dirt cheap
Which Epyc?
Because I think there were Epycs which give you 786 threads in one system?
not bad
Btw uACPI has surpassed Astral in github stars 

I have a Dell r730xd server lying around
nah it hasnt sped up really
its because of astral death lol
Still 208 stars and almost 250k forum views is like ... a lot
yeah im honestly confused why its that high
for example the FYSOS post from 2016 has less views
and somehow that didnt generate much traffic for the repo
yeah idk
dunno
vogons huh
no idea what that is
pci device tree???
the future of linux
every time this guy makes a new comment i'm more and more baffled by the ignorance
like i know i say some pretty stupid stuff sometimes
but never ever on this level
does he mean the fucking pci bridge hierarchy???
it's astonishing that he has like 20 years of experience in osdev and somehow says stuff like that
how can you market yourself as a serious os and not know about any of this
like
what devices does he even target???
storage via i2c or what
lol
real
keep in mind this person has more commerical users than all of us combined
yes, RDOS is used commercially iirc
omfg
(according to Mr. Dunning-Kruger)
lol
as a RTOS or something
menix is actually used commerically on over 50 computers
(suse machines that i hijacked)
lol
cooked
is there a list of kernel api functions that uacpi can call from interrupt handlers?
alright that works thanks
he gets more confused by the minute
Just wait until he discovers the job of MCFG
is there some kind of centralized database or something where i can look up pnp ids for devices?
rg PNP... /usr/src/linux :^)
on most distros that path probably doesn't exist or only contains headers for building modules
on widnows you can dump the aml
just use a path to your local copy of the linux kernel sources
but you can only see the ones you have
fair enough
Tbh PCI is not that straightforward
Though how did he have ACPICA working before?
https://uefi.org/PNP_ACPI_Registry exists but its just a registry of vendors not of devices
no idea
i imagine that's because vendors can assign whatever ids they want, afaik pcisig also doesn't list any device ids for vendors
https://uefi.org/sites/default/files/resources/devids (5).txt is how i reference the standard/compat ids
yup
i actually helped a guy figure out the device id for a thing for support the other week because a flight sim hardware company had just released a new thing that i got but he didnt lol
the actual device id is whatever the vendor wants
if you want the well known ones look at linux source
Don't they have a weird south-bridge like thing?
they do yeah, but they don't officially ship acpi/uefi firmware
I mean ARM SBCs seem to be getting semi-competent ACPI
With Windows and stuff
What if the next Raspbery Pi...
@calm latch thanks for replying to him
A watcom user
lmaoooo
can we make it possible to ban people from repos
specifically this person
wouldnt loading the namespace, then enumerate it for pci(e) stuff and then initializing the namespace solve his problem?
It's what my kernel does
But the question was weird
Why would you need names?
And uACPI should give them to you anyway
I have no idea what he meant by names
wtf is he on about now
i get the sense that he doesnt understand that pci config space access doesnt require enumerating devices first
idk does he use segmented memory model for 32-bit x86? if so then youd have to change the entire memory model lmao
force him to use paging
he believes its faster that way
(it's not)
tbh I think that page was written 30 years ago, and never updated
though still
one would remove it...
yeah that's a bad argument
there might have been an argument for asm being faster 30 yearrs ago but even then doubtable
I mean if you were using watcom 
yeah its definitely possible with watcom, open or otherwise
compile times are definetly faster for assembly
Just point him to a kernel project that already successfully uses it and be done with it
Say "do it like this"
I think I've left a link to mine in one of the messages 
I've tried talking and explaining stuff at the very beginning but it doesn't seem to go through nor register in any way
then close it as off topic 
"ask on discord"
Unironically this

I will probably just answer with this

i want popcorn for when he reads the old messages in ths channel

then just wait until he gets mad and ban them 
oh this is the uacpi yap station
#osdev-misc-0 message
oops posted it in the wrong place
oh god I didn't see that the rdos saga continued
oh no
on github? I'm afraid to look 
yeah
Also github isn't loading commits properly rn for me lol
works for me
someone should tell him to read a spec of how _PRT works
actually no it's fine, good thing he stole mishakov's code
A port of uACPI to RDOS. Contribute to rdos314/rdos-uACPI development by creating an account on GitHub.
That sucks
The issue is that my code is not the best in the first place
looks fine to me
The error handling is not great
or result propagation 
not biased opinion btw 
clearly superior because managarm is superior 
real
when ultra kernel progress thread
come on i need inspiration
idk what im doing
i should honestly just drop the idea of making a cool kernel and go back to shitty non-preemptive kernel and get bash running or smth
im waiting for qwinci intel driver to get inspired 
thats the way
there are other inspiring hobby kernels
like min
oca
whatd u think i was gonna say
mintemple os
kinda hate my brain
real
chad realist mindset
no it's the beta *ux developer mindset
brian?
i want to make something good
me too but my brian is null
nahh

my kernel is nonpreemptive and I like to think that it's cool 
(like the sceduling is preemptive, but the kernel can't preempt itself)
linux couldnt until recently as well
Sounds wrong
You almost get kernel preemption for free when you add smp support
Cuz both require you to support multiple executing contexts inside the kernel simultaneously
how so?
Unless you do a big kernel lock that is



