#OBOS (not vibecoded)
1 messages · Page 41 of 1
Well it would be more of a tracking of the MMAPd region its self describing the status of the pages in there
And that’s owned by the processes
And then the kernel has a reclaim list that points to all the different MMAPd files and the procs that have them mapped
that wouldn't work, as the struct page is reclaimed
I would have to keep a list of virtual addresses and contexts that have a struct page mapped
So the kernel goes to the list and then tells all the processes on one of the MMAPd files to unmap it
This would be seperate from other things no?
the kernel would go through the list and remap the pages as unpresent
struct page is also pagecache entry

I could keep a list of page ranges that have the file mapped in the vnode
the page range already contains information about what range of the file is mapped
so I would do some simple arithmetic and iteration over that list to invalidate mapped pages

And a page range is part of the VMM right
Like when you MMAP 4MB or some crap
It keeps track of that’s
Right
yeah
And then you go though vnodes to reclaim them
I think this shall work
scrap that
the pmm goes through the standby list to reclaim memory when it needs to do an allocation on OOM
What is the standby list?
read this
So a list of things on standby to be reclaimed?
list of things that can be reclaimed
reclamation in obos only happens when the pmm freelists are completely exhausted
Ahhh
So that would refer to such vnodes then? So that you can go through and invalidate the things
yeah
specifically the struct page refers to a vnode
and also contains the file offset
that it refers to in the pagecache
Basically all the info on how to properly invalidate it in the page cache and unmap it from everything etc
thats in the struct page
Yes the struct page for the standby list.
the standby list is simply a list of non dirty, reclaimable (i.e., pages written back to disk or swap) pages
yes
Ahhh so that would have pointers to the vnodes
yes
And then when you need to reclaim a page that has pointers to all the data to unmap and then invalidate the cache entry and then have it freed
And it could also see if it’s dirty and have that sent back to disk etc
anything in the standby list is not dirty
the modified page list has dirty pages
Ahhh
And when you MMAP a file and read from it it’s okay
But then if you write it’s marked dirty
Etc etc?
yeah
I presume if the standby list is empty you can tell the driver to flush the dirty pages to disk?
there is a thread called the page writer which is responsible for taking pages on the modified page list and writing them back to disk, and throwing them onto standby
(i say writing them back to disk but technically it can be written back anywhere)

and the dirty and standby page lists include both anonymous pages and file pages
anonymous pages are written back to swap while file pages use the backing driver to writeback the pages
(i say backing driver instead of fs driver because any block device can also be a file page)
Okay but I think I get the gist of this
Thank you for information
I hope I don’t forget it 💀
feel free to inquire me if you forget
btw i would also ask fadanoid about his MM design his is probably cooler than mine
Thank you cool USB man
np
Hopefully I can get off my ass today and write some code 💀
I’ve mostly been absorbing knowledge
I promised my friends I would start a terraria server in like 20 minutes
so I might not get much done
anyway I will now be implementing TCP SACK
I was uhhh also wanting to play terraria 💀
basically how this will for reception is that instead of sending an ACK when rcv.nxt is advanced i'll send a SACK packet whenever a packet is inserted into the buffer
idk if i need to change transmission logic yet
Why do you need SACK?
also don’t make a joke about this don’t make a joke about it being called SACK
selective ACK = less retransmissions from the peer = better performance
Btw for my ram block device what’s your opinion on using a radix tree for it 
oh yeah i just need to make it not retransmit packets that have been ACKed selectively
what would a block device need radix trees for?
seems fun
Yeah shouldn’t be too bad
i would personally have done a linear buffer but like that seems a lot more memory-efficient
Wait how does this know what parts it can free from because it may not be a fully backed backing. Oh wait that’s why you use the PFNdb and have it separate and this is just so you can know where to look and unmap crap
Yeah because I’m gonna lazy allocate the backing pages too
So if you never touch a block
It’s just never allocated
I’m gonna limit it to 256mb and do two layers have 256
Just because easy
oki
And 99% of use cases for such a device won’t need more
there's some dumbass in #osdev-misc-1 lmao u should check it out
making unintellectual arguments about how "linux bad windows good" 🥀
But correct right
wdym "which parts it can free from"
like which parts can be reclaimed? which parts can be unmapped?
Like what pages are actually backed vs not
it checks the pfndb
Yeah
I just wanted to make sure that’s the reasoning for the PFNDB
For that
And the mapping is just so you know what to mark as non available and where etc
For the references
Right?
https://datatracker.ietf.org/doc/html/rfc2018
btw if you wanted a read on TCP selective ACK
Since the data receiver may later discard data reported in a SACK option, the sender MUST NOT discard data before it is acknowledged by the Acknowledgment Number field in the TCP header.
interesting
Why not just assume a perfect world where no packets get lost

