Well put. It seems like Kelvin’s third machine has about 64K less
conventional memory than the other two (although those differ slightly
as well). Assuming that this is correct, NTLDR could possibly get testy
as it does start in real mode; I have no idea. Sorry.
mm
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mandy Lam
Sent: Thursday, June 28, 2007 12:32
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] NTLDR and real mode memory
The details of INT15H, E820H can be found in ACPI spec
http://www.acpi.info/DOWNLOADS/ACPIspec10b.pdf (section 14.1).
Our product hooks to int15h, modifies the returns of this
function from original BIOS to steal memory from Windows too. So I have
observed BIOS returns of a few PCs and found the result consistent.
Below is one of the sample output from original BIOS. These debug output
are read from Address Range Descriptor Structure pointed by ES:DI, and
you have to repeatedly call INT15h E820h until returned EBX = 0 to get
the whole memory map.
Output msg Format: Find: baseaddrhigh:baseaddrlow len:
lengthhigh:lengthlow Type: :
Find: 00000000:00000000 len: 00000000:0009F800 Type: 00000001
Find: 00000000:000F0000 len: 00000000:00010000 Type: 00000002
Find: 00000000:FFFF0000 len: 00000000:00010000 Type: 00000002
Find: 00000000:1EFF3000 len: 00000000:0000D000 Type: 00000003
Find: 00000000:1EFF0000 len: 00000000:00003000 Type: 00000004
Find: 00000000:0009F800 len: 00000000:00000800 Type: 00000002
Find: 00000000:00100000 len: 00000000:1EEF0000 Type: 00000001
From what I observe, both XP & Vista use this memory map to
decide what memory can be used. The difference I see so far is:
On XP, it uses memory ranges that are explicitly claimed as
AddressRangeMemory (value = 1) only
On Vista, it uses memory ranges that are NOT explicitly claimed as
AddressRangeReserved (2) or AddressRangeACPI (3) or AddressRangeNVS (4).
Hence we have to add some codes to explicitly claim a certain range of
memory as AddressRangeReserved to make work on Vista. Your problem
seems to be different than ours so I am not sure the exact cause. But
trying to work on BIOS memory map returns is the right direction, I
believe.
Note that there are some memory ranges that, although not
explicitly specified as reserved from the memory map, OS will not use
it. E.g. video memory at A0000 - BFFFF, BIOS interrupt table (0:0) and
data area (40:0)
Mandy
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of kelvin lim
Sent: Thursday, June 28, 2007 8:24 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NTLDR and real mode memory
Ok,
I have 3 outputs so far
One 2 of the computers where my encryption solution works I get this :
00 00 00 00 00 00 00 00 00 F0 09 00 00 00 01 00
and
00 00 00 00 00 00 00 00 00 F8 09 00 00 00 01 00
On the computer which my encryption does not work I get this
00 00 00 00 00 00 00 00 00 00 09 00 00 00 01 00
It seems to be the last call that NTLDR makes before it hangs.
Kelvin
On 6/28/07, Martin O’Brien wrote:
Ignore what I just wrote. My head is not quite working yet today.
ES:DI should be the same, but, obviously what they point to gets
modified, which is presumably what your interested in. Sorry about
that. In any case, could you post a couple of examples of output from
different platforms?
mm
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of kelvin lim
Sent: Thursday, June 28, 2007 06:46
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] NTLDR and real mode memory
Thanks guys.
I just managed to hook it and apprently it does get called at the very
last part. But I can’t quite make out the data in the return buffer in
ES:DI
Can anyone make some sense of it. I seem to get different results on
different hardware.
Best wishes,
Kelvin
On 6/28/07, Martin O’Brien < xxxxx@evitechnology.com
mailto:xxxxx > wrote:
Probably. Just as Maxim suggested, you’ve got to break out WinDbg
configured for boot debugging and give it a try it. Also, some sort of
JTAG emulator like an Arium ECM-50 or other suitable hardware assisted
debugging technology, it will greatly help the exploring and debugging
the BIOS/pre ntldr part of the process. That being said, even the entry
level price is rather steep.
mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto: xxxxx@lists.osr.com
mailto:xxxxx] On Behalf Of Maxim S.
Shatskih
Sent: Thursday, June 28, 2007 04:59
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] NTLDR and real mode memory
I think that only practical trial can help.
–
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com http:</http:>
“kelvin lim” wrote in message news:xxxxx@ntdev…
> Thanks Maxim,
>
> There’s a very interesting suggestion. Would is be possible to
“reserve” say
> 40KB of conventional memory. Any idea how much memory NTLDR actually
needs ?
>
> Best wishes,
> Kelvin
>
> On 6/28/07, Maxim S. Shatskih < xxxxx@storagecraft.com
mailto:xxxxx > wrote:
> >
> > > I read on another post that there is a certain area of memory that
> > Windows
> > > doesnt use at pre-boot. Does anyone have any idea what the
location of
> > this
> > > memory is?
> > >
> > > I’m asking this because I have a full disk encryption product that
i’m
> > > developing and in the process I hook int 13h.
> >
> > Hook the int11h and int15h chains in your real mode pre-NTLDR code,
and
> > fake
> > the response to “get memory size” and “get ACPI memory map” BIOS
queries,
> > reporting, say, 1KB less of real-mode 640KB memory - 639KB.
> >
> > This excluded 1KB can be used by your code for any purpose.
> >
> > –
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > xxxxx@storagecraft.com
> > http://www.storagecraft.com http:</http:>
> >
> >
> > —
> > Questions? First check the Kernel Driver FAQ at
> > http://www.osronline.com/article.cfm?id=256
> >
> > To unsubscribe, visit the List Server section of OSR Online at
> > http://www.osronline.com/page.cfm?name=ListServer
> >
>
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
— Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256 To unsubscribe, visit the
List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer
—
Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256
To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer</mailto:xxxxx></mailto:xxxxx></mailto:xxxxx></lengthhigh:lengthlow></baseaddrhigh:baseaddrlow>