Switching to (un)real mode, reading disk and switching back to protected mode

最后都变了- 提交于 2020-01-06 06:08:25

问题


My question is quite a bit theoretical, but I want to implement disk r/w to my Operating system, while I know how to do it in protected mode, it would take too long to implement ATAPI+ATA+FDC drivers (to make my OS boot on any device). I took two ideas to consider: Make my OS bootable only from pendrive (so I can handle only pendrive for disk r/w and it wouldn't take as much time), and jump to real mode, read sector, and jump back to protected mode. But AFAIK i have to be in conventional memory (IP can be max 65k) so CPU would crash as my kernel resides near 1MB mark. I use GRUB as bootloader and test my code in VMWare VirtualBox. My question is, should I implement USB mass memory driver or do it like DOS extenders do? If so, could you show me some code in C that for example goes back to real mode and waits for keypress, then goes back to protected mode? I can't pack data to kernel. My OS supports at the moment keyboard, advanced terminal functions and some utilities from C standard library.

来源:https://stackoverflow.com/questions/47486341/switching-to-unreal-mode-reading-disk-and-switching-back-to-protected-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!