Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

direct hard disk access

12 Aufrufe
Direkt zur ersten ungelesenen Nachricht

kerb

ungelesen,
05.01.2005, 16:56:2005.01.05
an
Hi,
can you please help me I want to read directly from ide hard drive for
example I want to read cylinder = 5 head = 6 sector 56
Thanks for your help.

Evenbit

ungelesen,
05.01.2005, 20:42:0305.01.05
an

>From DOS, Windows, Linux, iMac, Palm or PocketPC hacked to a drive, ?,
etc. ???

It matters what environment you are trying to access the drive from.
The more details you give, the more likely someone can point you in the
right direction.

Nathan.

Annie

ungelesen,
05.01.2005, 21:00:3305.01.05
an

On 2005-01-05 ke...@kerb.eu.org said:

;
; Read a hard disk sector into our allocated buffer, by
; directly accessing the hard disk at the hardware port level.
;
my_buff db 512 dup 0 ;allocate a storage buffer
;
mov dx,1F6h ;drive and head port
mov al,0A06h ;drive 0, head 6
out dx,al ;send it

mov dx,1F2h ;sector count port
mov al,1 ;read one sector
out dx,al ;send it

mov dx,1F3h ;sector number port
mov al,56 ;read sector 56
out dx,al ;send it

mov dx,1F4h ;cylinder low port
mov al,5 ;cylinder 5
out dx,al ;send it

mov dx,1F5h ;cylinder high port
mov al,0 ;the rest of the cylinder (here, 0)
out dx,al ;send it

mov dx,1F7h ;command port
mov al,20h ;read with retry
out dx,al ;send it

still_going:
in al,dx ;read a byte
test al,8 ;are we ready to proceed yet?
jz still_going ;no, so go again
mov cx,512/2 ;one sector (512 bytes/2 = 256 words)
mov di,offset my_buff ;point DI to our local storage buffer
mov dx,1F0h ;data port - data comes in and out here

more:
in ax,dx ;read a word from the port
mov [di],al ;store first byte in our local buffer
inc di ;bump the buffer pointer
mov [di],ah ;store second byte in our local buffer
inc di ;bump the buffer pointer
loop more ;go again if CX > 0
...
...
[ your code here ]
...
... _____
((( `\
This code is, of course, _ _`\ )
for DOS. (^ ) )
~-( )
If you're programming for _'((,,,)))
WinDoze, I can't help you. ,-' \_/ `\
( , |
You'll probably have to call `-.-'`-.-'/|_|
some wacky WinDoze API function, \ / | |
like ReadRawHardDiskSector4Me. =()=: / ,' aa
Hehehe!

alex

ungelesen,
05.01.2005, 21:41:5105.01.05
an

> test al,8 ;are we ready to proceed yet? (wair for
> DRQ?)


> jz still_going ;no, so go again
> mov cx,512/2 ;one sector (512 bytes/2 = 256 words)
> mov di,offset my_buff ;point DI to our local storage buffer
> mov dx,1F0h ;data port - data comes in and out here
>
> more:

could use a "rep insw" or "rep insd" (ecx/4) here
This code will only work for the primary ide controller.
Still a good example though :]

arargh5...@now.at.arargh.com

ungelesen,
05.01.2005, 22:37:4805.01.05
an
On Thu, 6 Jan 2005 02:00:33 +0000 (UTC), "Annie" <m...@privacy.net>
wrote:

>
>On 2005-01-05 ke...@kerb.eu.org said:
>
> > Hi,
> > can you please help me I want to read directly from ide hard drive
> > for example I want to read cylinder = 5 head = 6 sector 56
> > Thanks for your help.
>
>;
>; Read a hard disk sector into our allocated buffer, by
>; directly accessing the hard disk at the hardware port level.
>;
>my_buff db 512 dup 0 ;allocate a storage buffer
>;
> mov dx,1F6h ;drive and head port
> mov al,0A06h ;drive 0, head 6

How do you expect to fit "0A06h" into al?

<snip>

