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'm making my first O.S. mixing C and Assembly. Right now I'm doing my disk.asm file to read a sector from HDD, but when I try to run it on VirtualBox, it just returns a critical error and stops working.
Where are "PrintString()" and "readStr()" defined?
Are you compiling your C code as 16-bit code?
What C compiler are you using?
What is the "critical error" message?
You haven't initialized your segment registers.
You haven't defined a stack.
You are jumping to a label "_fail" that isn't defined.
PrintString() is defined in my screen.h (working fine, I have tried it)
readStr() is defined in my kb.h (Working fine too)
I'm using gcc. I'm compiling it using a VB machine with ubuntu.
_fail is define, it will just cli and ret
C00LD0WN wrote:I'm not. It is compiling 32-bit. Do I need to use 16-bit?
The command I'm running is:
gcc -m32 -c kernel.c -o kc.o
Can't I use bios interrupts with 32-bit assembly?
The short answer is, No.
The long answer is Noooooooooooooooooo!
Actually there are a few ways to use the BIOS in 32-bit, but none of them can be implemented in less than a week or two.
Most osdevers just communicate directly with hardware once they switch to 32-bit mode.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
In protected mode, there are several ways to call the BIOS:
Switch back to real mode temporarily to call the BIOS.
Set up a v8086 monitor.
Use an x86 emulator.
All three of them are very bad choices for disk access. IMHO, these should only be used for VESA graphics modes.
Read this wiki: ATA for more information on ATA. ATA is old actually, but is an easier starting point than AHCI and NVMe.
You know your OS is advanced when you stop using the Intel programming guide as a reference.