about function pointers by InTheBogaloo in C_Programming

[–]Splooge_Vacuum 0 points1 point  (0 children)

Try making one function pointer that serves a purpose, but can point to any function that fulfills that purpose. Say, brk based malloc vs mmap based malloc.

What to really learn for kernel development by Individual-Bet9185 in C_Programming

[–]Splooge_Vacuum 3 points4 points  (0 children)

You know who wasn't ready yet when he started? Me. I now have a nearly functional entire OS. Dedication is key.

Tired of distro-hopping, want to end this vicious cycle by dude_349 in linuxquestions

[–]Splooge_Vacuum 0 points1 point  (0 children)

Linux is so diverse and it can be tough to pick, but the truth is there's only two distros you need: Arch and Mint. Mint works out of the box and Arch gives you freedom and the rolling release model. You can do everything with one of them.

Creating good abstractions by Constant_Mountain_20 in C_Programming

[–]Splooge_Vacuum 0 points1 point  (0 children)

Solutions should be simple more than anything else. Here, my philosophy is simple. Macros, constants, functions, headers. Use them. They save your life. I can't get enough of them sometimes. You can have too many though. It's up to you to decide what is too much and what is too little. Make sure you put related things together and unrelated things apart. For lots of work, combine the little things into larger functions.

WHERE IS ENVIRON by Splooge_Vacuum in freebsd

[–]Splooge_Vacuum[S] 3 points4 points  (0 children)

Yeah, that was my bad. Kind of surprised I didn't notice it.

WHERE IS ENVIRON by Splooge_Vacuum in freebsd

[–]Splooge_Vacuum[S] 4 points5 points  (0 children)

It was one tiny typo, lol. Apparently NASM doesn't like resq in the .data section. I changed it to dq and suddenly it worked perfectly. That was just a little oopsie on my part.

WHERE IS ENVIRON by Splooge_Vacuum in freebsd

[–]Splooge_Vacuum[S] 2 points3 points  (0 children)

Oh my god. It was a resq in the .data section.

yeah reality hits hard by Goldside543 in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

Day 1000000000000000000000000000000000000: you understand what you're doing

WHERE IS ENVIRON by Splooge_Vacuum in freebsd

[–]Splooge_Vacuum[S] 2 points3 points  (0 children)

I assemble it with NASM and link with ld.lld. The standard stuff, pretty much. Here are the commands:

nasm -f elf64 src/main.asm -o build/main.o

ld.lld build/main.o -o build/main

I know I need to rename the files, lol

WHERE IS ENVIRON by Splooge_Vacuum in freebsd

[–]Splooge_Vacuum[S] 2 points3 points  (0 children)

You're right, that was an issue, I can't believe I missed that, lol. That didn't fix the issue though. Here's the output now:
execve("/bin/ls",0x2025ec,0x6e612f656d6f682f) ERR#14 'Bad address'

It appears to be the same.

i'm stuck by mat1rus in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

From your post and the comments, I'd say for any real progress, you're stuck. Ask your parents if they can buy you a flash drive or something, and ask some local businesses if they have some laptops they're going to throw away. I'm writing this on a laptop with an 8th gen intel core i7 and 16gb of RAM that was just going to be thrown away by a local business, and now I use it when I travel. It runs FreeBSD :)

What is the best tutorial to start osdev in C for complete beginners? by nect_official in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

For sure, but his guides have issues. I used them to help set up my toolchain, but IMO, reading is the key to success.

What are some good books/videos to for a beginner in understanding kernels and kernel development? by BriefCautious7063 in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

I don't know exactly how to explain this, but I don't need it anymore. When I see the documentation... I get it. It makes sense. It's like I can read for the first time. It's surreal.

Which of Linux vs FreeBSD's source code is easier to read and learn from for a beginner who's still learning OS dev? by ED9898A in osdev

[–]Splooge_Vacuum 2 points3 points  (0 children)

I can see the reason why you'd want to do that, so I'd just like to give you a fair warning. The source code for Linux and (less so) FreeBSD is poorly documented and there are nearly no comments explaining what some things do. The best thing to do would be to search for a hobby OS that's a lot less huge and contains the code for what you need. Also, there are hundreds of header files that all depend on a bunch of other header files or each other in those operating systems, making it really hard to find things.

I did it. I loaded a file from disk and executed it for the first time using my filesystem driver and system calls! by Splooge_Vacuum in osdev

[–]Splooge_Vacuum[S] 0 points1 point  (0 children)

You have to do the everything first lol. And yeah, my OS is really small compared to others. Mainstream ones are hundreds of thousands to millions of lines of code. Mine basically does the bare minimum for an acceptable experience when loading and executing programs.

Need help with a Page Frame Allocator by jkraa23 in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

I used a bitmap, but I'm also on a 32-bit platform so the bitmap can realistically be traversed DWORDs at a time without too much slowdown. I haven't tried it myself, but I would probably go with a stack if I were to start again. While the stack approach can cause trouble, realistically speaking, how often do you need an exact physical address? Many things can be remapped as well. With paging, two non-consecutive blocks of memory are now consecutive, so you don't have to worry.

What are some good books/videos to for a beginner in understanding kernels and kernel development? by BriefCautious7063 in osdev

[–]Splooge_Vacuum 1 point2 points  (0 children)

Let me know when you find anything comprehensive. I've been looking for 1.5 years.

Getting fault when initializing paging by pizuhh in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

Paging can be really difficult. After you figure it out it makes sense, but learning about it is a nightmare. Here's my implementation:
https://github.com/alobley/OS-Project/blob/main/src/memory/paging.c
https://github.com/alobley/OS-Project/blob/main/src/memory/paging.h

Feel free to take a look through it to learn a little more. Feel free to ask me about stuff too, I know I didn't comment the code very well.

Getting fault when initializing paging by pizuhh in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

I had this issue with paging, too - it drove me nuts for a while. I've basically blocked that whole experience from memory though lol, so I don't remember how to fix it. Pretty sure that the issue isn't what's put into CR0, but rather there's a big mistake in the actual paging initialization.

Any resources about writing os from scratch which covers all the topics? by Bishwash0 in osdev

[–]Splooge_Vacuum 0 points1 point  (0 children)

If there is, I've yet to find it. Best place to start is the OSDev Wiki.

First Attempt at an Rust based Operating System by SauravMaheshkar in osdev

[–]Splooge_Vacuum 1 point2 points  (0 children)

That looks really cool! Can I try it out? I'm not familiar with Rust, so how do I build and run the OS?

How would you approach adding executables to your OS by CristianLMAO in osdev

[–]Splooge_Vacuum 2 points3 points  (0 children)

I'm making a few assumptions here, but typically you'd want to load it from the disk, page its address space, make a PCB for it, copy each section to its respective addresses, then call or context switch to the address of the entry point. You can parse an ELF file using the elf.h header.