It’s the users problem
see: UDP
UDP has literally not changed since august 1980
yeah
literally the easiest shit ever
reception: just throw all received packets onto a per-port data queue
Who needs TCP then 
transmission: formulate the 4-field header and send it to the destination through the IP stack
http
minecraft
ftp
ssh
etc.
typedef struct udp_header {
uint16_t src_port;
uint16_t dest_port;
uint16_t length;
uint16_t chksum;
} udp_header;```
lol
sending a udp packet is literally just:
udp_header hdr = {
.src_port=host_to_be16(src),
.dest_port=host_to_be16(dest),
.length=host_to_be16(length),
.chksum=0 // checksum is not even fuckin required
};```
i wouldnt know
it probably sends IP packets on top of a UDP socket
The checksum isn’t required?
not for udp
although the ip header does have a checksum that is required to exist and be checked

u wont ever catch obos sending udp packets with a non-zero checksum btw
reason why: i couldnt figure out the algorithm properly 💀
💀
Use the check summmm
You have to sum the check
talk is cheap send patches
(and some sort of ipv4_transmit(nic, dest_addr, &hdr);)

mkay im waiting for the patches to come in
It’s just append some data and sum some bytes right
something like that
Well prepend
no append
yeah the pseudo-header is prepended
Because it’s just summing it all
and data is appended onto it
btw u can copy tcp_chksum
And then sum all the bytes with ones complement
to generate the udp checksum
you just need to generate the psuedo-header
static uint16_t tcp_chksum(const void *seg1, size_t sz_seg1, const void* seg2, size_t sz_seg2)
(i did this to avoid having to do any data copying in the tcp stack)
yeah literally the exact fckn same
struct {
uint32_t src_addr;
uint32_t dest_addr;
uint8_t zero;
uint8_t protocol;
uint16_t tcp_length;
} OBOS_PACK ip_psuedo_header```
Do you still want me to implement this 
I mean I want to 🙏
(dont send actual patches make a PR im not tryna review raw patch files)
yeah just make the pseudo header, copy paste tcp_chksum, set the checksum in the header, profit
yeah the master branch builds... why wouldnt it
anyway obos now sends SACK PERM in the SYN packets
now i need to actually implement selective ACK
first i need to parse the response SYN or the response ACK to see if the peer sent SACK PERM back
Does it run
runs for me

gh actions build also runs
Make pseudo header -> prepend to the UDP packet -> tcp checksum -> insert into header -> happy
Got it
no
look at this
seg1 is intended for the pseudo-header
seg2 is for the data
Smart
and then they are checksummed as if they were one big block

so that it doesnt have to do any data moving
obos xhci bug fix when
why thank you
when im done fucking around with TCP
maybe your xhci driver will work on other hw ?
who knows
it works on that device with xhci controller passthrough
(at least, TRBs work)
then maybe some pci pain
try to do polling later
instead of interrupts
i tried to poll
nothing ever showed up
it's a problem with the enqueue itself
either that, or the doorbell() function is broken
which i tried to check by putting in a TRB in the command ring before setting the command ring dequeue ptr
but that was also to no avail
The SACK option SHOULD be filled out by repeating the most recently reported SACK blocks (based on first SACK blocks in previous SACK options) that are not subsets of a SACK block already included in the SACK option being constructed. This assures that in normal operation, any segment remaining part of a non-contiguous block of data held by the data receiver is reported in at least three successive SACK options, even for large-window TCP implementations [RFC1323]). After the first SACK block, the following SACK blocks in the SACK option may be listed in arbitrary order.
no clue what that is supposed to mean
anyway, SACK does increase TCP performance a ton
my only problem is that wireshark is reporting a lot of duplicate ACKs
(sample)
i see why, because hdr.ack is the same
but idk if that's just wireshark unrightfully complaining about my selective ACKs or if it's an actual problem
what's up with the performance? (assuming you are downloading from a fast host)
the host is the host
as in the host os
and it downloads the file instantly
try with a large file, i wonder how it compares to keyronex at present
i have yet to add header prediction which will hopefully improve mine
oki
avg. download is 300k
(it's really slow cuz obos is dogpoop)
How fast can it download from my server
And if it can even do that
(no reason why it shouldnt be able to lol)

send me a link to a file ill try and download it from obos
well it's owrking
working*
but le transfer speeds are le shit because obos is le shit™
whats teh speed

download it over an usb 3 nic :^)
um a part of the reason why everything is so slow is probably because there are so many retransmissions
literally for like every packet transmitted
and pretty much every ACK in wireshark is marked as duplicate
like i genuinely do not know if it is TCP or the nic driver at this point
and i have like no way of knowing
i think i see a problem
it ACKs a packet
and fails to advance rcv.nxt
and then later sends a selective ACK without having advanced it yet
and that happens for pretty much every other packet
why how interesting
what's up with that zaval guy lmao
yeah every nic has a setting to push packets with a length of 4 to the rx queue randomly
stick inside rear compartment?
maybe it's because when im not in my progress report thread
im BSing
ohhh ok thanks
i found the rxctl bit to disable that
no im too naive or smth
stick up ass
ohhh

ok im gonna go eat food
then work on my ext2 crap
i may actualy make a fuckin standalone version
so i can have a test suite on it?
wait sorry wc
yeah im looking at the ideal condition for fast reception
which obos sometimes gets
and there are very little retransmissions
and no SACK packets sent
because i presume the kernel gets everything in order
wtf
why does every other packet in the nic queue
have a length of 4 bytes
are these real packets with headers and crap?
tf
so how do you detect the size
an ethernet header has 14 bytes btw
nic tells me

the frame size
the kernel discards runts
ethernet says that packets have to be 64 bytes or larger, otherwise it is a runt
anyway i think the problem is elsewhere anyway
btw if you dont mind i will be using your server for occasional tests
shouldnt do any harm on the server, but the i might abruptly end the connection if i see there is a bug or obos is doing sm shit wrong
idc as long as its not breakin shit on my end
it should not™
im expecting to get hits for downloads n crap
just dont dos me 
and if you do
you have to send patches
to uhh make my kernel better
as long as ur not using the obos network stack ur good
as pretty much everything will reset connections after enough lost ACKs
btw i might go back to doing xhci dev as tcp dev is also about to drive me to the brink of insanity
lol
e1000e_rx_descr Next RX descriptor: ring #0, PA: 0x443d1340, length: 16
e1000e_rx_desc_buff_write buffer #0, addr: 0x4439c000, offset: 0, from: 0x7fff48a38660, length: 60
e1000e_rx_metadata_status_flags status_flags is 0x1
e1000e_rx_descr Next RX descriptor: ring #0, PA: 0x443d1350, length: 16
e1000e_rx_desc_buff_write buffer #0, addr: 0x4439b000, offset: 0, from: 0x5603560d4304, length: 4```
qemu is trolling me rn
sometimes i feel like rewriting obos since i have gathered le many knowledge over this past year and a half
and i want to write it better
but i feel like im in too deep
😔
Maybe make an OBOS3
we already at obos 5 
Oh I know
NOBOS: new OBOS 
yes it is still called OBOS
lol
And then act like OBOS2 is a cognito hazard
OBOS3
That erased its self