--
Arargh501 at [drop the 'http://www.' from ->] http://www.arargh.com
BCET Basic Compiler Page: http://www.arargh.com/basic/index.html

To reply by email, remove the garbage from the reply address.

Chad Gorshing

ungelesen,
05.01.2005, 22:51:3105.01.05
an
What not just use the CreateFile API? Using \\.\PHYSICALDRIVE as stated at
the bottom of
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/createfile.asp

"kerb" <ke...@kerb.eu.org> wrote in message
news:1104962180.6...@z14g2000cwz.googlegroups.com...

The Dragon

ungelesen,
05.01.2005, 23:03:0705.01.05
an
On 2005-01-06, Annie <m...@privacy.net> wrote:
>
> On 2005-01-05 ke...@kerb.eu.org said:
>
> > Hi,
> > can you please help me I want to read directly from ide hard drive
> > for example I want to read cylinder = 5 head = 6 sector 56
> > Thanks for your help.
>

*snip*

Annie, if you could be so kind as to paste the same thing regarding
the floppy, and the cdrom ;}... that would be great, or just post change
details if its the same sort of thing.

Also, do you have a table of the memory mapped ports laying around? That
would be very useful too =}.

I must say, I'm very much sufficiently impressed ;}

--
The Dragon
MHM 7x9, Hits ya harder than a 2x4.

Bill Marcum

ungelesen,
05.01.2005, 19:14:4205.01.05
an
On 5 Jan 2005 13:56:20 -0800, kerb
Under what operating system? Do you want to use BIOS (writing a boot
sector, stand-alone boot disk or a real-mode DOS program)? If you are
using BIOS, you need Ralf Brown's interrupt list
(http://www.ctyme.com/rbrown.html). Or perhaps you want to read at the
IDE hardware level, using IN and OUT instructions? Google for "ide
hardware standard".


--
"Oh dear, I think you'll find reality's on the blink again."
-- Marvin The Paranoid Android

Annie

ungelesen,
06.01.2005, 01:53:3106.01.05
an

On 2005-01-05 arargh5...@NOW.AT.arargh.com said:

> Annie wrote:
>
> > mov al,0A06h ;drive 0, head 6
>
> How do you expect to fit "0A06h" into al?

_____
Sorry. Brain slippage. Should be: ((( `\
_ _`\ )
> mov al,0A6h ;drive 0, head 6 (^ ) )
~-( )
The code is untested, but it _'((,,,)))
oughtta be pretty close. ,-' \_/ `\
( , |
`-.-'`-.-'/|_|
\ / | |
=()=: / ,' aa

Annie

ungelesen,
06.01.2005, 01:53:2906.01.05
an

On 2005-01-06 y...@yep.yep.yep.com (Alex) said:

> could use a "rep insw" or "rep insd" (ecx/4) here

Not with the 16-bit DOS assembler -I- use. Hehe!

> This code will only work for the primary ide controller.

The original poster didn't specify primary or otherwise...
but primary is a good guess.
_____
> Still a good example though :] ((( `\
_ _`\ )
Duh! (^ ) )
~-( )
_'((,,,)))

Annie

ungelesen,
06.01.2005, 01:53:3406.01.05
an

On 2005-01-05 nob...@noemail.nospam (The Dragon) said:

> Annie, if you could be so kind as to paste the same thing regarding
> the floppy, and the cdrom ;}... that would be great, or just post
> change details if its the same sort of thing.

D00d, I can't hand you EVERYTHING on a silver platter. Gawhh!

> Also, do you have a table of the memory mapped ports laying around?
> That would be very useful too =}.

Confucius say: "Google is your friend."

> I must say, I'm very much sufficiently impressed ;}
>

