Reading/Writing raw bytes to disk in C/assembly

186 views
Skip to first unread message

Mason X

unread,
Apr 29, 2015, 10:50:37 AM4/29/15
to bareme...@googlegroups.com
I'm currently trying to read and write raw sectors to the disk.
I've seen https://github.com/ReturnInfinity/BareMetal-OS/blob/master/os/drivers/storage/ahci.asm but I'm wondering: how can I implement a "wrapper" function for that in C?
I'm sort of new to assembly and C integration, so I don't really know how to do that. As well, are there any things I should watch out for when running readsectors/writesectors?

Ian Seyler

unread,
Apr 30, 2015, 1:56:09 PM4/30/15
to bareme...@googlegroups.com, maso...@gmail.com
The sector functions are not available as public calls in the current version of BareMetal OS.

Some code would be required in kernel64.asm as well as the corresponding bits in bmdev.asm and libbaremetal.c/.h

kernel64.asm
dq readsectors ; 0x00C0
dq writesectors ; 0x00C8


In the updated BareMetal exo-kernel these calls are now public: https://github.com/ReturnInfinity/BareMetal-kernel

-Ian
Reply all
Reply to author
Forward
0 new messages