neon:
You make a good point. People keep telling me the same thing. It's just hard when passion forces sleepless nights. I have to work on that.
There are two main reasons I want to learn GAS Assembly:
1. Because I like the syntax. movl $0x0, %ax just makes more sense to me than mov ax, 0x0 even though they do the same thing. The order in which they're represented just seems more logical. I'm moving 0x0 into ax. Vs. I'm moving the thing on the right into the thing on the left.
2. Because I'm using GCC as my C compiler, inline assembly closely resembles GAS syntax. As a result it feels more consistent, like it's one big piece of coherent code that's supposed to be part of the same code base. I'm a bit of a perfectionist so it bothers me when I mix NASM assembly with it.
Thank you for the sources. I already had the GDT one bookmarked and downloaded the manual a while ago, but I still appreciate it.
And that makes sense. But with following that previously, my OS just triple faulted. I had to follow James Molloy's tutorial to get a decent GDT, then once I understood it I pulled it apart and build a similar, yet different way of using the same struct he provided.
Octocontrabass:
Well then that might be why I don't know what it is
.
Based off of what you're telling me, trying to do this in 16-bits is not a very efficient way of doing things. I'm starting to wonder why I would even want to use C for this. I'm limited to 512 bytes for the bootloader. If I'm understanding this correctly, that limit will be quickly reached if I try to use C functions. Another thing I tried to do was just use inline assembly in my boot_main, but it still didn't work. I don't know enough about linkers yet to perform any trickery so perhaps that's not an option at the moment.
Ah yes, I found where you're referring to:
"The direction flag DF in the %EFLAGS register must be clear (set to “forward” direction) on function entry and return."
So does that mean I'd have to use CLD before calling the function and STD after? Also, do I need to read sectors to call C functions into memory at this level, or could I get away with holding off on that until later?
Okay that's a relief. I figured I wouldn't, but the way kzinti made it sound, I wasn't sure. In the meantime I will continue doing research and trying to figure this out.