#Zinnia
1 messages Β· Page 5 of 1
yep
still it's cool
i bid on this thing
unlikely it'll sell for 700β¬
only 300β¬, wow
it's an auction
yeah but still, only 300β¬ as of now it's very good
i removed the dependency on linux headers
hmm
config.log?
host-builds/gcc-host/libstdc++/config.log i think
configure:4286: /build_dir/host-builds/gcc/build/./gcc/xgcc -B/build_dir/host-builds/gcc/build/./gcc/ -B/usr/local/x86_64-menix-mlibc/bin/ -B/usr/local/x86_64-menix-mlibc/lib/ -isystem /usr/local/x86_64-menix-mlibc/include -isystem /usr/local/x86_64-menix-mlibc/sys-include -o conftest -O2 -pipe -fstack-clash-protection -march=x86-64 -mtune=generic -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer conftest.c >&5
/usr/local/x86_64-menix-mlibc/bin/ld: cannot find crt0.o: No such file or directory
collect2: error: ld returned 1 exit status```
it's supposed to look for crt1
oh wait the patch didn't apply
that's stupid
okay should work now
mint moved jinx to codeberg wtf
ig this is why you don't depend on trunk 
who did?
no remember when we were talking about it
ah yeah
i thought you changed it to trunk
anyway did you see managarm/managarm#915?

amazing
i might actually write a driver now 
i need to fix my crts
This PR adds support for the Menix kernel, including x86_64, aarch64, riscv64 and loongarch64 support.
Some sysdeps are not implemented yet, until then the syscall numbers are all set to 0.
okay cool codeberg is rate limiting me after 2 accesses
nothing
also that's Scrt1
yes see the error
are you statically linking?
.
oh what
isn't Scrt for PIC?
i dont think so
but i dont see what could be causing this
maybe missing .extern main?
it's the same as managarm and linux
but that doesnt make sense
yeah im not sure then
something somewhere is incorrectly assembling that file probably
yea
try looking at readelf/objdump of your Scrt1.o vs one that's known to be good
see if you can find any differences, maybe you need to fix up some patch
that's how glibc does it
WHA
also interesting is that there is no PT_INTERP????
i thought that this is supposed to handle it
im on my 10th cmake recompile
FUCK YOU !!!!!!!
WHY DO THEY NAME THE VERSION 4.0.0 BUT INSTALL TO 4.0
?????
Menix is now upstream in mlibc
And the entire bootstrap distro is finally building
next step will be fbcon
then vfs
my old vfs impl is dogshit
is this still a microkernel?
it's not really feasible because i don't get as much time to work on it anymore
so i have to dial back on what i want to achieve
yes
hm, i'm kind of struggling to make abstractions around user-owned memory
i thought of using a UserPtr struct that stores an Arc to the page table + virtual address
anon_vma?
elaborate
Start pointer, end pointer
Struct pages pointing to it
See the ->mapping field of struct page on Linux
i don't have a page struct 
Then that's gonna be really painful
You're gonna have to have some sort of a data structure for storing that
wdym
like which exact regions are free?
hm
then i might actually not be able to use an allocator crate
no no, in use
or well, i guess free also by extension
but page struct is what you want
It's just some struct that stores Metadata about a physical page
Refcount, various links, flags, state, mapping links etc
isn't that a lot of state for one page?
64 bytes per page on Linux
Not that much
Considering this allows you to do tons of things at O(1) it's a very good thing
Yours can be smaller depending on your architecture
so where exactly are these structs stored
You probably don't need all 64 bytes
Reserved usable memory
A chunk of usable memory gets eaten up at early init
so i guess i need to have a big static buffer?
You can just chop off part of the memory map
ah
Which is what proxima does for example
i was about to ask for !linux sources
Linux has a memory map allocator for that
because as cool as it is, it's unreadable if you know next to nothing about it
bonus points if your pfndb is virtually contiguous and physically sparse :^)
Yeah that's the best way to do it
But it needs this to do a lot of other allocations and also respect Numa topology which u probably don't care about
So u don't need a full blown memory map allocator
Just a simple thing
couldn't the memory map allocator be part of the .bss?
yeah sure
idk if that's a smart approach
Memory map allocator has a static array where u would store memory ranges
the only problem with putting stuff in the bss is that if you want to discard it later is becomes quite hacky
#[link_section = ".reclaim"] 
But u can have an even earlier allocator to carefully chop off a few pages for it lol
:^)
Depends how elegant u want to be lol
Probably even for more insane ones too
so yall are saying that i should ditch the allocator crate again and roll my own?
or is the page struct unrelated to it
Ideally when u allocate a physical page what you return is not it's address but a struct page pointer associated with it
Yeah
if you need the page address you just page.address()
and to access i would just hhdm?
Yeah the address can be derived with one subtraction
access what?
the memory
Yes
other kind of mapping
like if it's a kernel stack it would probably just be mapped
or you can have a whole ass vm object abstraction
You can have a page_to_virt or whatever
idk how this shit works
i would love to have that ngl
abstractions are nice
yeah i wish i could help, maybe look at how managarm does them?
they have memory objects
true
and it's c++ so it should roughly translate to rust
It's probably overcomplicated because speed and micro kernel
i hate this phase of planning lol
everything depends on everything
Ah ok
Join the nyaux project

wrmsr(0xc0000081, asdjkasdka)
real
well at least he is in userspace
meanwhile I'm seething about imaginary abstractions

premature optimization is a curse
the 129381297th iteration of it
it's not really an optimization
what you're doing
it's a pretty fundamental design choice
Yeah lol
Yeah
i had a user_access() function which only disabled smap β οΈ
that should tell you enough
CTFix
in my defense i had a TODO there
so if i get this right:
- write memory map to reclaimable region
- initialize page allocator with enough backing memory to store meta for x amount of pages
- initialize normal allocator
-profit?
Basically
You only want to write usable memory ranges tho
Reserved stuff you don't care about
would it make sense to preallocate the whole range of memory?
Hmm?
min_usable_phys..max_usable_phys
as in, for 4gib of ram, allocate 64mib for metadata
Yeah, you preallocate struct pages
let max_phys = align_up(entries.map(|e| e.base() + e.len()).max(), PAGE_SIZE);
let pages = max_phys / PAGE_SIZE;
let reserved_memory = size_of::<PageMeta>() * pages;
That's not super robust but if you're lazy it works
what's the robust way
Ideally u want sparse per region struct pages
So virtually contiguous but physically sparse
true
thats why i said bonus points for that :^)
because it is a bit annoying to handle
oh god this might be just a bit aids in rust
It is
okay another bootstrapping problem, how am i going to map virtual memory if I can't allocate pages at that point π
it's aids in any language
im glad you asked
U can allocate pages
U literally have your memory map allocator
yeah
you basically need a bootstrap allocator
then you can just say "give me the unused ranges"
and you can use those as the usable memory
You can draw inspiration from linuxes memblock
This is what proxima does i think, aka the lazier simpler way
for mapping the pfndb
you just need a separate thing for building up the initial page tables
Or abuse bss 
because you can't really use your allocator that hands out page* to set up these page tables
so you need some temporary shit and later probably adopt these back into proper structures
you can go from pfn -> page in two operation
well the issue with bss is that it'll be both virtually and physically contiguous
idk
it's not like the page struct array has to be physically sparse
to do that you can just do the early page table shit
with an early allocator
then just map the regions of memory you need for keeping track of usable memory's page structs
after you have set up your page allocator you can probably create proper page tables and then reclaim the memory that the shitty ones were allocated from lol
like it's really simple when i think about it
but for some reason i have trouble implementing shit like that
I have may have solved your problem already (after roughtly reading through this convo, for the page struct Design atleast, mine combines Page struct and buddy allocator)
i use a binary tree with the leaf nodes represent page structs and the higher nodes for higher order buddy allocation encoded as a ezynger layout in virt memory
one such allocator per continous phys mem area
link pls?
hm but to get back to the problem at hand, how does this help me with reading data from a foreign address space?
It would tell you which address space and at least for my Design the virt address in the hh map (only when the page is only used in that one address space, so not for cross process cow)
but i already know which address space the address is from
like
say i get an ioctl from user space
@idle flower do i understand correctly? i should get the phys address for the user address, then lookup the page in my struct page array, and then return what?
i just meant as an example
ioctl can pass a char*
and lets say i want to handle the ioctl
so i somehow need to access this user memory
e.g. if it's a struct or something
In my design look up the phys address in the vmm, go to the pmm ask it for the entry and either it's already mapped in the hhpm (higher half process mapping (region of virt mem for the kernel to access all swapable user process pages)) access it there or if it isn't mapped map it there and access it (also increments the ref counter in the vmm)
It's not really designed for a non shared memory ipc
ezynger?
i smell analysis paralysis
have you considered writing the interface that you want now, implementing it sorta badly, and then going back and improving the implementation when the need arises
yes
i mean is there any point if i already know now that it is a bad idea?
because you want to do it?
thats a perfectly good reason to implement something in a hobby project
i guess true
i just want to get back to a working state but everything is depending on my interface design rn
i've learned to not overdesign
get something simple first, and if you need something more complicated later you will know your requirements at that point
you cant predict what you might need in a years time
true
took way too long to get working
but fbcon is back now
there may be some illegal stuff going on
how does it compare to flanterm?
no idea honestly
it can only do ascii
so in terms of features it sucks
flanterm has escape sequence parsing and all that
Based
Damn
Like UEFI shell?
yes
Why do you want it?
im stuck in windows lol
they dont show any prompt
so ill have to press random buttons
What prompt tho
like what to press to enter setup
Like to install Linux?
What does it look like
first step unboxing any new pc nowadays
Not an ad β’οΈ
tumbleweed is the only stable rolling release distro that works well on !x86
Manjaro 
Works well enough for me lol
install gentoo 
wow that's cheaper than I imagined
yes
nixos!
nixos is bleeding edge i thought
nixos unstable is
nixos-24.11 or 25.05 when that releases
stable is fresh but not bleeding edge
and breaking changes don't happen except for when the older versions go EOL
e.g. since electron versions go EOL pretty fast, electron gets breaking changes in stable
and nixos-unstable has every nixos test run (not necessarily passing but usually enough time between master and nixos-unstable to get the regressions fixed
don't give in to the nixos propaganda
once my arch install dies im going back to tumbleweed since the nvidia drivers work now
im trying out nix tho
give in to the nixos propaganda
in a vm
semi based
just use nix on your host system with no nixos
no that sucks lol
whats the benefit
wtf is that
being able to use nixpkgs
being able to use nixstrap
being able to use home manager
when nixstrap menix distro
it's like nixos but for your home
per-user nixos
and doesn't need nixos
even works on darwin
home manager has got to be one of the worst jokes ever
nooo
i remember i had some issues with it
sounds like a windows paid program with a subscription
and people used to shit on it pretty hard
mfs got venv for a package manager
the impermanence nixos module is much more stable
what's kinda cool with nixos is that you can have a tmpfs / :^)
yet I use both 
not very useful but it's a thing i guess
I have a tmpfs as root
and impermanent btrfs on home
same
forces you to be declarative
that's why i don't use it
and stuff I don't persist manually are deleted automatically
which is cool
I have a very tidy home
also, why impermanent home? how do you store stuff like cookies and credentials for programs?
home-manager 
ah
they're stored in the nix store and linked on boot
that's kinda cringe
nope
cuz it makes me use declarative options instead of writing the config file manually
so I can nixos-rebuild switch --flake .#hostname to get the same configuration on every computer
yeah no i get that
poor man's synchronised dotfiles
it works "good" for me
it sucks
why?
lagging while scrolling
huh
only when scrolling
yeah, i don't lag there either
@idle flower did u make any progress yesterday?
some but couldnt figure out your error yet
prob need to talk to infy about that
lmk if you need assistance with anything
i really need the barebones mode to continue working
ok then i will skip directly to table stuff and ignore the faulty/missing types stuff
for now
as long as it compiles with table mode it's fine
hm i wonder if i should give my modules a command line upon entry
actually, yes i probably should
on my 17th gcc rebuild today
π«
but i already have gcc working on x86_64, riscv64 and loongarch64
now i'm finishing up aarch64, then i can start fixing llvm
YESSS
gnu toolchain is working fully
hm
is it normal that everything is 64k page aligned on aarch64?
is that the minimum guaranteed size that aarch64 pages will have?
yeah but does the spec dictate that 64k pages must be supported
if so i guess thats why they picked that number
no clue
that's the only clue i have tbh
@hoary cave where did you get these offsets from?
(or to avoid xy:) where do i get the offset for loongarch
limine-c-template
hm i guess loongarch doesn't need that then
Holy shit
it was worth it
Did you manage to get mlibc to build?
Hell yeah!!
I forked mlibc, but I may consider trying to get a cross compiler build for my OS today
π
my patches are very pragmatic
they're not based on anything
just whatever works
Sounds good to me!!
Once I finish my slab allocator today I'll probably get started on getting a proper toolchain in place. I'll probably also want to get started on porting mlibc for said toolchain too...
But seeing that arm64 had some issues during the build I'm a little skeptical
@spark surge i must retract my statement
i stashed my recipes and for some reason now it works?
idk what happened
but still, i think that the pr could be useful at some point
you never know...
ah
sure but please update the variable name before i merge it like i said in the other server ty
Afaik that's just a riscv/qemu quirk, requiring the disk to be a certain size.
yeah
@grave peak

well thats a giant blob
DSDT is 70k loc
biggest aarch64 blob ive seen for sure
tons of debug statements
tons of i2c
this laptop doesnt support acpi shutdown or sleep tho
7 PCIe segments
all properly reflected in AML which is cool
how else does it shutdown?
probably windows driver aids
windows acpidump.exe
ah
i think i accidentally packed the exes in the tar as well π
u did
lol
yeah, it doesnt have _PTS, or any _Sx objects
πΏ
it does support acpi reboot tho
maybe this is how it shuts down
it has a lot of proprietary QCOM devices
smmu?
no idea, it's a standard header
mfw i had to build the entire llvm toolchain for it to work
School blocked me
Will try to get the table system to a point where you only need to implement a trait for a new table + table specific stuff
Basicly a template
On my phone btw
Trait AcpiTable: Copy + Drop + Send + Sync {
Fn try_new(index)
Fn table_count()
Fn try_new_all()
Fn try_new_all_in()
}
Alloc feature will be a extra feature flag
Also next push may break your stuff, made the feature flags rust compliant
@idle flower im probably not going to be able to use uacpi-rs :/ because my kernel needs Special compile flags
What flags?
like compiler flags
-mno-general-regs -mno-red-zone on x86
on riscv i need some target flags
No Generalr regs, wut?
what about riscv?
What does it need?
i need -march=rv64gc_zicsr_zifencei_zihintpause
Excuse me?
What kind of brain fuck is that flag?
the isa string
g = general
c = compressed
zicsr = csr instruction
zifencei = memory fence instruction
zihintpause = pause instruction
Looks like a very big riscv L
yes
Is that a standard string or just for one board you own?
Also does the string influence the call Abi?
Then we could add it as the default
Some sort?
Sounds more like that riscv should get it's shit together, no wonder nobody big ports stuff there
no i don't think this can work, there must be a way of providing additional arguments to the crate
because this might also be conditional on kernel flags
like i could also build with -march= rv64gcv
for vector insn
And I assume that this isn't encoded in the target triplet?
yes
Absolute shitshow
And they wonder why they aren't really used in the mainstream (outside of embedded/special purpose/server)
If they would have encoded it into the triplet it would be workable but that is just a nightmare
Do the riscv/arm/loongarch Isa string stuff influence the abi on the llvm-ir level?
Or just in the backend?
afaik ir
because of intrinsics
Sounds like my os won't be supporting those anytime soon
lol
I don't want to ship a billion llvm-ir blobs per programm just because the arch devs took too much lsd

So either they need to get their shit together and take a look at x86 or llvm needs to encode abi and support conditional compilation in llvm-ir
You could create a fork with the flags you need
That's the sanest path I can think of for the foreseeable future
What does it look like for arm/loongarch?
rn im just running my own bindgen
for the time being
@near tartan it seems like rust passes the target features to build scripts so uacpi-rs will work on riscv/aarch/loongarch
how does it work?
CARGO_CFG_TARGET_FEATURE=mmx,sse β List of CPU target features enabled.
how is that translated to cc?
Giant switch
Also this is readable via env! from normal rust
Discord shits itself again, messages take ages to send
bruh
had to resent all of them
bruh
but like
how do the environment variables get converted into cc flags?
do you need to specify a function in the build process?
because when i did it, it didn't care about flags whatsoever
ill have to see
because the march string for riscv should be encoded in the target spec
check my kernel in toolchain/riscv64-kernel.json
yes and that should be passed to the build script via CARGO_CFG_TARGET_FEATURE
:D
That's badass!!
LETS FUCKING GO FINALLY
native ELF dependency tracking fully within cargo
it does automatic dependency tracking
how can it load nvme if it depends on pci?
shouldn't it load pci first?
well done tho :^)
it parses nvme first, then realizes it needs to postpone it until pci is loaded
good !
nice
today i need to finish up cmdline parsing and module relocations
then i do lapic setup and vfs stuff
then we can finally go into userspace again
i always thought that interrupt controllers were super complicated but it's not even that hard to understand ngl
i just need a generic abstraction for it, no idea how
i think i can do rerouting by irqs
also i stubbed out that part
it just does the parsing atm
today on fucking stupid cargo bullshit:
okay i got further with the driver interface
the pci bus is now its own subsystem and decoupled from the kernel
that is kinda cool
* building host package: gcc
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
9 88.0M 9 8804k 0 0 880k 0 0:01:42 0:00:10 0:01:32 560k
fastest ftp.gnu.org download
fr
eh its fine
thanks libclang
with or without clang?
with
that explains
for bindgen
fair
technically i could use the containers llvm but it's debian so it's probably llvm 5
bookworm (stable) (devel): Low-Level Virtual Machine (LLVM)
1:14.0-55.7~deb12u1: amd64 arm64 armel armhf i386 mips64el mipsel ppc64el s390x
trixie (testing) (devel): Modular compiler and toolchain technologies
1:19.0-63: amd64 arm64 armel armhf i386 mips64el ppc64el riscv64 s390x
sid (unstable) (devel): Modular compiler and toolchain technologies
1:19.0-63: alpha amd64 arm64 armel armhf hppa i386 loong64 m68k mips64el ppc64 ppc64el riscv64 s390x sh4 sparc64 x32
1:16.0-58.1 [debports]: ia64```
i think jinx uses unstable containers?
but i might be wrong
also i just cloned bootstrap so i'm good
ye
i did make install-minimal image
yea that should work
i kinda want a makefile target that builds/rebuilds a package because cding into the build dir is fucking annoying
takes me around 12 minutes, but i also have to rebuild a lot of times during patch work
oh
maybe someone should add -C support to jinx
yeah, but incremental build is way better
./jinx -C build rebuild pkg
and fast
that would be kinda neat
why do you need to patch llvm tho?
im working on limine today, but i could throw that in as well
for target support
oh, you don't add it via a target file?
llvm?
ye
the kernel does have a spec
since when can you do that?
but this is for user programs
i think you can specify for them too
would love a link to that
i already have upstream mlibc support
i have all the pieces to go back to userspace again, so I'm probably going to do that
so pic, lapic, vfs + tmpfs
ah
you can in the limine code path
it's like 4 outb's
lol fair tbh
also at some point i want to have my own ap spinup
no support for x2apic?
that too
the biggest issue atm is mapping new memory
not talking about writing page tables
just allocating arbitrary virtual memory that can map to a physical address
because i need to stop using the hhdm for that
i see
modules also aren't actually loaded yet, just parsed :))))
isn't access mostly linear anyway?
and that IoSpace struct would be very cool
how do you allocate virtual memory for those?
else you can use a linked list allocator
in C i just did a bump allocator
"allocator"
atomic pointer that got incremented on every alloc
buddy allocator will help you a lot for pmm
i already have an allocator that uses the hhdm to manage memory
even if you have segmentation it will work good anyway
but yea i also need help designing the vfs/file abstraction
I don't think my impl rn is good
the problem is allocating virtual memory
?
without relying on a linear mapping of the entire physical memory
mapping device memory in the kernel space
you can't use an hhdm for it
because the pyhs addrs may exceed the range
(i had this happen on my old pc)
not even that, you usually want to map it UC
tru
hhdm is generally WB
UC and WB?
but yes if we can get that done it would solve a lot of issues
uncacheable, writeback
ah
@hoary cave are u in vc tonight?
i see
omw home
yeah just lmk
k
bru
idk probably misconfiguration
nah it doesn't affect kernel builds anyways
ah fair
what's the deal with menix and menix-debug nowadays?
you can't depend on both menix and menix-debug, otherwise the module files collide
hmm i see
preferably I'd like the kernel and modules be in the same dir
probably in /usr/share
we can figure it out when ur home
np, just lmk
do not download gcc worst mistake of my life
at least not 200k/s
2 bytes per whenever
i've been using github as a slightly ghetto mirror for alot of stuff and it works pretty well
you end up with some pretty crap urls
today i finish up the LAPIC timer setup
that reminds me, i still have to do scheduling
fuuuuuuuck
it's fineeeeeeee
not in rust
does rust make anything easier?
the memory management
the issue is that i need to keep track of the threads in the scheduler
why is that a problem?
rust doesn't make this particularly easy
malloc won't return null
how so?
it panics instead 
huh
also I have this magical flag -fcheck-new
when out of memory
are you talking about your kernel?
yes
what do you do?
i have reserved memory that gets claimed to have some sort emergency memory
and in that state i can invoke some functions to kill pids
we will see how well this works as soon as i got the timer interrupt running
yes
well that would be easy to implement, I just don't have anything to free in case of emergency yet lol
lol
i just start failing userspace requests when i run out of memory
at some point i'll prioritize processes to ensure some programs can get memory in low memory situtations
it's safe to say my old lapic code is not good
phenomenal
π what was i smoking
now look at the implementation of mmio_write16(). it might be movl 
π
@hoary cave okay i got the lapic stuff done but for some fucking reason it only works in tcg and my framework laptop (which then causes a gpf and sometimes a page fault in the allocator crate ???)
it doesn't work in kvm and on my thinkpad t14s
i'm probably missing something but w/e
maybe you see something i don't