> -- _____
> The Dragon ((( `\
_ _`\ )
I'm a 'low-level' kind of girl. (^ ) )
Hehe! ~-( )

kerb

ungelesen,
06.01.2005, 05:07:0506.01.05
an
That is really great thank you very much guys. I will use that code in
Unix (FreeBSD)

Evenbit

ungelesen,
06.01.2005, 06:24:5406.01.05
an

Sorry, but you will be unpleasantly disappointed to discover that none
of the code posted so far will work on Unix (FreeBSD).

The code that Annie posted will only work on DOS-compatible systems.

The API call that Chad posted will only work on Windows
NT/2k/XP-compatible systems.

Nathan.

kerb

ungelesen,
06.01.2005, 06:47:3906.01.05
an
I will try that under FreeBSD 4.10 ufs filesystem
thanks

wolfgang kern

ungelesen,
06.01.2005, 07:08:3606.01.05
an

"kerb" asked:

| can you please help me I want to read directly from ide hard drive for
| example I want to read cylinder = 5 head = 6 sector 56

I'd look at RBIL (BIOS int13h services).
But ye olde CHS-addressing wont work for newer, larger drives.
Here the ATA-specs and LBA-addressing are the proper source.

__
wolfgang

Bill Marcum

ungelesen,
06.01.2005, 13:47:0906.01.05
an
On 6 Jan 2005 03:47:39 -0800, kerb
<ke...@kerb.eu.org> wrote:
> I will try that under FreeBSD 4.10 ufs filesystem
> thanks
>
Unless you are modifying the kernel, you can't use in/out instructions
or BIOS calls in BSD. What you can do (as root) is open the disk drive
as a file and seek to any location, without worrying about cylinders and
heads. On modern hard drives, the cylinder/head/sector geometry is just
an emulation anyway.

--
"Oh dear, I think you'll find reality's on the blink again."
-- Marvin The Paranoid Android

Get the latest news on lumpen sluts with Google Alerts.

alex

ungelesen,
06.01.2005, 15:56:2006.01.05
an

"Annie" <m...@privacy.net> wrote in message news:crin97$e6n$1...@mail.gu.net...

Had a look at nasm annie? ;-)


Annie

ungelesen,
06.01.2005, 16:55:0606.01.05
an

On 2005-01-07 y...@yep.yep.yep.com (Alex) said:
_____
> Had a look at nasm annie? ;-) ((( `\
_ _`\ )
Yep. (^ ) )
~-( )
Too bloated with cruft for my _'((,,,)))
taste. ,-' \_/ `\
( , |
And slower than an Abo on a `-.-'`-.-'/|_|
gibber plain. Hehe! \ / | |
=()=: / ,' aa

Chad Gorshing

ungelesen,
06.01.2005, 23:25:4106.01.05
an
Why not try opening "/dev/hda" or whichever drive it is that you want to
read?

I don't know if you are using any libraries such as C libraries, but
fopen/fread can read "/dev/hda" fine.

"Evenbit" <nbake...@charter.net> wrote in message
news:1105010694.0...@c13g2000cwb.googlegroups.com...

kerb

ungelesen,
07.01.2005, 05:15:1607.01.05
an
I tried that the only way it works is I open the /dev/ad0s5g as root l
I create a function to convert CHS to number C=4 H=5 S=30 = 4*5*30 and
then I lseek to that location but then I try to read with read() it
always return -1 maybe my read syntax is wrong but thanks for you help
guys.

T.M. Sommers

ungelesen,
07.01.2005, 12:17:2807.01.05
an

There is no way that that will work. For one thing, /dev/ad0s5g
is not a disk, but a partition (and a Unix partition at that).

The real question is what are you really trying to do? Why do
you want to read a particular sector? In general, it is not a
good idea to do that in Unix (unless you are writing a disk
driver, of course). There may be another way of doing what you
want to do that will not involve reading sectors.

If you must read sectors, you might try asking on the
freebsd-hackers mailing list. Or go directly to the source.

--
Thomas M. Sommers -- t...@nj.net -- AB2SB

Chad Gorshing

ungelesen,
09.01.2005, 00:06:3509.01.05
an
In addition to that, devices can only be read in 'blocks' ... the block size
of devices varies ... but you could try reading 512bytes (or something that
is divisible by 512).

"T.M. Sommers" <t...@nj.net> wrote in message
news:IuzDd.78$0R4....@monger.newsread.com...

The Dragon

ungelesen,
09.01.2005, 03:03:3109.01.05
an

God dammit ;} I can't seem to find anything on floppies, found the
IDE/EIDE/ATAPI specs, but no floppy raw access ={.

Anyone know where I might get this information?

The /\\o//\annabee

ungelesen,
09.01.2005, 03:06:4009.01.05
an
På Sun, 09 Jan 2005 02:03:31 -0600, skrev The Dragon <nob...@noemail.nospam>:

>
> God dammit ;} I can't seem to find anything on floppies, found the
> IDE/EIDE/ATAPI specs, but no floppy raw access ={.
>
> Anyone know where I might get this information?

http://www.dwiles.demon.co.uk/Programming/Hardware/FDC/floppy.html

??

>
>

wolfgang kern

ungelesen,
09.01.2005, 09:03:3009.01.05
an

"The Half" wrote:

| > God dammit ;} I can't seem to find anything on floppies, found the
| > IDE/EIDE/ATAPI specs, but no floppy raw access ={.
| >
| > Anyone know where I might get this information?
|
| http://www.dwiles.demon.co.uk/Programming/Hardware/FDC/floppy.html
|
| ??

Yes 'Debs' FDC-pages hold very valuable info.
RBIL also covers ports and bits for many different devices.

You already started with the collection of the vital stuff ?

__
wolfgang

The /\\o//\annabee

ungelesen,
09.01.2005, 12:22:0809.01.05
an

Well. I am a nosy person so I happen to take a look at a lot of things. As I told you, took me 5 years before I desided on RosAsm, might take 5 years more before I feel ready to start programming an OS. Debs stuff is impressive, but maybe I am not really a OS guys after all. After having read Pauls page, where he gives his views about why he is not doing it, I have been thinking. And my thinking now is this : I will wait to see Kesys, or some other OS become a useful alternative, (ReactOS maybe) and then switch to one of thoose. It could be any OS. In the mean time I will train up my asm skills in RosAsm, and speculate how to write RosAsm code in the future that would be portable with less work, to another OS. Of course, if ReactOS becomes real and useful OS, it could be a target, but so could potentially any OS, with some work. If some other OS will make real a good, fast alternative to windows, then I think it might be wisest for me to just go there instead. No code is as easily
portable as asm code btw. Of course that contradicts common belief, but is nevertheless true.

This is really about having a place to move my interesst, the day Win32 will be fully and completly stupid environment. (It allready is mind you) I am not firstly an OS kind of person, I am a enduser application writer kind of person, I think.

But I know this : They say Linux Torvald is one hell of a capable person, but evidently Linux suck, just as much, if not more than windows. It ran like a wounded animal on my PC. In windows, fast code, is at least "possible". Pauls rantings was written a few years ago. I admit that windows HLL functionality is slow, but the lowlevel functions if used sparingly, seem to me not that bad. And the help from hardware, when you must have speed, is a definitive pluss. What linux have is : Its free open software. Thats about it. It doesnt ROCK. Kesys ROCKs, but is too technical yet. When you have internet support, for instance, ability to read ng's, and commuicate with email, it will be 1000 times as interesting, from user point of view. And at that time, I will sign up for a licence. But only if the licence allows me to build software on top of it.

After having taken a look at Debs stuff, and yours as well, I think it might be better to leave createing an Os to the really competent guys. Its seems to me that many OS'es are now beeing cocked, and its very exiting. I think I just wait around for one that kicks ass, to become my home in my old age, which after all is approaching, soon enough. I am 37, but it still feels like just two weeks ago I was 30. :-)))

Sometimes I even think programming is maybe God way of telling us : Dont go there. :-)))))))
But I still dont belive it....

>
> __
> wolfgang
>
>
>
>
>

wolfgang kern

ungelesen,
10.01.2005, 09:00:0310.01.05
an

"The Half" wrote:

My main reason for coding KESYS was just that I couldn't find one single
Os around which at least partially fit my demands.
I'd bet and expect you soon will post first questions in AOD :)

__
wolfgang


0 neue Nachrichten