What if you just called it somthing else

“something else”
With the miss spelling

The somthing else kernel
what if i call it managram
(not managarm)
it will be a non-pragmatic, synchronous monolithic kernel
idk
I thought managarm was actually managram and named after him
So this would be perfect
lol
😭
ill name it fadanoid, after chuck fadanoid
without the uppercase E for trademark reasons 
anyway im not rewriting
damn
what about evaLynOs
Damn you got me there
hopes and dreams
(undertale reference did you catch it?)
Because aparently my idea is dumb and stupid with ext2 and a ram block device to make things simpler
Yup
Even though I don’t see why it wouldn’t be fine 
Like I have several reasons for picking this
And I got shat on for wanting VFS in kernel and filesystem drivers in user

I just wana do somthing different and cool
(did you catch the undertale reference?)
Yes I was just about to post a meme
lol
And the slightly more ram usage of the initrd
Dosnt even matter
It’s an init rd
It’s going to get fucking nuked
After root is mounted
And it has a really small size
So 
Idk why my idea was said to just be bad
do it to prove them wrong (or right)

They also said it wouldn’t fit enough the normal VFS system?
Which no it would very well would
Idk
I’m just gonna do it and worst case redo it
Worst case I have a mostly working ext2 driver I can polish for something else
im gonna sing in here in a bit wait
fuck i forgot the lyrics
greduoijtgfhrewsuoighnrews
ive no clue what's causing the tcp to discard me data
i added logs to the TCP stack
and it reports nothing or very little packets dropped
Ya know what thank you for this
You believe in me
Which means I can do it
I will prove them wrong (or right and eat my own words)
waitwait i remember
I SHIVERED BENEATH YOU
ALL WRAPPED UP IN EMBERS
IT WAS A NIGHT
TO REMEMMMBER
THEN IO WALKED AWAY
But either way somthing good will come of it
YOU ASKED ME TO STAY
NOW UR THINKIN OF WHAT I COULDA BEEN
BUT YOUVE BECOME SOMEONE IVE SEEN BEFORE
I SWORE... ID SEEN YOU BEFORE..?
anyway uh
"a night to remember - beabadoobee&laufey"
it sounds a lot better when ur not reading lyrics from a discord screen
i think
idk my taste in music is shi
We should sing bohemian rhapsody
But I wana say thank you for being a good from oberrow
And believing in me and my ideas
no clue what that is
YOU HAVE NEVER LISTENED TO BOHEMIAN RHAPSODY
nop
NOP-0x90
im an x86 cpui fsdofkdspolfkdslp;
i might be a bit tired or smtghrsweuij
smth
ofkdsoklfm
ads
fsdfsd
ffsgsdf
REMASTERED IN HD TO CELEBRATE ONE BILLION VIEWS!
Taken from A Night At The Opera, 1975.
Click here to buy the DVD with this video at the Official Queen Store:
http://www.queenonlinestore.com
The official 'Bohemian Rhapsody' music video. Taken from Queen - 'Greatest Video Hits 1'. Lyrics below:
Is this the real life?
Is this just fantasy?
Caug...
F0 0F C7 C8
nah that's what it says on other sites

