Closed mickeysoft42 closed 8 months ago
My bad; I thought this was a standard header file, but appears VC specific. Looks like some people have made an effort to port it to GCC which doesn't implement certain things like x86 port I/O as built-ins.
Outside of libgcc, there is no standard library available when using an i686-elf toolchain for building an operating system (because you are supposed to compile with -ffreestanding
)
You should not be using any standard header files when building an operating system, because such standard headers would relate to a standard library which does not exist
intrin.h does not appear to be included.
When trying to use one, the compiler says the function is not defined. E.g.: error: '__readmsr' was not declared in this scope
When declaring the function, e.g.: uint64_t __readmsr(unsigned long);
The linker says it's undefined. E.g.: undefined reference to `__readmsr(unsigned long)'
Especially since these tools are great for OS / low level development, the intrinsics are very useful.
I'm not familiar enough with how intrinsics are enabled in GCC, so I'm unclear what the right approach to a solution for this would be. In the end I'm hoping for a cross-tool chain that has all optimizations and features needed to create the most efficient code (and doesn't required hand-coding a bunch of stuff like port I/O like __inbyte).
Thanks for making this project!!