How to allocate about half of the physical memory ?

Hello!

I have a problem. I have to allocate a very large block of memory for a
ram disk, about one half of the physical memory. First I used
ExAllocatePool to allocate the memory from the PagedPool, but the memory
pool is limited and allows only about 120MB as sinlge memory block (on a
system with 512MB RAM). Then I tried MmAllocateContinuousMemory. The
problem is that the memory gets fragmented at runtime and then I only
get smaller blocks.
So I need a function which allocates memory, which is non-continous and
not from any memory pool (neither NonPaged nor Paged). Is it possible to
get the half (or more) of the physical memory ? And if yes, which
function is the best to get the memory ?

Thank you very much for your help!

A. Roth

Use /MAXMEM in the boot.ini to force NT to only use half of available
memory, then use MmMapIoSpace() to get access to the unusued physical memory
(but don’t try and map all of it - you’ll need to write your RAM disk driver
to map windows onto the physical memory as needed).

/simgr

-----Original Message-----
From: Andreas Roth [mailto:xxxxx@arsoft-online.com]
Sent: Monday, December 30, 2002 1:54 PM
To: NT Developers Interest List
Subject: [ntdev] How to allocate about half of the physical memory ?

Hello!

I have a problem. I have to allocate a very large block of memory for a
ram disk, about one half of the physical memory. First I used
ExAllocatePool to allocate the memory from the PagedPool, but the memory
pool is limited and allows only about 120MB as sinlge memory block (on a
system with 512MB RAM). Then I tried MmAllocateContinuousMemory. The
problem is that the memory gets fragmented at runtime and then I only
get smaller blocks.
So I need a function which allocates memory, which is non-continous and
not from any memory pool (neither NonPaged nor Paged). Is it possible to
get the half (or more) of the physical memory ? And if yes, which
function is the best to get the memory ?

Thank you very much for your help!

A. Roth


You are currently subscribed to ntdev as: xxxxx@stratus.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Use ZwCreateSection/ZwMapViewOfSection to create a pagefile-based
section in the System process’s user addresses.
You will be able to access these addresses from any system thread.

Max

----- Original Message -----
From: “Andreas Roth”
To: “NT Developers Interest List”
Sent: Monday, December 30, 2002 9:53 PM
Subject: [ntdev] How to allocate about half of the physical memory ?

> Hello!
>
> I have a problem. I have to allocate a very large block of memory
for a
> ram disk, about one half of the physical memory. First I used
> ExAllocatePool to allocate the memory from the PagedPool, but the
memory
> pool is limited and allows only about 120MB as sinlge memory block
(on a
> system with 512MB RAM). Then I tried MmAllocateContinuousMemory. The
> problem is that the memory gets fragmented at runtime and then I
only
> get smaller blocks.
> So I need a function which allocates memory, which is non-continous
and
> not from any memory pool (neither NonPaged nor Paged). Is it
possible to
> get the half (or more) of the physical memory ? And if yes, which
> function is the best to get the memory ?
>
> Thank you very much for your help!
>
> A. Roth
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Hi Max,

Is it really possible to map something in the system process’s user
address space? I have read that system process doesn’t have use user
address space. I was arguing with my friend that we can overcome the 2G
kernel address space limitation by using the system process’s user address
space, provided we need to ensure that it is accessed only sytem threads.

Thanks and regards,
Jeyaram

Yes, it is possible. All processes other than the IDLE pseudo process
contain a VAD tree and therefore a user mode address space. The system
process even has ntdll and NLS tables mapped.

Additional user mem space can be committed/reserved via VirtualAlloc,
ZwMapViewOfSection, etc. You should be aware, however, that if you can
try to map X GB of memory into the system process, any other component in
the system may attempt to do so as well. So there is the potential for
ugly compatibility issues. If you are not carefull about exactly what you
are doing there is great potential for exposing vulnerabilites in system
security/stability as well. If you feel you absolutely must map/use user
mode memory from a kernel mode driver you should do so in your own private
process.

Hi Max,

Is it really possible to map something in the system process’s user
address space? I have read that system process doesn’t have use user
address space. I was arguing with my friend that we can overcome the 2G
kernel address space limitation by using the system process’s user address
space, provided we need to ensure that it is accessed only sytem threads.