fbcon potentially fucked???
okay no fbcon is clean
only happens when i enable interrupts :(
another thing i have to think about, uacpi needs pci functions, but if i put the pci stuff a module, i can't really do anything because then i have a cyclic dependency
pci needs uacpi for the MCFG
uacpi needs pci
maybe @grave peak or @idle flower
how so
You either support it or you don't, it's a very core bus
Controller support may be loadable via modules
But the bus itself I see no reason not to always support
do you thjnk i should do that for all buses?
Some buses need special drivers, like the vmbus thing
But for something core like PCI I would have a CONFIG_PCI Y/N
my kernel isn't configurable really, but i get it
i heavily dislike the linux way of builtin/mod/off configuration
imo either everything should be a module, or nothing
Some drivers are more important than others and are needed more often, those can be compiled in. Others barely exist and are only needed on esoteric hardware. I think this system makes flawless sense
not talking about code changing configs, just entire modules
i have had multiple issues where some option was disabled in a distros config and i had to build my own kernel with that enabled
im probably exaggerating
That seems tangential to y/n/m tho?
Or are you advocating for configless kernels?
i believe that there is just too much that can be configured
I think for that you should blame the hw not Linux
It just supports a lot of mutually exclusive scenarios
But I understand your frustration
(i may also be salty that I can't do builtin modules in rust)
You cant? Isn't it just link object files vs just produce them etc
my modules are .so's with an entry point and special PHDRs
and cargo doesn't make it easy to integrate
let alone have any form of configuration mechanism
sure there's the feature flags, but those are only on/off
Ooh, maybe it would be easier if you made them objects
maybe, but i refuse to do that
Lol why
.so's are simpler to implement
Yes
and they're actually meant to support this exact usecase
Yes but plt got and all that disgusting stuff
linux doesn't use them because the tooling back then was too bad
if you're doing pic anyways the difference isn't big
Idk how pic works
especially on !x86 relocations are a huge pain
Portable Executable doesn't have all these issues. And it handles circular dependency perfectly well. Just make your acpi and pci drivers boot time drivers and your loader will load them both.
how does it not have these issues
you still need to patch instructions somehow
not to mention that PE tooling is absolute trash
You don't need to patch anything. It's really easy. Documentation on msdn explains this good. Writing from the phone, can't give the link. As of "trash" tooling, well, it's definitely about some specifical compiler, not the PE mechanism overall.
ELF's pic is really "trash", imo, of course. It's a pseudo pic with all that horrid plt got nonsense. PE is always position dependent. And it handles import/export easily. Via special easy to understand tables (IDT, ILT, IAT, EAT). they are documented and e.g. with msvc you solve circular dependency with no issues. .exp files and import libraries.
msvc does not help with this
not to mention there isn't a msvc for riscv64/loongarch64
afaik
Clang should do for them. It follows msvc when asked. At least I know about arm64.
They added mips pe recently. And no loongarch?
can't rust compiler/linker fow windows be used?
no
That's probably as the common denominator to make all developers happy and depends more on what machines they use rather than anything. Edk doesn't use PE import/export capabilities anyway.
the problem is that gnu-compatible tooling has no target for anything but x86_64 and arm64
Well, that's pity, because for the issue and needs you mentioned, PE is the best option. It solves what you need and want seemlessly. I use this mechanism, I like it.
also, looking through some articles, PEs literally have relocations
idk what you're talking about
It's base relocations. You'd be surprised how easy they are to handle. For pc/ip relative real position independency archs like rv64, they basically boil down to a single DIR64 type. Object relocations are not present in executables like exe dll and sys.
... but they aren't present either in ELFs
They are if your elf "drivers" are object files. Plus with elf you need to pretend to be pic by dealing with got, plt and sometimes got.plt. π
Then if you want to keep using it (.so), you must provide so loader, that will handle the latter. Couldn't elf handle circular dependency? So you configure your setup (not compile time, but via runtime, like Windows through registry) to load both pci.so and acpi.so then init them and use, avoiding lock?
it could load them both, but my module loading is an atomic operation
partial loading is not allowed
So the issue is not with loading, but with the way the drivers initialize themsleves? Say, acpi during it wants something, that pci must have provided and the latter needs something else from acpi during providing that thing? Then it looks like a driver init cycle design flaw.
it's more a security thing. driver's can't have unresolved symbols after being loaded, and they have an entry point that gets called as soon as loading is done
no partial dependencies allowed
modules should be seen as extensions anyways
but yes, tldr I'm moving pci into the kernel
Some platforms don't have it at all or have it as "just another peripheral" instead of like a big boss bus. rv64 SBCs might well be among such examples, so yay, you just decided to make your kernel filled with an absolutely unneeded stuff. like linux. π
almost all boards have pci
like, I don't know ANY modern rv64 sbc that doesn't have pcie
the vf2 has it, the mars, meles, bpf f3, jupiter
in the x86 realm yes, in arm and rv totally not. eg there are boards with SATA/AHCI and pci, but the former doesn't sit on the latter, instead it sits on APB/AHB. Or even mutually exclusive PCI/XHCI.
i only support uefi boot anyways so if there's uefiy there's high chances that there's pci
or at least i don't own any boards that don't have pcie
I have pci as a module, I do it by having some acpi table stuff in the kernel (its needed for finding interrupt controllers). So the kernel also creates device endpoints in mcfg, so one for the port to access on x86.
it's more about the uacpi pci callbacks
rv architecture/platform maintainers seem to do everything to not embrace uefi. I've never been able to find anything rv having uefi support even on vm.
Do you have a way for modules to communicate they provide access to a bus?
nope
Ah
qemu has riscv edk2
also u-boot efi exists
Never could start it. Just hangs. The only thing worked was uboot virt. But it's too limited.
works for me
Honestly, I didn't want to compile it. And prebuilt things never worked.
Its a bit jank, Ive had trouble if the version of ovmf isn't from around the same time as the qemu release.
i don't see anything immediately obvious
oh yea also it only fires once


wont help you probably, my sytem manager pokes uacpi and enumerates the device tree each time it finds a bus controller it looks it up in the initramfs if present, it loads it and asks the driver for downstream devices/busses, if after that the boot source isnt availible it simply panics (initramfs error), once the boot source is availible it loads all missing drivers if possible.The system manager doesnt care about pci(e), its just another bus
fun stuff, good to know we reinvented the wheel with the Primitive trait :^)
i think you said you knew there was a crate for that already lol
yea if you can make use of it, feel free to put that in
@hoary cave are you going to do something with it or do i do it?
@hoary cave what kind of type should the PerCpu thread field have?
this looks slightly cursed
idk if there's a better way
that's normal
idk if it's a good idea to store a reference to the current thread
whats that