just transliterated
that's a good idea but it's a bit late rn
oh nice nice
and there is no chance im going outside in this -20 celsius weather
yeah lets play tomorrow and take a break from osdev both 
thats like -6 in freedom
(without windchill!)
damn
i will tell you
i barely have played this game
guess we're the same then
i may make an expert world just for one boss to get the shield
because its easy enough
i c
the eye of cathulu in expert mode drops a really sick item
minecraft would also be nice, but alas, multiplayer is hard to do on java
i have a dedicated server box for it
if you wanted to
oo
smh
i direct you to here though
hosted on the same box
that has all my old playthroughs
interesting
all ran on that server
no static ip
no it's a static ip
i couldn't be damned to pay for a domain
also obos also happens to be the name of a big norweigian houes development company
june 8
il buy you a domain if i can
nah it's good lol
and they bought out all obos-like domains
exists
btw for legal purposes, obos' name is not obos, and it is oberrow os
what about this
when i get some spare cash
il buy it for ya
and even give hosting
with SSL and everything
nono it's good
my vps is only 10 bucks a month and i only host files on it
and idk if youve ever visited http://obos-dev.ddns.net/
but it's a really low-effort website
i mean its nothing to me to get for you
i insist, it is fine
okay ;3
lmk if there is anything else you need
also why no SSL on there 
lets encrypt is free
hm
and its like 2 comnmands
install certbot
certbot install or whatever
but yeah @flint idol do the SSL pls
yeah
The requested apache plugin does not appear to be installed
yeah what's the goddamn plugin
apache documentation is shit
also you should setup copyparty for your file server
and also use a markdown redner framework for the main site
is realy easy
use nginx but certbot still needs the moduke for it
makin my world
oh maybe the reason tcp is so slow is because of the lack of congestion control in obos
*a reason
uh nvm that has nothing to do with reception
wait
i havent considered
that obos is sending ACKs
but the nic driver fails to send them
and silently drops them
also something i will note is that obos sends a lot of detached ACKs
so if it received like 10 packets for example
it will ACK each of those 10 packets' with one packet each
but what it should technically do is after getting 10 packets, it should ACK the 10th packet only