Thanks and regards,
Jeyaram

> Is it really possible to map something in the system process’s user

address space?

Yes, we did this is our RAMdisk sample going with our product (sorry
Mr. Roddy :slight_smile: )
This works.

Max

-----Original Message-----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Date: Fri, 3 Jan 2003 03:20:25 +0300
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

> > Is it really possible to map something in the system process’s user
> > address space?
>
> Yes, we did this is our RAMdisk sample going with our product (sorry
> Mr. Roddy :slight_smile: )
> This works.
>
> Max
>

That response doesn’t bother me 'cause it directly answers the user’s question and only indirectly hawks your super
fabulous scsiport replacement. It is the answer that DOESN’T answer the question at all and yet appears to try to sell
product that creeps me out. And now I really regret having posted anything at all on this topic :frowning:

===========================
Mark Roddy, shamelessly using his sig to hawk himself,
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

Maybe the solution to this issue is to create a new mailing list called
[NTADS] and allow all of the folks here who have some great libraries
and products to sell to post to this list.

Those who do not want to be bothered can either filter the emails to a
“read later” folder or not subscribe at all. I am always interested in
what folks on these lists are doing.

Just a thought,

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, January 02, 2003 6:23 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

-----Original Message-----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Date: Fri, 3 Jan 2003 03:20:25 +0300
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

> > Is it really possible to map something in the system process’s user
> > address space?
>
> Yes, we did this is our RAMdisk sample going with our product (sorry
> Mr. Roddy :slight_smile: )
> This works.
>
> Max
>

That response doesn’t bother me 'cause it directly answers the user’s
question and only indirectly hawks your super
fabulous scsiport replacement. It is the answer that DOESN’T answer the
question at all and yet appears to try to sell
product that creeps me out. And now I really regret having posted
anything at all on this topic :frowning:

===========================
Mark Roddy, shamelessly using his sig to hawk himself,
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032


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

And no, you need not be sorry. You are obviously annoyed by the actions
of some of us at times regarding “hawking” our stuff.

I think adding tag lines about services and books authored are also
“hawking” and if we are to not tolerate “hawking”, then it should be an
all or none rule.

Who is to say that my library is not as valuable as say Billy Joe Bob’s
WDM book? I surly do not add the software that I have authored and am
selling in my signature line.

Just some more thought,

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Thursday, January 02, 2003 6:23 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

-----Original Message-----
From: “Maxim S. Shatskih”
To: “NT Developers Interest List”
Date: Fri, 3 Jan 2003 03:20:25 +0300
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

> > Is it really possible to map something in the system process’s user
> > address space?
>
> Yes, we did this is our RAMdisk sample going with our product (sorry
> Mr. Roddy :slight_smile: )
> This works.
>
> Max
>

That response doesn’t bother me 'cause it directly answers the user’s
question and only indirectly hawks your super
fabulous scsiport replacement. It is the answer that DOESN’T answer the
question at all and yet appears to try to sell
product that creeps me out. And now I really regret having posted
anything at all on this topic :frowning:

===========================
Mark Roddy, shamelessly using his sig to hawk himself,
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032


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

I like their SCSI library. Saves a lot of work learning all the guts of
SCSI ports and determining where not having real hardware requires changes.
I am thinking that Microsoft will be moving away from some of the miniports
because the need to force hardware manufacturers to write for both 9x and NT
is disappearing.

Has anyone ever seen a disk driver based upon the DISK.SYS in the DDK which
also uses CLASSPNP.SYS?

How about a driver for the ext3 filesystem? Since I am current unemployed I
have been thinking about doing a file system driver for the fun of it. I
have the source from Red Hat 8 so I won’t have to learn all the structures,
but just create an upper wrapper for the FS interface and modify the lower
interface to the disk driver.

----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Thursday, January 02, 2003 9:22 PM
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

