Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
I tried to implement the USTAR filesystem driver for my os and for some reason is not working as I expected it to.
I read this osdev wiki page about it and seems very easy to implement. I tried mapping the tar file sections, adding the tar file to limine config, mapping the tar from limine, the same result.
Trying to read for signature or name will return random data from the memory.
It's because I use Stivale2 PMR?
If is, how I can fix it?
actually adds PAGE_SIZE * sizeof(uintptr_t) to k, not PAGE_SIZE as you expect?
No, it doesn't. k is declared as a uintptr_t, which is an unsigned integer type of pointer width, not a pointer type, so arithmetic is integer arithmetic, not pointer arithmetic.
No, I would attempt to look at the start and end values to see if they make sense.
actually adds PAGE_SIZE * sizeof(uintptr_t) to k, not PAGE_SIZE as you expect?
No, it doesn't. k is declared as a uintptr_t, which is an unsigned integer type of pointer width, not a pointer type, so arithmetic is integer arithmetic, not pointer arithmetic.
No, I would attempt to look at the start and end values to see if they make sense.
Unless I am mistaken, since uintptr_t is not declared anywhere in his/her code, I took it as
Optionally defined standard. Keyword is optionally. :-)
Since there was no reference to <stdint.h> in the original post and a lot of us tend to define our own types when creating OS code, I wanted to make sure they understood that it may not be what they wanted it to be. Also, if I am not mistaken, and if my memory serves me correctly, that type can actually be of a different size that void*.
Anyway, after reading over my previous reply, it might have sounded rude. Sorry, it was not my intent.
22OsC wrote:The output for DEBUG("%d:%s...); is this:
Are you sure that output is correct? Even if you're reading random garbage instead of your tape archive, you should see either different random garbage each time or a null string from reading uninitialized memory (which is zero-filled in typical VMs).
I've seen some tutorials that have extremely wrong code for accessing variadic function arguments...
22OsC wrote:The output for DEBUG("%d:%s...); is this:
Are you sure that output is correct? Even if you're reading random garbage instead of your tape archive, you should see either different random garbage each time or a null string from reading uninitialized memory (which is zero-filled in typical VMs).
I've seen some tutorials that have extremely wrong code for accessing variadic function arguments...
I noticed that. not sure why the string output is the same. The strange thing is that the code has the same results with or without memory mapping and the page fault is occurred only after like 5 minutes of infinite loop.
My guess is that I need some specific compiler arguments for it? With PSF font objects are working without any issues. The memory is already mapped for some reason even that I applied the new PML4
22OsC wrote:My guess is that I need some specific compiler arguments for it?
Probably not. Most likely there's a bug somewhere else in your code, but it's hard to say for sure without either debugging it some more or seeing the rest of your code.
22OsC wrote:My guess is that I need some specific compiler arguments for it?
Probably not. Most likely there's a bug somewhere else in your code, but it's hard to say for sure without either debugging it some more or seeing the rest of your code.
I discovered that it's not a memory mapping issue nor a wrong uintptr_t implementation. I can't load the tar at all. I put the code in the kernel main and the output is the same. With PSF fonts I don't have any issues, only with this tar archive. tar file size is 540,8 kb.
I use this command to create the tar file: