Hi all!
I have been recently working on my little hobbyist OS "wind". I have developed a simple bootloader using nasm (that initializes into protected mode before jumping to kernel) and using GCC toolchain to program the rest of my kernel and other drivers. I wrote it on a floppy image (an HD image later) and tested it on BOCHS emulator. Now the floppy option is only temporary and HD is too much yet .
Since i have a couple of pendrives and my BIOS can boot from a pendrive i am thinking of writing the image to my pendrive and access the entire **8 GB** space there to keep all kernel and drivers stuff. I want to access and use all the space like on a hard disk!
Now the problem is that i have googled and searched the web about how to access the pendrive space using ports from a protected mode OS code like mine. But i didn't find even a single one! The ralf brown's interrupt requests ref (i think) provides a USB interrupts list but i am doing everything from protected mode code (i have setup protected mode interface for some vesa display in my code instead of using troublesome virtual mode or something!). So real mode interrupts as you can see are useless to me IN ALL WAYS. The only option from protected mode is using ports!
Someone please advice me on this problem. I have a Celeron D (Pentium 5 series) processor and note that **i am not using GRUB**. I use my own bootloader and it works perfectly. Also please tell me if i need to setup an MBR or something on the pendrive to access all the space..
regards
How to access a pen drive *directly* using ports like HDs?
How to access a pen drive *directly* using ports like HDs?
Everyday schedule: wake up >> eat >> write OS >> eat >> sleep
Re: How to access a pen drive *directly* using ports like HD
You need to write an ehci driver in order to access usb from protected / long mode.
OS wiki provides good assistance:
http://wiki.osdev.org/USB
Regards
Mac2004
OS wiki provides good assistance:
http://wiki.osdev.org/USB
Regards
Mac2004
Re: How to access a pen drive *directly* using ports like HD
Hey thanks a lot! You like pointed me to a treasure!
Please don't think that I am asking to be spoon-fed but that wiki doc is **complete ref** including hardware stuff. I only wanted to know about the ports
I will surely read the doc and EHCI ref though; because I am going to need it eventually. Please tell me one thing more: Is EHCI driver the only way to access flash storage from protected mode?
thanks again
regards
Please don't think that I am asking to be spoon-fed but that wiki doc is **complete ref** including hardware stuff. I only wanted to know about the ports
I will surely read the doc and EHCI ref though; because I am going to need it eventually. Please tell me one thing more: Is EHCI driver the only way to access flash storage from protected mode?
thanks again
regards
Everyday schedule: wake up >> eat >> write OS >> eat >> sleep
- NickJohnson
- Member
- Posts: 1249
- Joined: Tue Mar 24, 2009 8:11 pm
- Location: Sunnyvale, California
Re: How to access a pen drive *directly* using ports like HD
The stuff on the wiki is what you need to write a complete USB driver; a simple list of port names won't do you much good. The USB interface is simply more sophisticated than the ATA interface, and requires a more complex driver. There also aren't any standard port numbers (iirc), because you have to find them using PCI.lup0 wrote:Please don't think that I am asking to be spoon-fed but that wiki doc is **complete ref** including hardware stuff. I only wanted to know about the ports
In theory, you could use virtual 8086 mode to make the BIOS do the transfers for you, but it would be slow and less flexible; that's the only other method that I can think of. A proper USB driver is probably the way to go, in the long run.lup0 wrote:Is EHCI driver the only way to access flash storage from protected mode?
Re: How to access a pen drive *directly* using ports like HD
first of all thanks nick for replying!
i completely agree with you (as i have earlier also expressed); strongly against using virtual 8086 mode for doing things that can be achieved directly in pm. though the *simplicity* of v8086 is tempting .
anyway I'll write a usb driver then. Let me post the link of EHCI ref pdf in case someone needs it like me: http://www.intel.com/technology/usb/dow ... ci-r10.pdf
see you guys!
regards
i completely agree with you (as i have earlier also expressed); strongly against using virtual 8086 mode for doing things that can be achieved directly in pm. though the *simplicity* of v8086 is tempting .
anyway I'll write a usb driver then. Let me post the link of EHCI ref pdf in case someone needs it like me: http://www.intel.com/technology/usb/dow ... ci-r10.pdf
see you guys!
regards
Everyday schedule: wake up >> eat >> write OS >> eat >> sleep
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: How to access a pen drive *directly* using ports like HD
The bios still expects to be alone. v8086 might not work, and becomes increasingly more difficult if the BIOS thinks that polling is a bad idea, or worse, when it needs protected mode to access the hardware in question.
If you want to use the BIOS for storage, load a ramdisk at boot. Otherwise, it's better not to.
If you want to use the BIOS for storage, load a ramdisk at boot. Otherwise, it's better not to.