>
> -----Original Message-----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Date: Fri, 3 Jan 2003 03:20:25 +0300
> Subject: [ntdev] Re: How to allocate about half of the physical memory ?
>
> > > Is it really possible to map something in the system process’s user
> > > address space?
> >
> > Yes, we did this is our RAMdisk sample going with our product (sorry
> > Mr. Roddy :slight_smile: )
> > This works.
> >
> > Max
> >
>
> That response doesn’t bother me 'cause it directly answers the user’s
question and only indirectly hawks your super
> fabulous scsiport replacement. It is the answer that DOESN’T answer the
question at all and yet appears to try to sell
> product that creeps me out. And now I really regret having posted anything
at all on this topic :frowning:
>
> ===========================
> Mark Roddy, shamelessly using his sig to hawk himself,
> Consultant, Microsoft DDK MVP
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Do your homework regarding the GPL (GNU Public License) in its relation to the ext3 filesystem. You may find out that you can’t really sell your binary without giving away the source code to the world (even on a Windows platform, since you are planning to base your work on GPL source code).

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Thursday, January 02, 2003 10:06 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

I like their SCSI library. Saves a lot of work learning all the guts of
SCSI ports and determining where not having real hardware requires changes.
I am thinking that Microsoft will be moving away from some of the miniports
because the need to force hardware manufacturers to write for both 9x and NT
is disappearing.

Has anyone ever seen a disk driver based upon the DISK.SYS in the DDK which
also uses CLASSPNP.SYS?

How about a driver for the ext3 filesystem? Since I am current unemployed I
have been thinking about doing a file system driver for the fun of it. I
have the source from Red Hat 8 so I won’t have to learn all the structures,
but just create an upper wrapper for the FS interface and modify the lower
interface to the disk driver.

----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Thursday, January 02, 2003 9:22 PM
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

>
> -----Original Message-----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Date: Fri, 3 Jan 2003 03:20:25 +0300
> Subject: [ntdev] Re: How to allocate about half of the physical memory ?
>
> > > Is it really possible to map something in the system process’s user
> > > address space?
> >
> > Yes, we did this is our RAMdisk sample going with our product (sorry
> > Mr. Roddy :slight_smile: )
> > This works.
> >
> > Max
> >
>
> That response doesn’t bother me 'cause it directly answers the user’s
question and only indirectly hawks your super
> fabulous scsiport replacement. It is the answer that DOESN’T answer the
question at all and yet appears to try to sell
> product that creeps me out. And now I really regret having posted anything
at all on this topic :frowning:
>
> ===========================
> Mark Roddy, shamelessly using his sig to hawk himself,
> Consultant, Microsoft DDK MVP
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@infiniconsys.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

If I had to, I could create a kernel mode DLL with the ext3 source in it and
have my driver just use it like the disk drivers from Microsoft work. I
probably wouldn’t sell it anyway as I don’t see any big market out there.
If the market was there, then it would be worth the time to write a complete
file system from scratch. This will probably just be an exercise of the
mind and not a real product. Anyone who has an ext3 filesystem doesn’t want
to pay big bucks.

----- Original Message -----
From: “McCrory, Duane”
To: “NT Developers Interest List”
Sent: Thursday, January 02, 2003 10:13 PM
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

Do your homework regarding the GPL (GNU Public License) in its relation to
the ext3 filesystem. You may find out that you can’t really sell your binary
without giving away the source code to the world (even on a Windows
platform, since you are planning to base your work on GPL source code).

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Thursday, January 02, 2003 10:06 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

I like their SCSI library. Saves a lot of work learning all the guts of
SCSI ports and determining where not having real hardware requires changes.
I am thinking that Microsoft will be moving away from some of the miniports
because the need to force hardware manufacturers to write for both 9x and NT
is disappearing.

Has anyone ever seen a disk driver based upon the DISK.SYS in the DDK which
also uses CLASSPNP.SYS?

How about a driver for the ext3 filesystem? Since I am current unemployed I
have been thinking about doing a file system driver for the fun of it. I
have the source from Red Hat 8 so I won’t have to learn all the structures,
but just create an upper wrapper for the FS interface and modify the lower
interface to the disk driver.

----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Thursday, January 02, 2003 9:22 PM
Subject: [ntdev] Re: How to allocate about half of the physical memory ?

