A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig

For what? To be 4 times slower? RtlMoveMemory aka memmove() moves 4byte words.

Max
----- Original Message -----
From: craiglei
To: NT Developers Interest List
Sent: Wednesday, June 12, 2002 12:22 PM
Subject: [ntdev] A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig
b???v?jƶ?i?d??{.n???zwZnV??隊[h???z{]z?x?yb??(??(

If you are going to flatten the loop for performance, take a look at “Duff’s Device”. It uses a switch to flatten a loop by a specified factor.

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of craiglei
Sent: Wednesday, June 12, 2002 1:22 AM
To: NT Developers Interest List
Subject: [ntdev] A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig
b豆畍礿姴j璻墦㈤旃??薇檩i筞濭)m毥轫u膣隻鍔薼⑹

People keep asking this question. Of course, you can assuming the pointers are char *, or some other type that matches the buffer sizes and multiples of size. The question is WHY??? The code is optimized for most uses and can only be safely improved on in very limited cases. That is the job of the compiler in any case since I think for the x86 most of the copy/move functions are generated inline.

----- Original Message -----
From: craiglei
To: NT Developers Interest List
Sent: Wednesday, June 12, 2002 4:22 AM
Subject: [ntdev] A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig
b???v?j???.?˛???m??֛???zf???y?ޞ?^??x"X???&

Is it possible or not, is a question but it does possible in Linux; as the
kernel source shows …

extern inline char * strcpy(char * dest,const char *src)
{
register char *tmp= (char *)dest;
register char dummy;
asm volatile(

/*
Just a simple loop; _asm { jump to back if not end, MOV, INR } but to avoid
another possible war on whether to use AT&T syntax or not, I deleted the
lines
*/

return dest;
}

give a grep in your kernel source, if you want to see the deleted lines;
oops such a mail in NTDEV ? I would like to get the pros and cons of it;

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Sunday, June 16, 2002 7:38 AM
To: NT Developers Interest List
Subject: [ntdev] Re: A simple question?

People keep asking this question. Of course, you can assuming the pointers
are char *, or some other type that matches the buffer sizes and multiples
of size. The question is WHY??? The code is optimized for most uses and
can only be safely improved on in very limited cases. That is the job of
the compiler in any case since I think for the x86 most of the copy/move
functions are generated inline.

----- Original Message -----
From: craiglei
To: NT Developers Interest List
Sent: Wednesday, June 12, 2002 4:22 AM
Subject: [ntdev] A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig
b???v?j???.?˛???m??֛???zf???y?ޞ?^??x"X???&

You are currently subscribed to ntdev as: xxxxx@nestec.net
To unsubscribe send a blank email to %%email.unsub%%

Yes, you can write inline assembler so in theory
do this, but as was pointed out in multiple posts
if there is a well written routine to do this why
not use it? I was long ago taught the most reliable
code are the lines that are not there.

Don Burn
Egnera, Inc.

----- Original Message -----
From: “ARUN GOVIND”
To: “NT Developers Interest List”
Sent: Friday, June 21, 2002 6:19 AM
Subject: [ntdev] Re: A simple question?

Is it possible or not, is a question but it does possible in Linux; as the
kernel source shows …

extern inline char * strcpy(char * dest,const char *src)
{
register char tmp= (char )dest;
register char dummy;
asm volatile (

/

Just a simple loop; _asm { jump to back if not end, MOV, INR } but to avoid
another possible war on whether to use AT&T syntax or not, I deleted the
lines
/

return dest;
}

give a grep in your kernel source, if you want to see the deleted lines;
oops such a mail in NTDEV ? I would like to get the pros and cons of it;

+ Arun Govind
Consumer Electronics Group
www.nesttech.com

Possible but not needed at all. Use RtlCopyMemory.

Max

----- Original Message -----
From: “ARUN GOVIND”
To: “NT Developers Interest List”
Sent: Friday, June 21, 2002 2:19 PM
Subject: [ntdev] Re: A simple question?

Is it possible or not, is a question but it does possible in Linux; as
the
kernel source shows …

extern inline char * strcpy(char * dest,const char *src)
{
register char tmp= (char )dest;
register char dummy;
asm volatile (

/

Just a simple loop; _asm { jump to back if not end, MOV, INR } but to
avoid
another possible war on whether to use AT&T syntax or not, I deleted
the
lines
/

return dest;
}

give a grep in your kernel source, if you want to see the deleted
lines;
oops such a mail in NTDEV ? I would like to get the pros and cons of
it;

+ Arun Govind
Consumer Electronics Group
www.nesttech.com

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Sunday, June 16, 2002 7:38 AM
To: NT Developers Interest List
Subject: [ntdev] Re: A simple question?

People keep asking this question. Of course, you can assuming the
pointers
are char *, or some other type that matches the buffer sizes and
multiples
of size. The question is WHY??? The code is optimized for most uses
and
can only be safely improved on in very limited cases. That is the job
of
the compiler in any case since I think for the x86 most of the
copy/move
functions are generated inline.

----- Original Message -----
From: craiglei
To: NT Developers Interest List
Sent: Wednesday, June 12, 2002 4:22 AM
Subject: [ntdev] A simple question?

Could I can replace RtlMoveMemory with a loop sentence such as:

PUCHAR m2;

m1 = MmGetSystemAddressForMdlSafe(pMdl);

for (i=0; i *(m2+i) = *(m1+i);

craig
b­®¶¹®vµjŠ³†ž?.žË›±Êâm?Ö›•©äzf¢–?y«Þž×^¿­x"X¬¶?­Ê&

You are currently subscribed to ntdev as: xxxxx@nestec.net
To unsubscribe send a blank email to %%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%