why every ~56 packets there is retransmisison
that has to be a coincidence
nvm
why does 56 seem familar
7*8=56

with a simple optimization i was able to improve speed on external hosts
i made the nic driver insert packets into the network stack
instead of having the network stack have to wait for packets from the nic
but one thing i am noticing is that download speeds are inconsistent
throughout the connection
and it kinda looks like sin(x)=y
the fluncations
it goes from fast to slow, then to fast, repeat
which sounds like a problem with window management (?)
i need a solution for all these short ACK bursts
i have just observed that download speeds are faster using the qemu user backend
probably because it's linux doing all the heavy lifting
i wonder what happens on a physical nic?
i could try on a test subject...
btw my file server caps at 100mbps btw
obos wasn't making it that far anyway
i can spin one up that has up to 10gbps (still 1gbps realistic due to stuff)
^

i am getting kb speeds on obos
but like for later if you need
i dont even think i have fast enough wifi
yeah you may hit the cap on that server
for the real hardware test
i will only be doing it against my pc
through a direct ethernet connection
because only god knows what the nic driver is about to do
oh fuh no the iso is like a gb with all the packages i was testing installed\
first try
that's not gonna load until february
huh
*boot
i might also eventually test this on my laptop
which has the original NIC that obos has ever had a driver for

reason why i say eventually is because
this laptop is running on hopes and dreams
hopes AND dreams

god undertale and deltarune are so good
obos deltarune port when
this laptop's ethernet port is extremely damaged
make a wifi driver
it is mine now
i swear this ethernet port is in a quantum superposition
IS THE INTERFACE DOWN OR UP AHHHH
sudo claude "make xhci driver pls thank u"
TCP over display port
yeah this laptop is dead 💀
rip laptop
i have another test subject but it needs an external display
use a tv
this thing is no longer running on hopes and dreams
you must of done a neural route
yeah just let me just fetch my tv from the living room
that's just USB CDC-NCM
you need to go back and date alphys and goto the true lab
and actually it's ethernet over usb
ohhhh
ok
i do also have another test subject but it's in the basement (scary)
evalyn can u send me a display port cable 
my mailing address is 4 york st toronto, ontario 
also btw if you play terraria alone before going to hard mode make sure to block off the evil biomes because that will make them spresd like c razy and fuck up your works 
i stole all my from my mom
i only have two at all

uh we should probably go to sleep our speech is becoming non-coherent
came with her work monitors i also took because the companies never asked to return them
lol
thats why i have 3 decent IPS 1080p moitors for my setup
if i unplug my pc from my monitor i could use that display port cable
only 75 and 60hz tho
but that's a whole lotta work icl
but we must test
ill implement the x2apic and test it on my pc 
yeah i just havent gotten to it yet
theoretically, obos is compatible with the RTL8125
does that work with 09:00.0 Network controller: Realtek Semiconductor Co., Ltd. RTL8852BE PCIe 802.11ax Wireless Network Controller
wait no
thats my wifi

