Page 1 of 1
How to read usb in protected mode ?
Posted: Wed Jan 08, 2014 2:34 pm
by ZigZogZang
Hi. My kernel is running in protected mode and I want to implement virtual memory (swap file) in USB memory.
How to access USB memory while being in protected mode ? How to read USB when BIOS interrupts not accessible becouse I am in proteced mode ?
Greetings
Re: How to read usb in protected mode ?
Posted: Wed Jan 08, 2014 3:22 pm
by lihawl
"how-to-do" is very long story! I have worked on this for days and days. Accessing data on flash disk may be most hard part of development a my-os.
.So much things should be done. Firstly, you could read the wiki page at
http://wiki.osdev.org/Universal_Serial_Bus. If you don't know what's PCI, Learn it. Then read the specification of ehci(This specification is good for software developer to read.).....
Re: How to read usb in protected mode ?
Posted: Wed Jan 08, 2014 3:30 pm
by sortie
Hi ZigZogZang,
The BIOS should only be used for bootstrap purposes, that is, to load the actual operating system. It should never be used by the actual operating system. Instead, you should write real drivers for the hardware in question - such drivers will unquestionably be better, integrate much better into your OS, and be considerably easier to use (compared to all the hacks you'd have to go through to use the BIOS). In other words, implement a USB stack.
This is unfortunately a considerable amount of work and it doesn't help there there are multiple USB controller standards and things don't get better from there. Your best bet will be to find another hobby operating system with drivers that you can learn from or adapt, or perhaps you could implement UDI (or another portable driver interface) and simply use existing drivers on your OS.
Perhaps the good news is that swap isn't terribly relevant for hobby operating systems as modern systems have ample amounts of RAM. You could probably skip implementing it for now if you don't strongly need it. (If your task is to do something with USB swapping rather than making an OS for the sake of that - it's probably better to adapt Linux or another existing system for your needs.)
(Btw, virtual memory doesn't have anything to do with swap! Swap is a technology built on top of virtual memory.)