>
> -----Original Message-----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Date: Fri, 3 Jan 2003 03:20:25 +0300
> Subject: [ntdev] Re: How to allocate about half of the physical memory ?
>
> > > Is it really possible to map something in the system process’s user
> > > address space?
> >
> > Yes, we did this is our RAMdisk sample going with our product (sorry
> > Mr. Roddy :slight_smile: )
> > This works.
> >
> > Max
> >
>
> That response doesn’t bother me 'cause it directly answers the user’s
question and only indirectly hawks your super
> fabulous scsiport replacement. It is the answer that DOESN’T answer the
question at all and yet appears to try to sell
> product that creeps me out. And now I really regret having posted anything
at all on this topic :frowning:
>
> ===========================
> Mark Roddy, shamelessly using his sig to hawk himself,
> Consultant, Microsoft DDK MVP
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@infiniconsys.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

If no direct copy-pastes will be done from Linux’s ext3 - then the
product can be commercial.
I don’t think that the FS structure itself can be subject of any IP,
including the FSF’s IP. It can be patented though. Is it?

Max

----- Original Message -----
From: “McCrory, Duane”
To: “NT Developers Interest List”
Sent: Friday, January 03, 2003 6:13 AM
Subject: [ntdev] Re: How to allocate about half of the physical memory
?

Do your homework regarding the GPL (GNU Public License) in its
relation to the ext3 filesystem. You may find out that you can’t
really sell your binary without giving away the source code to the
world (even on a Windows platform, since you are planning to base your
work on GPL source code).

-----Original Message-----
From: David J. Craig [mailto:xxxxx@yoshimuni.com]
Sent: Thursday, January 02, 2003 10:06 PM
To: NT Developers Interest List
Subject: [ntdev] Re: How to allocate about half of the physical memory
?

I like their SCSI library. Saves a lot of work learning all the guts
of
SCSI ports and determining where not having real hardware requires
changes.
I am thinking that Microsoft will be moving away from some of the
miniports
because the need to force hardware manufacturers to write for both 9x
and NT
is disappearing.

Has anyone ever seen a disk driver based upon the DISK.SYS in the DDK
which
also uses CLASSPNP.SYS?

How about a driver for the ext3 filesystem? Since I am current
unemployed I
have been thinking about doing a file system driver for the fun of it.
I
have the source from Red Hat 8 so I won’t have to learn all the
structures,
but just create an upper wrapper for the FS interface and modify the
lower
interface to the disk driver.

----- Original Message -----
From: “Mark Roddy”
To: “NT Developers Interest List”
Sent: Thursday, January 02, 2003 9:22 PM
Subject: [ntdev] Re: How to allocate about half of the physical memory
?

>
> -----Original Message-----
> From: “Maxim S. Shatskih”
> To: “NT Developers Interest List”
> Date: Fri, 3 Jan 2003 03:20:25 +0300
> Subject: [ntdev] Re: How to allocate about half of the physical
memory ?
>
> > > Is it really possible to map something in the system process’s
user
> > > address space?
> >
> > Yes, we did this is our RAMdisk sample going with our product
(sorry
> > Mr. Roddy :slight_smile: )
> > This works.
> >
> > Max
> >
>
> That response doesn’t bother me 'cause it directly answers the
user’s
question and only indirectly hawks your super
> fabulous scsiport replacement. It is the answer that DOESN’T answer
the
question at all and yet appears to try to sell
> product that creeps me out. And now I really regret having posted
anything
at all on this topic :frowning:
>
> ===========================
> Mark Roddy, shamelessly using his sig to hawk himself,
> Consultant, Microsoft DDK MVP
> Hollis Technology Solutions
> xxxxx@hollistech.com
> www.hollistech.com
> 603-321-1032
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@yoshimuni.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


You are currently subscribed to ntdev as: xxxxx@infiniconsys.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


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

As noted, one can map into user space in the System process. But your
mention of overcoming the 2G limit in System is a bit worrisome: Don’t
be using resources of any sort (e.g., virtual memory) extravagantly in
such a process, as you might defeat some OS function that needs the
resource and will fail without it (e.g., BSOD).


If replying by e-mail, please remove “nospam.” from the address.

James Antognini