0a:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8211/8411 PCI Express Gigabit Ethernet Controller (rev 15)
this one lmfao
what's the device id + class code + subclass + prog if
how do i check
lspci -v
er no
i forgor
u need to go through sysfs
cat /sys/bus/pci/devices/location here/device
obos only tries to initialize these device ids, so ig it's incompatible
static uint16_t device_ids[] = {
0x8161,
0x8168,
0x8169,
0x8136,
};```
and out of the 4, it's only been tested on the RTL 8169
if i could i would support all realtek cards that fall under the 'r8169' linux driver
but i am too lazy and there is no way to test it and no reward
evalyn@EvalynPC ~ cat /sys/bus/pci/devices/0000:0a:00.0/device
0x8168
it is supported then
sick
i know for a fact it works on the rtl8136
as that is my laptop's NIC which is what i used to test the obos network stack before i added the e1000 driver
btw fuck whoever made IOMMU group 15 on my desktop

it has BOTH my nvmes and my network card and wifi card and the sata ports and the XHCI controller
lmao
this is also partly why i want an HEDT board so the IOMMU groups are good 🙏
well the driver definitely initializes the device
when i do passthrough
but that's just about it
i think something i could do to optimize tcp performance is to decrease copying
and allocation
currently Net_TCPPushReceivedData copies the received data into the intermediate buffer
and then if it sends an ACK it copies all the data in the intermediate buffer into a dynamically reallocated buffer for the tcp socket implementation to read
which might not be ideal
as allocation is quite inefficient (if you ask me)
also the window seems to become full quite often
the rx window
how large is that buffer for the nic?
nic has absolutely nothin to do with rx window
ahh
rx window being full means the peer thinks that it cant send anymore data
ahhh
and it seems like that's happening as obos isn't sending ACKs fast enough
also i finished up on this one 
loll
Does that also have to do with all the extra ACKs?
the extra ACKs is because I dont really know how to delay ACKs properly so i just send ACKs as soon as possible
and they aren't extra ACKs, per se
they are just ACKs that could be put into one ACK packet
Why not have an ACK queue that when it gets full or after a delay it flushes them into one ACK packet?
So you get a packet and add it to the queue or check if it hasn’t been flushed in long enough
no clue why that's happening, im just discarding them now
the solution is to know if the NIC has any more TCP packets for this connection
but im not quite a fan of that solution

What about an ACK timer and an ACK limit
because that makes no sense
Why not though?
i "fixed" the closed windows
too much work
it sends ACKs before trying to queue data in the buffer
now
another probable problem is that the kernel is just slow
or scheduling policies are not being fair to the network stack
Why not give the network stack say 300/1000ms runtime rest be damned to test it
because curl still needs time to run
WAIT I HAVE AN IDEA
ill have the nic have a queue of connections that need an ACK sent on them
and after the network stack is done processing currently available packets
it will go through that queue and ACK everything
give curl another 300/1000 slice amd starve the rest of the system 
how micro we talkin?
very
uOPS level?
maybe
im about to remove essentially every sanity check in critical paths
checks like if (!list) return OBOS_STATUS_INVALID_ARGUMENT;
or smth
what happens when thoes fail?
a page fault
Can you prevent them elsewhere?
maybe idk
Also how does your copy to userspace look like 
I heard you manually checked all the page tables right
not used for read-like syscalls
yeah probably because i told you 
Wdym?
user memcpy is not used for syscalls like read
Yes but like how does the data get to userspace then
status = OBOS_STATUS_SUCCESS;
void* kbuf = Mm_MapViewOfUserMemory(CoreS_GetCPULocalPtr()->currentContext, (void*)buf, nullptr, nBytes, 0, true, &status);
if (obos_is_error(status))
return status;
size_t nRead_ = 0;
status = Vfs_FdRead(fd->un.fd, kbuf, nBytes, &nRead_);
if (nRead)
memcpy_k_to_usr(nRead, &nRead_, sizeof(size_t));
if (obos_is_error(status))
{
Mm_VirtualMemoryFree(&Mm_KernelContext, kbuf, nBytes);
return status;
}
Mm_VirtualMemoryFree(&Mm_KernelContext, kbuf, nBytes);```
it maps a "view" of the user buffer
then it does the read
and then it returns
and it's as shrimple as that™
This seems slow 
Why don’t you try my fancy cool method
That’s faster
And maybe help the TCP stack

