#Hornet(rewrite, do you remember?)
1 messages · Page 1 of 1 (latest)
for what purpose do you have 166 bit gdt segments?
166 bit?
166 bit?
what? thee is no 16 bit segment
main branch is old
rewrite branch is the new
ah
I have a PFA, but it aint working
eh the only hard part of it is the bitmap functions
maybe theese bitmap funcs are bad?
I'd use a simpler aproach on set function
it works now
it was one bitshift lol
fuck
I pasted the wrong thing
so, now it works
That is... an interesting way to do it
im branchless programming(kk .... kinda) 😎
Wait what exactly are you doing with the bitmap_set function
Are you saving the bitmap[bit] except the bit you want to set into temp, and then ORing with the bit?
Im a monkey, I dont remember my thot process
Well the set function cannot clear a bit
Also the get function is just horribly broken
1>>bitIndex ??
Also clearing a bit is convoluted in your set function
a & ~b clears all the bits in b from a
I added PCI device exploration, now it has most of the old kernel's features
Why are your commas like that
so now it crashes loudly?
I added keyboard input but it does not really work?
paging falut!
whats the problem with that?
is page falut that much better?
I can read ur mind lmao
paging falut
falut
walk the stack until you encounter 0, and print the rip values along the way
(if you use limine, rbp is always 0 when calling the kernel entry point, hence rbp value of 0 can be considered the "end")
Hello, this is an OSDEV studying day for me, so can you please link resources related to ACPI and VMM?
ACPI: don't bother tbh
VMM is not that complicated either
wdym either
for a vmm, I can recommend taking a look at the sunOS and vms vmms. There's plenty of write ups and papers online about them.
for acpi it depends what you want to do. The tables give you some config details about the current machine, depends what you want to know. For anything beyond you're going into the deep end and will probably want something like lai/acpica. The acpi specs are freely available online, the tables are documented under the software interface iirc.
the gist of it is it manages the address space for the kernel and each process
how it does that is up to the implementation
also you can make your VMM arbitrarily sophisticated
that's the gist of it
CoW, demand paging, swapping and compression are features implemented on top of your vmm
but at least a substantial part of their implementation is part of a VMM
that's not on top of a vmm
that is what a vmm is
the "vmm = page table data structure implementation" thing is a big misnomer in hobby osdev
it's such a tiny and trivial part of it that there are many kernels where it's not even a separate discrete component of any kind because all you're doing is setting pointers a few levels deep which you can easily do inline with the logic of the actual vmm
those are the VMM?
or those are parts of the VMM
those are commonly implemented features of vmms
u mean a page frame slapperer into page table style vmm like 1979 unix 32/v
yea sure
actually even that was more sophisticated since it still had swapping just of entire processes at a time
reading this https://wiki.osdev.org/XSDT for ACPI is literally enough to get started, and surprisingly even the code to find SDT's isn't too bad or incomplete. The tables you might want for start are RSDT/XSDT, MADT and later on maybe even FADT. However please note that ACPI is not worth doing if you don't plan to do power management stuff or enabling APIC
what do you think is the minimal VMM?
like a vmm with no features of any kind to optimize memory usage for instance
ah
I added a reg dump to the panic screen
the regs clobbed together without a space after the comma makes it hard to read
FUCKING HALT!
it was @heady mulch 's idea lol
yo chat is this rizz tho?
?
do I need working ACPI for multiprocessing?
You'll need the lapic ids of the other cores to start them, which means parsing the madt. So yes, you'll need the tables, but not the other cruft.
Not sure if you use limine, but the protocol can also start the APs for you.
I do use limine cuz its easy
but you still need to know the lapic ids to utilize them, no?
Limine tells you their ids in the feature response
But yes, you need them to talk to the lapics
ohh limine has everything i see
Local APIC.
There's also the I/O APIC (IOAPIC) which allows you to communicate with legacy devices such as the keyboard and PIT
Please use the LAPIC timer for accuracy. If you can't use a different timer to calibrate it (such as HPET) or otherwise determine its frequency (as Linux does), you can fall back on the PIT to calibrate it in polled mode.
the ioapic is only for legacy external hardware interrupts
ok, where can I read about it?
if thats ur opinion, the optimal amount of words to say is 0
what?
im tired of ppl saying "just google" or smth like that
If you don't want to be constantly told to "just google" something, just ask Google what you need before asking the questions in the first place
Will save a couple of headaches
The "where can I read about it?" question is what google is designed to answer - linking you to webpages with the information
oh, ye I found it instantly on google
ty
should I remove the PIT or keep it?
I'd say remove support for it, except for calibrating the APIC in polled mode when you have nothing else.
uhh, how do I enable it? is there a non-osvev.org resource on it?
or just about the lapic in general
what, apic?
you write to the 11th bit of the IA32_APIC_BASE_MSR
set it to anything above 0x20
i don't know what exactly happens when you set the offset at 0, but it could clash with exceptions
Im refactoring cuz the code quality is awful
also, Im trying to make myself pay attention to warnings
there was countless times I made stupid mistakes, that could have been easily combated by paying attention to the warnings
they are warnings afterall
You can add -Wall -Wextra -Werror in your CFLAGS
that way even if you don't see any error during compilation, GCC will just error out
is Weror needed?
I would think its kinda annoying
Ill give it a try anyways
I keep accidentally closing vscode wtf?
i would suggest keeping -Werror out in any circumstance but development
it's bad practice to leave it in the default CFLAGS
because compilers may add warnings in the future and your stuff will stop building
you can leave it there for bochs
I fully integrated serial to the kernel
now the debug log uses it
this is how it looks:
I made a simple init system
here is the game plan:
the kernel will read /boot/kernel.cfg
the init system will be baked into the kernel
after the init system is done, it will start the login prompt
of course the login prompt will be able to be replaced by any program
then, the init system will initialize the enviroent, now logged in as a user
so it will be fully customizable
is this a good game plan?
(for a general purpuse kernel)
how to write scheduler?
round robin.
wut?
A type of scheduling algorithm. https://en.m.wikipedia.org/wiki/Round-robin_scheduling
Round-robin (RR) is one of the algorithms employed by process and network schedulers in computing.
As the term is generally used, time slices (also known as time quanta) are assigned to each process in equal portions and in circular order, handling all processes without priority (also known as cyclic executive). Round-robin scheduling is simple,...
It’s pretty easy to implement, there are some other articles you can find that will help with that
ty
Actually task priority is usually implemented by having several queues, as is done in Windows NT
So you only need a couple of round robin queues for your task's priority
no I said that it has several queues, not that it uses round robin
it might, but I can't say for sure yet
as many queues as there are priority levels
From top to bottom
the highest priority tasks always go first
if you make a CPU intensive process a "realtime" process, that core is nuked
Im doing the scheduler
but first, I need a periodic interrupt
Im thinking of leaving the APIC alone and using the Realtime Clock instead
cuz acpi is hard
hmm, why isnt the XSTD there?
QEMU only utilizes RSDT iirc
umm, then what the fuck?
how do you check for an XSDT?
like this?
if (rsdp->revision == 0) {
_xsdt_is_available = false;
rsdt_init();
} else if (rsdp->revision >= 2) {
_xsdt_is_available = true;
rsdt_init();
}
no, I dont have the else if
I have just else
it says it found the RSDP on OVMF
cuz I have a UEFI testenv too
that uses OVMF
nope, Im blind
it crashes on the checksum test
[INFO=]PCI Devices:
[INFO=]VendorID: 0x8086 ,DeviceID: 0x1237
[INFO=]VendorID: 0x8086 ,DeviceID: 0x7000
[INFO=]VendorID: 0x8086 ,DeviceID: 0x7010
[INFO=]VendorID: 0x8086 ,DeviceID: 0x7113
[INFO=]VendorID: 0x1234 ,DeviceID: 0x1111
[INFO=]VendorID: 0x8086 ,DeviceID: 0x100e
[INFO=]RSDP found
[FATAL]Paging fault
[INFO=]RIP=0xffffffff800036dd ,RSP=0xffff80000e417fc0 ,CS =0x0000000000000008 ,SS =0x0000000000000010
[INFO=]RAX=0x000000000fb7d0e8 ,RBX=0x00000000000000f4 ,RCX=0x0000000000000100 ,RDX=0x00000000000003f8
[INFO=]RSI=0x000000000000000a ,RDI=0xffff80000fb7e014 ,RBP=0x0000000000000060 ,R9 =0x00000000ffffffff
[INFO=]R10=0x00000000ffffffff ,R11=0x00000000ffffffff ,R12=0x0000000000000057 ,R13=0x0000000000000000
[INFO=]R14=0x0000000000000000 ,R15=0x0000000000000000 ,ERROR_CODE=0x0000000000000000```
unsigned char sum = 0;
for (uint32_t i = 0; i < table->h.Length; i++) {
sum += ((char *)table)[i];
}
return sum == 0;
}```
this is the checksum
the page table is the stock limine one
oh, I see you typing out exactly the right answer, in a complicated manner
sum += ((char *)table)[i];
converting the table to a char array and adding that might cause the issue maybe?
I was just trying to get my words together lol
you might want to retype it to uint8_t (sum is uint8_t as well)
retype what?
i?
sum += ((uint8_t *)rsdp_request.response->address)[i];
I meant cast ;-; Just in my native language we "retype" a variable haha
lol
still bad 😦
SCREW ACPI
Im just gonna use the Realtime Clock as a periodic interrupt
but what is the frequency of it?
uint8_t xsdp_checksum = 0;
uint8_t *xsdp_ptr = (uint8_t *)rsdp_request.response->address;
for (uintptr_t i = 0; i < sizeof(xsdp_t); i++) {
xsdp_checksum += xsdp_ptr[i];
}
assert((xsdp_checksum & 0xFF) == 0);
taken from luxe
so like this:
uint8_t xsdp_checksum = 0;
uint8_t *xsdp_ptr = (uint8_t *)table;
for (uintptr_t i = 0; i < sizeof(struct XSDT); i++) {
xsdp_checksum += xsdp_ptr[i];
}
return (xsdp_checksum & 0xFF) == 0;
}```
right?
cant belive, it works...
like this
but it still crashes on OVMF???????????
what the hell?
wait I just noticed that
you're computing the XSDT checksum
However the checksum is written for XSDP
what is the difference?
XSDP is a Pointer, while XSDT is the Table to say it simply
the pointer points to the table?
R/XSDP contains the address to the R/XSDT table
ohh
this good?
if(rsdp->Revision != 0){
xsdt = (struct XSDT *)PHYS_TO_VIRT(rsdp->XSDTAddress);
if(do_checksum(xsdt)){
log_info("XSDT found");
xsdt_entries = (xsdt->h.Length - sizeof(xsdt)) / 8;
use_xsdt = true;
}else{
log_error("XSDT corrupted ,falling back to RSDT");
}
}else{
xsdt = (struct XSDT *)PHYS_TO_VIRT(rsdp->RSDTAddress);
if(do_checksum(xsdt)){
log_info("RSDT found");
xsdt_entries = (xsdt->h.Length - sizeof(xsdt)) / 4;
use_xsdt = false;
}else{
log_CRITICAL(NULL,HN_ERR_ACPI_FAULT,"RSDT corrupted, can not fall back to anything");
}
}```
hmm
this name sounds a bit Hungarian to me
because it is
ok
yeah looks good to me
????
do you map the virtual memory before doing that?
why did you then converted the addresses to virtual ones
gtg eat lunch
xsdt = (struct XSDT *)PHYS_TO_VIRT(rsdp->RSDTAddress);
should then be
xsdt = (struct XSDT *)rsdp->RSDTAddress;
if it's a 64 bit limine based kernel.. no
the HHDM maps all of physical memory
doesnt limine install a page table by default?
btw, why did you take down the luxe gh repo?
interesting... that opens up even more stuff that could be/go wrong then
try looking what's at the rip
why do it manually, If I have GDB?
lessgoo
the stack is now not fucking up
got the periodic interrupt
anyways
part 1
of scheduler done
part 2: write a queue
how the fuck do I do that?
@proven horizon how do I write queue for a schedualer?
screw it
ill try
an array of tasks which the scheduler goes through
once the scheduler reaches the bottom of the array (the last task present) it goes back and executes the first task in the array (kind of "execution in a circle" - hence the name "round robin")
the queue is done
lets test it!
but how?
I guess I cant test it
I will just wing it
and hope its not the queue
also, I didnt expect to make it this far into the project
I thot I would be hell burned out after a week
but no
create a simple function that prints something
and pass the function pointer as an entry point for the scheduler
what
yoo wait
you are in games with gabe server too right
buth his newest project is boring as fuck
The animation editor?
and you used to be part of my community, but you left cuz my server is ded
yes
huh?
what
I remember, you dnt?
waht is your project here?
jeff? what kind of name is that?
and how is it?
I also cant answer that
Can you send an ss of your os?
I want to see
Your readme says you have audio support but no gdt lmao
REWRITE BRANCH
holy shit
fuck capslock
wait did you resend the message
lmao you sent "that is old, see rewrite branch", deleted it and sent "REWRITE BRANCH"
oh, you have msg logger
No, I literally remember you sending a message
oh
is this OK or should I do it another way?
Registers status;
//TODO:add more stuff
} process_t;
static bool is_active;
queue(uint64_t,process_queue);
vector_static(process_t,processes);
void sched_enable()
{
is_active = true;
queue_init(process_queue,uint64_t,500);
vector_init(&processes);
}
void kill_process(uint64_t ID)
{
processes.data[ID].status.rip = 0;
}
uint64_t create_process(void (*process_main)())
{
Registers newregs;
newregs.rip = (uint64_t)process_main;
vector_push_back(&processes,{newregs});
queue_add(process_queue,processes.len);
}```
for kill process you literally set rip to 0
.... just remove from queue
I cen only remove it if its at the front
so Ill do the removing in the schedule function, that Im just about to write
this should work right?```void schedule(Registers *regs){
if(!is_active)
return;
memcpy(&processes.data[current_process].status,regs,sizeof(Registers));
while(true){
if(process_queue.fullness == 0){
log_CRITICAL(NULL,HN_ERR_UNIMPLEMENTED,"No more processes to execute, ideally, we should shut down");
}
uint64_t next;
queue_remove(process_queue,next);
process_t nextproc = vector_at(&processes,next);
if(nextproc.status.rip != 0){
memcpy(regs,&nextproc.status,sizeof(Registers));
current_process = next;
queue_add(process_queue,next);
break;
}
}
}```
ok. wtf?
what do you mean by escaping the scheduler?
nothing
It was just me being stupid
but...
WHAT THE HELL IS THE THING THAT I GAVE YOU????
god damn
oh, my logic is bad
HOLY SHIT IT FUCKING WORKS
LESSGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
lets see how it does with multiple processes
what
wft?
the PIT stops sending the periodic interrupt wtf
after we enter the first process
How are you setting up the rflags?
wtf does rflags has to do with interrupts?
There is an interrupt enable bit there, if it is not set interrupts are blocked
I made that mistake when writing my scheduler
oh
well
I dont initialize rflags for the initial process state
so thats the problem
Should usually be set up to 0x202 to set IF and the reserved (must be on) bit
See this article: https://en.wikipedia.org/wiki/FLAGS_register#:~:text=their smaller predecessors.-,FLAGS,-[edit]
The FLAGS register is the status register that contains the current state of an x86 CPU. The size and meanings of the flag bits are architecture dependent. It usually reflects the result of arithmetic operations as well as information about restrictions placed on the CPU operation at the current time. Some of those restrictions may include preve...
ye now it worsk
did you acknowledge the interrupt
oh ok
tysm
imma list the still uninitialized varibles so you can make me aware if it can cause problems
lol, there are none
the rflags was the only one
As long as IP, SP, CS, SS, and Flags are initialized and valid values you should be good
I think this is the point where h0r.net isnt a toy kernel anymore
cuz now it doesnt just initialize hardware, but it actiually uses it
so yeah
Yeah, from that point on you can do whatever you want with your OS really
Are you going to do a unix-like design or something else?
something else
What kind of design?
custom
Oh ok. how do you plan on porting software?
Frankenstein design
Interesting
it will lean twoards unix
Do you have a ramdisk or other filesystem?
I would recommend doing that next, ramdisk is really easy, especially tar format. You can start to actually parse ELF files
Tape Archive Format, yes. Most people think it's for compression but that's really just an extension
In reality it's a way of lumping files together into one file (or tape) which is super easy to parse.
You can implement it in an hour, max. Depending on if you can already load modules using your bootloader.
I use limine so I can load modules
Yeah, once you can do that tar is super easy
MSI/MSI-X = Message signaled interrupts
https://wiki.osdev.org/PCI#Message_Signaled_Interrupts:~:text=skip complicated ACPI.-,Message Signaled Interrupts,-Message Signaled Interrupts
It's something to do with PCI I guess
ohh
How do I know what these variables are in my kernel
I just copied the gdt from lyre because I thought it was a one time thing that I dont need to waste time on
Rip and rsp I understand
Do ip and ss also have to be set or can I just set rip and rsp?
They are registers. IP is instruction pointer, it’s the same thing as RIP. SS is stack segment, which should be set to the data segment offset in your GDT
i can safely say that the rip should point at the entry point of a program
im adding hornet.conf
so it can be configured
but first, Im making a library
basically just kernel utils
so its easy to make kernels if ur new
also for me in the future
is there anything I missed?
prob <limits.h>
im not sure if that's included in stdtypes or not though
lessgoo
the lib is ready
Imma make a new post about it
okay, made new post
back to h0r.net
tar
first, I need an initramfs to load
@proven horizon how can I make a tar file with the simple tar not USTAR?
man tar
hmm
so if there is only one file
it crashes at the end
cuz there is no more at the end
HOW THE FUCK AM I SOPPOSED TO KNOW THAT IT ENDS
oh
file size
right
lessgooo
it works
@proven horizon Im done with tar
it works
now I have to figure out wtf happened to my pid 1
it now spams fsr
hmm, but the only thing I did is I removed 2 create process calls
hmm
WTF?
ooh
fixed
Congrats
You're making good progress
Are you going to do userland stuff next or something else?
Im thinking of yaml and NBT parsers
but yaml looks hard
and I never looked at the NBT spec
For your kernel config files?
yaml for config , NBT for registery hives
Why not just do INI or some other simple key value structure, you can parse it easier
cuz its flexable
maybe Ill try json
I would say for configs for a kernel, INI is probably better but JSON also works
screw it, Ill do INI intead
ini parser almost done 😉
You were making a config file for your kernel right
Also add these configs to kernel args in limine
And allow the kernel args to override the config files
So when I forget a password or something I can just change the kernel to some password change mode in kernel args in limine and change the password
It's just an example
You can do other things
ok ok
the ini parser does not work
Link the github I can take a look if you want
also this is in libkrnl so we want to move to https://discord.com/channels/440442961147199490/1150791486921777243
However you want. Here are some design models for a VFS https://wiki.osdev.org/VFS#:~:text=Database file systems.-,VFS Models,-Indexed (*%2DDOS/NT
actually, Imma just upgrade the tty, cuz its really not usable
(Imagine mint jumping in and saying "Just use flanterm")
Just use flanterm
and you did it looooooooooooool
Flanterm actually is pretty good, I use it. Supports all of the escape codes and all of that which makes it quite easy
oh
I would recommend it
This server does advertise Limine a lot I guess
hey btw, have you heard of relying on mint too much syndrome?
like Im afraid Im gonna catch it by putting flanterm into h0r.net
screw it, flanterm time
You could also try SSFN (https://wiki.osdev.org/Scalable_Screen_Font) but Flanterm is easier to set up
The main benefit of SSFN is it supports unicode so foreign languages display correctly
so, should I do it?
Sure
wtf is a framebuffer's pitch?
uhhh
how do I do this?
wait, I can just copy from halihacker
he uses this same config
sorry
that sounds terrible
i would assume just flanterm_write(&character, 1);
oh, ty
is there a way to clear the sreen?
is this how flanterm sopposed to look?
just asking
yes
cuz it looks great actually
you can change the font if you want, or colour palette, etc
does it scroll?
yeah of course
hell, it runs like
80% of what the average Linux terminal emulator runs
including nano, vim, nyancat, etc
and it is quite performant
without weird hacks
unicode?
it supports a subset of unicode
it understands unicode but most characters will result in tofu if they are not part of codepage 437
hm?
flanterm does not have a gitignore because it doesn't have a build system
limine-barebones has proper gitignores
oh ok
if you dropped the flanterm C files in a repo with proper gitignores and build systems, it won't be an issue
well i assume your editor shows it that way because you cloned the flanterm repo into your repo
I submoduled it
alright, same thing
though git adding in your base repo shouldn't affect the flanterm directory
even if it shows like that in your editor
one way to fix this is by doing out of tree builds
but that is beyond the scope of limine-barebones
I've had serious issues with flanterm's scrolling in QEMU though
which issues?
after the screen fills up, you could literally see each line getting pushed upwards which slowed down the entire thing
but it does work just fine on real hardware so I just disabled flanterm when running in QEMU
idk, it's quite fast for me in qemu, like virtually faster than anywhere i tried it on real hardware
so i am not sure what's going on there
if you want to double check, go get the lai test image and see if it's slow there as well
my keyboard driver seems to be bad
cuz, I press a on my custom prompt and nothing happens, digging deeperthis is how a keypress looks like(the right number is the output of KEY_IS_PRESS)
lol
I forgot about this custom banner
I think its just KEY_IS_PRESS
really?
the relase KEYBOARD_RELASE value was wrong
now I need a sleep func to make typing not be impossible
I have the PIT sleep func now
@tight summit how do I do backspace with flanterm?
\b
so 2 backspaces in a row clears screen?
space in the middle, and no
i mean to clear a character
like pressing backspace in a terminal
if you want to clear the screen there is another escape sequence for that
oh
\e[2J\e[H
what the FUCK?
hm?
Is this your first contact with these?
yes
tbh I had fun implementing them in my terminal emulator
I got a little experimental kernel shell running
here are all features
this interactive env will help me make the VFS
I'd load an executable from a module first and then use that
this is temporary
and I alredy hade the code for it
anyways
lets actually make a proper VFS
Im taking a break from h0r.net
I have been developing for 2 weeks straight
also fuck paging
Imma just act like its 2001
not that difficult
when was paging implemented then?
Depends, you can probably go back to the 60s.
But basically every 32-bit PC ever made has it.
By 2001, I'm pretty sure 99.9% of people moved on from 8088 and 286 PCs.
The 386, the first x86 processor to support paging, was released in 1985, and was first used in commercially available PCs in 1987.
In the early 90s, 8088s and 286s became increasingly rare.
Windows dropped support for 8088 with the release of Windows 3.1 in 1992, and Windows NT always required at least a 386.
Windows for Workgroups 3.11, introduced in 1993, and every subsequent PC version of Windows required a 386 or higher and made heavy use of paging.
Anyways
Paging makes a lot of things easier, not harder.
maybe I should het off the Poncho drugs and read something actually useful
okay. any resources? so I can actually understand it?
the page tables simply map each page of the virtual address space to physical pages... or don't (if the present bit isn't set)
but instead of pml4, pdpt, pd and pt (names used by the SDM) you can use pml4, pml3, pml2 and pml1 so it is a little less mind numbing
@tardy mist what the fuck is this log
ini test
"testicles" starts with test yk
🤣🤣🤣🤣🤣
I implemented a get_file func
by the way how fast you implement stuff I'm starting to get worried about the code quality tbh
you can see for yourself
its on the github
wdym?
as in: some functions named in snake_case, some combine capital letters (snake_CASE), and then some functions are PascalCase
also the coding style varies from file to file:
one has
if(cond){
expr
}
another one
if (cond) {
expr
}
and
if (cond)
{
expr
}
well it still is something that might raise questions (especially if the code really is yours, and not just a frankenstein of different projects)
what is wrong with being inconcistant?
nothing in terms of functioning - it all gets compiled to the same instructions regardless
the thing is code readability: it's a lot easier to maintain a large repository with a clean, set coding style
and don't take this the wrong way, it's going to help you (and others interested in contributing, like me) get oriented in the code easily
I mean code style is very subjective (as to where do you like to place braces etc.), in the if() case I meant mostly consistency
how do I finish this?(tar header to vfs node conversion)
idk, never got to vfs stuff in the first place and i haven't studied your impl enough
but I'd say that tar_get_file_header should actually read the file, and get the file's header (and not the metadata)
the
VFS
is
complete
Im not gonna hook it up yet
ill do it tomorroe
its enugh work alredy
so
Listen to all soundtrack: https://materia.to/deltarune2ID
Deltarune is another game made by Toby Fox who also made Undertale
Get the game here
https://www.deltarune.com/
https://store.steampowered.com/app/1671210/DELTARUNE/
Get the soundtrack on Toby Fox bandcamp
https://tobyfox.bandcamp.com/
becauseeee I want to
I got a simple VFS working, but Im still debugging
anyways I committed the changes
I hate debugging
does anyone know some background noise or music that makes me not want k*ll myself while debugging?
https://github.com/lolguy91/h0r.net/blob/1e4b8678219d676b154ad114bd7beebd2ffe8f3f/src/VFS/vfs.c#L54C80-L54C80 what is this supposed to mean? @tardy mist
it looks for the next part of the path in the folder
like "if this string is the same as the other string, do this"?
yes
that would need to be if (!strcmp(...)) then
why?
wait no, you're using your own implementation
yeah
a really weird implementation tbh but yeah
what are you debugging? i've got some time so i could also take a look at it
Im noöt adebugging anything rn but the tar parser cuz it stops at the bin folder fsr
its inb vendor/libkrnl-essentials/parsing/tar.c
(the lib is made by me)
so what did you find? did you even look at it? did you lie?
i didn't really find anything wrong
oh ok
just curious, is this supposed to align the size to 512 bytes?
if (size % 512)
_header += 512;
(it's in the parse_tar function)
yes
(_header + 511) % 512
that would not align it properly however
if you had a size of, say 513, adding 512 would result in 1025, which again isn't aligned
if (!((struct ext_dir*)folder_contents->ext)->files[i].flags)
{
break;
}
this is failing
soo there's something wrong with setting the flags for files when they are detected
also the cd command is broken
it was just a quick sanity check for this
oh ok
hmmmmm
I added event system
its not very important rn
but I want my kernel to be event based
event BASED lol
Subscribers? Isn't that like, YouTube???
Well on YouTube you subscribe to a channel and get notifications everytime they post
which is an event
so... I guess yeah?!
Yeah I know lol
don't forget to subscribe, hit the bell and smash that like button, it helps the channel a lot, thank you and let's continue with the video
you forgot to put the "This is so sad" at the start
forgot to put the "gone wrong" after that
yes
its basically youtube yeah, but the subscribers are function pointers no account IDs
Oh alright
forgot to put the OMG COPS CALLED 
and if it was 2017, also a clickbait thumbnail and a title with the "so i did (something not even related to the video)..." (the three dots at the end are important)
but in 2023 it's just some words are written with caps, also if you can put an arrow and a question mark, then do it
"DON'T CALL AMONG US AT 3 AM... (gone wrong)"
I hate debugging
that stupid tar parser isnt working right fsr
why???
why????????????????????????????????????????????????????????
what the hell??
it was the pointer arith
me = stupid
very stupid
gdb
Does the visual studio code plugin native debugger cout as gdb? if yes, then Im alredy using it
I fixed it
oh nice
but there is another bug
*2 more bugs
first
why is this true when path is bin/cum and filename is bin/?
strncmp(path, (char*)hdr->filename, strlen(path)) && !strcmp(path,(char*)hdr->filename
check for strncmp to be 0
my impl doesnt follow the spec
it just returns true if they match and false if they dont
that strncmp's return value should be checked to be zero
if it is then it's a full match
his implementation does not follow the specs though
yeah
@tardy mist do you support APIC yet?
I am clueless
I gave up on ACPI
check the qemu logs for interrupts
and use addr2line
on the offending address
not ACPI, I mean APIC (replacement for the legacy 8259 PIC)
but that needs ACPI, so no
oh wait right I forgot
or is there a PIO method too?
The stupid ioapic, I am implementing it right now and it SUCKS
parsing the MADT isn't hard though, shouldn't take you more than 1-2 hours to read the spec and implement it
I think it's a misconception that ACPI for the APIC is really difficult. Unless you do the AML stuff, which APIC doesn't involve.
MADT is just some simple structs and minimal parsing work
The spec is your best friend here even if it seems intimidating at first
try to do that without understanding paging(its enabled by default on limine)
No
Actually the local APIC is accessible via an MSR
or you are talking about the IOAPIC?
but that just involves going through the ACPI headers.. which is NOT complicated
it's just a struct
I don’t understand, what does paging have to do with the MADT?
running AML is complicated (for whatever reason)
It's even doable with the one page on the osdev wiki
add the HHDM offset to each physical address
boom
literally the MADT parsing is just a switch-case inside of a for loop
I get random page faluts when tryin to parse the fucking tables
Yeah you need to map it
You can’t access a random pointer you get from an ACPI table without ensuring it is mapped
does limine not map the tables for you?
rsdp is mapped if you request it
but IG nothing else is
I believe it maps the whole HHDM which includes the tables. But it is mapped to a high virtual address so you need to add the offset to it
offset? the one in my link.ld?
this:
/* We wanna be placed in the topmost 2GiB of the address space, for optimisations */
/* and because that is what the Limine spec mandates. */
/* Any address in this region will do, but often 0xffffffff80000000 is chosen as */
/* that is the beginning of the region. */
. = 0xffffffff80000000;
No that’s the kernel offset. You get the HHDM offset from Limine requests
you are spot on
that is when you realised, you are stupid (litterally me rn)
wierd, it still loops
it loops until it runs out of stack
it works now
listing directory contents is still wierd tho
it does not like empty folders fsr
I need to add cat...
why does it think everything is a directory?
probably wrong flags set?
nope, gdb'd it, and it initializes it like a directory
aaand does cat check for the flag correctly?
yes it does
{
struct node* fileinq = get_file(path);
if (fileinq == NULL) return false;
return (fileinq->flags & FLAGS_ISDIR) >> 1;
}```
Any updates?
how you input when ps/2 keyboard isnt realizated
ps/2 kbd driver is there though
in readme
readmes tend to be outdated
uhoj
uhok*
Will it beat linux though?
i think to beat linux its must have more features
hornet isnt complete >:D
no hobby OS will realistically come as close as Linux's amount of features
but you can come close to (or even beat) Linux in terms of security, functionality and speed
are they mutually exclusive? 
what do you mean by that exactly?
I want it all
Imma focus on functionality first cuz that sounds the easiest
and the most important imho
why is there no XSDT?
Qemu?
Idk then
lessgo, I just had to replaxe the checksum with a signature chack and now it works
nooooooooooo
trying to access one of the tables page faluts
@tight summit does limine not (page) map the ACPI tables for you?
IK it does RSDP and RSDT/XSDT
but what about the other ones?
depends
it doesn't say anything about the ACPI tables, but it always maps the first 4GiB where usually most tables are, and it also maps all other memory map entries, which usually also includes ACPI entries
if the address is <4GiB and you get a page fault, it isn't Limine's fault, assuming you're using Limine's page tables
I add the HHDM offset to the address
i mean physically
that looks non canonical
wdym?
it's an invalid address
oooh
just you wait for the rewrite :p
I have moved development of the VFS into a test enviroment(standard userspace ""application"") for convenience
almost works..
tip: use AddressSanitizer while in user space
that, or Valgrind
what is AddressSanitizer
sanitizes addresses
basically ensures you don't have any memory bugs
nice
I got mounting ro work
hello
hellohacker
With a VFS working you might also want to implement a real FS on top of it
so you can test your OS (including FS stuff/file loading later on) on real hardware
@tardy mist Are you still looking to implement ACPI one day?
I might write something and send you a PR if you want
that would be lovely actually
jusm make sure to add a lot of comments, so I can learn from it
sure, np
@tardy mist https://github.com/lolguy91/h0r.net/pull/17 Ready to merge now
So with this you should easily be able to write code for HPET, MADT and friends
finally got the VFS to work in the kernel
it still uses the test drive
but Ill write a tar driver soon
maybe even mount some ACPI info to /sys/acpi
btw, you noted the log_fatal bug
turns out, I just forgot to initialize my bitmap font renderer 🤦🏼♂️
Haha, might want to add a simple check if it is initialized to prevent this bug😁
I just learned how to use unions in C for type specific stuff
how did my head not explode trying to debug my VFS without this?
finally got cat to work
this thing shows all current shell features
(note: this is the kernel test shell)
bruh, tar vfs driver going well...
ok, now its only **semi-**broken
i like how everything you name refers to dicks, balls and cum
12-13?
am I just stupid or do you really need a fully developed frontal cortex for wrapping your head around the MMU?
because there is always smth I cant explain
maybe its Limine, and If I was to make my own mappings it would be better
but Im too lazy to do that
well it's just a translation unit
(along other things of course)
so you have the kernel loaded in memory at address, say, 0x123456, but it makes it seem like the kernel is actually loaded at 0xfffff8000 something
also it ensures that other processes cannot see the memory of other processes
fucking
finally
it works
LESSGOO
969th message
now
I have to fix up the VMM
Did you implement sleep() to work with scheduler?
I didnt, it just does, but I only have one thread so it wont soon
I have a barebones scheduler
better make it now
than do it after everything on top of it is complete
then you would have to change a lot
it just does?
like rescheduling if sleep?
and adding to sleeping list and that?
I said, it is imlemented in a way, that does not break when I just have one thread
for multiple thereads, its a bit moer komplikated
but I know how
cuz my sleep is just a spinlock with a milisecond counter
what
why the spinlock?
the counter counts down, and the spinlock spins until it reaches zero
oh you have a global counter?
You could try and use interrupts
Wait why are u the op, isnt lolguy making this os
theyre the same i think (alt account?)
well you are using a spinlock and millisecond counter, whatever
Hotnet os conspiracy
but why the lock?
i was hoping for a more... descriptive answer
his answer reminds of a twitter post of french prime minister
"We do not want war" and in the reply of the tweet he writes
"However, ..."
Poncho tutorial
I know its horrible and wastes cycles, but it works
the sleep itself isn't really bad as a starting point
but i'm not seeing the spinlock either
the while loop
isnt it technically a spinlock
__asm__ volatile("movq %0, %%cr3\r\n" : "=r"(nextproc.pml4) :);
is this good?
why does it not work
is the asm the issue?
oops wrong channel lmao
a spinlock protects a resource from being used by another process (or processor) by testing if it is already set (and setting it if it isn't) at one time
so no
I didnt work on hornet today
Because I went to an open day, and won a high end USB pendrive on an IT knowlage contest
and what I did with it?
well, I noticed that it is much faster than my HDD
so I made it my boot drive
Im still using the HDD, but soon, the portable GeekUSB™ will be done!
I redone the error screen again, now its using flanterm
so I got rid of that 2nd font renderer
looks good👍
any updates?
nope lmao
isn't that my vmm code?
how did you not fucking notice?
maybe he didn't look before?
okay
the reason for no update is TSS
working on SMP?
Sorry for the ded-looking project
I just run out of motivation quick
I wil get back to it later
I promise
this is a normal non- message
Im diving head-first into ELF parsing!!
rn, the hornet test playground is just inspecting itself
some progress:
what are you trying to do ?
