flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > Disk Drive/Usb Read Protected Mode? Goto page 1, 2 Next |
Author |
|
blind_dragon 20 Jun 2012, 04:43
Hello,
Is there a example of 32 bit protected mode hdd io? read lba sector and get disk information? any sugestions from people experienced with this? I found this but it is for 64 bit... http://wiki.osdev.org/ATA_read/write_sectors |
|||
20 Jun 2012, 04:43 |
|
Dex4u 20 Jun 2012, 13:11
blind_dragon wrote: Hello, You can download DexOS, in the Drivers folder, you will find a HddFunctions.inc in it you will find examples. http://www.dex-os.com/ |
|||
20 Jun 2012, 13:11 |
|
blind_dragon 20 Jun 2012, 13:26
Ok I will check it out.
thank you. |
|||
20 Jun 2012, 13:26 |
|
BAiC 21 Jun 2012, 10:05
USB access to hard drives are severely complicated. the only way it'll be "easy" to access a USB hard drive is if you have "wrapper"-like service hiding the USB part. in my experience, "wrapper"s of this complexity are roughly 10k-100k in code size.
as for "classic" Hard Drive IO: the old code where you access IO Space at 0x1F0 either breaks on modern hardware, or it does nothing. I have 2 systems and neither one supports placing one of its' hard drive controllers in that mode. blind_dragon: what emulator/VM are you using to test on? you need to make sure that the "device" is also at that address. |
|||
21 Jun 2012, 10:05 |
|
blind_dragon 21 Jun 2012, 17:55
no emulator - real pc..
when I boot the usb I get the boot drive and returns as 80h but even though I should be able to access my disc drive or the usb.. its not reading any of them.. I should be able to read one of the 2.. and dump it to screen to see if its the usb or the hdd its reading.. based on the MBR - well I would think |
|||
21 Jun 2012, 17:55 |
|
Dex4u 21 Jun 2012, 18:51
blind_dragon wrote: no emulator - real pc.. First let me get somethings clear, you are booting using hdd emulation from a USB fob ?. But you want to 1. read your real hdd ? 2. read your usb fob ? Which is it 1 or 2. |
|||
21 Jun 2012, 18:51 |
|
BAiC 21 Jun 2012, 21:51
the USB Drive definitely won't show up using the Hard Drive IO Port access. you need a USB driver if you want anything "low-level" to access that thing.
|
|||
21 Jun 2012, 21:51 |
|
BAiC 21 Jun 2012, 22:05
as for your actual hard drive: it's most likely on a non-compatible controller.
|
|||
21 Jun 2012, 22:05 |
|
blind_dragon 21 Jun 2012, 22:32
Quote: First let me get somethings clear, you are booting using hdd emulation from a USB fob ?. I would like to read the USB so I can read and load files from the kernel from a fat sys. but in trying to use the read functions.. I can not figure out why I can not read the hard drives either. just for now - read lba 0 of the usb would be a good start. if you or baic could point me in the right direction over all goal.. boot - detect the boot drive.. set a perm drive for os as usb.. and use it / excluding all other drives to protect the computers it runs on. |
|||
21 Jun 2012, 22:32 |
|
Dex4u 22 Jun 2012, 12:00
There are only 3 way to do that
1. write a USB stack 2. stay in real mode and use int 13h (drive 80h or 0 depend if hdd or fdd emulation) 3. Go to pmode and back for every read/write I use 1 and 3, (1 not released yet), so if you try my OS you can see how going back and forth works. With no usb driver int 13h is the only way to read/write USB, once you leave real mode int 13h is no longer available, until you go back to real mode. See my post here: http://board.flatassembler.net/topic.php?p=143625#143625 For a going to and from realmode demo, this is for switching vesa modes, but you can replace that with int 13h to read from USB fob. You can also see the work done by Mike Gonta. |
|||
22 Jun 2012, 12:00 |
|
shutdownall 22 Jun 2012, 12:03
Is it really that easy, that you can access any USB stick in real mode through BIOS int 13h ?
Didn't try before but thought that you need a special driver. Maybe BIOS dependend ? I think you need some newer BIOS with option to boot from USB ??? |
|||
22 Jun 2012, 12:03 |
|
blind_dragon 22 Jun 2012, 12:39
write a USB stack .
Since you have experince in this.. can you point me to were I can learn more on it? any documents or sites. The int 13h real mode does work thats how I boot the kernel. Never tried to switch back and forth once in protected mode. I will look at that option - thanks |
|||
22 Jun 2012, 12:39 |
|
smiddy 22 Jun 2012, 14:02
shutdownall wrote: Is it really that easy, that you can access any USB stick in real mode through BIOS int 13h ? Yep, a newer BIOS will hav ethe ability to access USB, sense what is there, and make it accessible to INT 13h. I don't know where that cutoff is however. |
|||
22 Jun 2012, 14:02 |
|
smiddy 22 Jun 2012, 14:04
blind_dragon wrote: write a USB stack . If you intend to switch back and forth between real and protected modes, you need to know how to switch the Interrupt Vector Tables (IVT). This is an area to research if you intend to go down that path. |
|||
22 Jun 2012, 14:04 |
|
Dex4u 22 Jun 2012, 18:37
shutdownall wrote: Is it really that easy, that you can access any USB stick in real mode through BIOS int 13h ? Yes its that easy, if your BIOS supports USB booting (all in the last 8 years do), things to note: USB can emulate floppy or hdd or both. If it support floppy emulation, then a bootable floppy image placed at the start of the usb fob, will work. If it boots as hdd emulation, then you need to use a boot sector that can load sectors using fat16 or fat32 depending on the way you formatted the fob. Also some old PC will boot usb after a BIOS update. blind_dragon wrote: write a USB stack . Theres some good links here: http://wiki.osdev.org/Universal_Serial_Bus Also this book is a big help: http://www.amazon.co.uk/USB-Universal-Serial-Bus-8/dp/1468151983/ |
|||
22 Jun 2012, 18:37 |
|
shutdownall 23 Jun 2012, 13:03
Dex4u wrote: Theres some good links here: Thanks, I have this book but maybe the website with OS Dev is worth to read, at least the USB article. Because I am working on another project with FTDI USB controller chips. The specification of USB 2.0 is not so helpful because it has more than 1000 pages and you don't know where begin to read. |
|||
23 Jun 2012, 13:03 |
|
blind_dragon 23 Jun 2012, 14:00
Is there a in/out port list anywere?
for ports on a PC? |
|||
23 Jun 2012, 14:00 |
|
BAiC 23 Jun 2012, 20:00
port lists aren't dependable. you need to know what hardware exists in the system before accessing ports. I highly recommend a PCI Enumerator as it'll ensure software only runs upon discovery of the device.
USB, by the way, doesn't have any static port addresses. you must discover the USB Host Controller through a PCI Enumerator in order to determine where it is in IO (or MMIO) space. you can read a DWORD in PCI Configuration Space by: Code: mov eax, 1 shl 31;this will read the DeviceID and Vendor ID for Device 0 on Function 0 of Bus 0. mov edx, 0xCF8 out dx, eax add edx, 4 in eax, dx |
|||
23 Jun 2012, 20:00 |
|
blind_dragon 24 Jun 2012, 14:21
thanks for your input BAiC..
I will probably get the book dex4u listed. I have checked the net on this book and looks pretty popular. I think I will buy it. |
|||
24 Jun 2012, 14:21 |
|
Goto page 1, 2 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.