ReturnInfinity / BareMetal-OS-legacy

BareMetal is a 64-bit OS for x86-64 based computers. The OS is written entirely in Assembly while applications can be written in Assembly, C/C++, and Rust.
1.74k stars 303 forks source link

Stuck at iddrive_poll with VirtualBox #111

Closed charray closed 7 years ago

charray commented 8 years ago

Hi,

I have pulled the latest version from git and compiled it today. Whenever I insert an AHCI drive, The system loops indefinitely after printing [mem: 64 MiB] [hdd:. After some call os_output debugging, I found the system loops indefinitely on the line jne iddrive_poll in os/drivers/storage/achi.asm.

The VirtualBox I used is version 5.0.14. I tried with various disk sizes and the issue is repeatable. Is there anything I can do to troubleshoot? Thanks.

IanSeyler commented 8 years ago

I will give this a try on my end and see what I can find. Thanks for reporting this.

IanSeyler commented 7 years ago

This is confirmed as a bug. I tested with VirtualBox 5.1.8 and got the same results.

IanSeyler commented 7 years ago

Check "Offset 10h: PxIS – Port x Interrupt Status" and "Offset 30h: PxSERR – Port x Serial ATA Error (SCR1: SError)" to see what the issue may be.

IanSeyler commented 7 years ago

Set AHCI Enable (AE)? Currently the driver does not do this.

IanSeyler commented 7 years ago

It's not AE (VirtualBox already has in enabled) and all of the BIOS handoff bits are clear.

IanSeyler commented 7 years ago

Neat! So it's just iddrive function that hangs. Comment it out and BareMetal starts up fine (although it detects the disk is 0MiB). Reading from the disk after this works.

IanSeyler commented 7 years ago

Set the FIS length to 5. This is the minimum for that type of FIS.