because KPTI
Huh?
How does that work
except for the bare minimum for a context switch into kernel mode
context switch meaning IRQ or syscall
True
e.g., the isr stubs or syscall trap handler are mapped
but not driver code
or anything else
memzero(Arch_MapToHHDM(cached_root), OBOS_PAGE_SIZE);
// Map the ISR handlers.
map_range(cached_root, (uintptr_t)&Arch_StartISRHandlersText, (uintptr_t)&Arch_EndISRHandlersText, BIT(0));
// Map Arch_KernelCR3
map_range(cached_root, (uintptr_t)&Arch_KernelCR3, (uintptr_t)(&Arch_KernelCR3 + 1), BIT(0) | BIT_TYPE(63, UL));
// Map CoreS_SwitchToThreadContext
map_range(cached_root, (uintptr_t)&CoreS_SwitchToThreadContext, (uintptr_t)&CoreS_SwitchToThreadContextEnd, BIT(0));
// Map kernel stacks.
for (size_t i = 0; i < Core_CpuCount; i++)
{
cpu_local* const cpu = Core_CpuInfo + i;
map_range(cached_root, (uintptr_t)cpu->arch_specific.ist_stack, (uintptr_t)cpu->arch_specific.ist_stack + 0x20000, 1|BIT_TYPE(63, UL)|2);
}
// Map cpu local structs.
map_range(cached_root, (uintptr_t)Core_CpuInfo, (uintptr_t)(Core_CpuInfo + Core_CpuCount), 1|BIT_TYPE(63, UL)|2);
// Map IDT
extern struct idtEntry g_idtEntries[256];
map_range(cached_root, (uintptr_t)&g_idtEntries, ((uintptr_t)&g_idtEntries) + 0x1000, 1|BIT_TYPE(63, UL)|2);
extern uintptr_t Arch_IRQHandlers[256];
map_range(cached_root, (uintptr_t)&Arch_IRQHandlers, ((uintptr_t)&Arch_IRQHandlers) + sizeof(Arch_IRQHandlers), 1|BIT_TYPE(63, UL)|2);
// Map syscall trap handler.
extern char Arch_SyscallTrapHandlerEnd;
extern char Arch_SyscallTrapHandler;
map_range(cached_root, (uintptr_t)&Arch_SyscallTrapHandler, (uintptr_t)&Arch_SyscallTrapHandlerEnd, 1|2);```
this is the only kernel memory mapped in user mode
this does make any syscall or IRQ extremely slow
because it has to change cr3 twice
im gonna open the SDM and read on PCIDs
how do PCIDs work
like very stupid
yeah and your doing it without so 
something something TLB
blah blah
x86 sdm 3a 5.10.1
read up
it's a spectre/meltdown mitigation
ahh 
also it's the only possible thing on some architectures (i.e., m68k)
linux does it?
yes
damn, this sounds like it will be a PITA to implement 
the m68k has two separate page table registers
urp and srp
urp is the page table it uses while in user mode
and srp is the one it uses in kernel mode
making it theoretically only possible for the kernel to look at user memory through a view (which i already do)
unless of course srp and urp are always the same
though who cares about spectre/meltdown 
and without PCIDs 
i did it without PCIDs because i had no idea what those were/didn't give enough of a fuck
just committed everything 
after i merge the xhci-driver branch obos is probably gonna reach like 75k loc
how exciting
man the burning urge to rewrite major parts of the kernel
it's starting to get to me
make OBOS-3
OBOS6
OBOS69
if i were to rewrite one day i would have the exact same syscall api+abi
because i am too lazy to port mlibc again
do binary compat

miniOBOS
microminiOBOS
if i wrote a slow monolithic kernel
then i am probably writing a really slow microkernel

ok if i were to rewrite the vfs that would cost me 10k loc
mm: 4k loc
driver interface: 2.3k loc
scheduler and synchronization primitives: ~3k loc
x86_64 functions: 9k loc
network stack: 5k loc
allocator: 500 loc (the allocator is fast enough so im not too worried about it)
irq+timer interface: 1k loc
drivers: 12k loc
and that is everything important
the shittiest code quality in all of these is probably the code under arch/x86_64
t'was written very lazily
it would also be arguably the easiest to rewrite
maybe if you make a new kernel dont go for a m68k port too?
probably
my plan was to do a seperate 32bit kernel forked off my main one
my kernels internal name is gonna be called kernel
and the 32bit one woll be kernel32
ic
as seperate will mean they can be better optimized for the bit shite
ic
u should not be using HHDM enough that it is impossible to stop using it
evalyn so should i do a rewrite of all x86_64 specific code
it's your choice how i decide to waste the next 4 days
let me see how bad it is first
what is this 🙏
look at how nice this is
but @flint idol you know what id rather you do
u dont have to use all 256 vectors
i dont
i do it all in asm because why would i make the C code do that
and add a layer of indirection
true i dont always have to but thats a quick check
hm?
you mean the switch case
and use a table?
i have plans to do that
no i mean the whole dispatch_interupt
yeah
until you do
speak not about "messy code"
true
^
swapgs in asm
alright
🥀 is your kernel not architecture-separated

