flat assembler
Message board for the users of flat assembler.

Index > Windows > Small C program to exclude bad RAM address?

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 05 Dec 2004, 19:10
OS: Windows XP Home SP2
CPU/Ram: Mobile AMD Duron 4, 1GHz / 256MB
System Manufacturer: Compaq Presario 730us

Using windiag.exe to test my RAM I get a consistent error for the following address: 0b5d9270. The system returns the wrong value, e.g. expects value f7f7f7f7 and instead gets f7f7e7f7. This RAM is on the motherboard and it's about as expensive to replace it than to buy a new computer.
Is there any small program that could be written so as to reserve/exclude this specific RAM address at boot so that it's not used? Unfortunately I know little programming ...
THANK YOU very much for your response, I really appreciate it.

Juan
Post 05 Dec 2004, 19:10
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 05 Dec 2004, 19:12
Actually I meant to write "small assembler program"; somebody told me that one couldn't write it in C
Post 05 Dec 2004, 19:12
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 05 Dec 2004, 19:44
With linux, you can (or could?) mark areas of memory as bad, and not have them used by the memory manager. With win9x, there might be a system.ini or registry settings, but I wouldn't know it. For NT, I believe there's a boot.ini switch to limit the amount of memory seen by the OS - but that would mean you can only use ~180 megs of those 256 megs. It might be possible to write a driver that allocates the specific areas of memory that are bad.

In case you haven't seen it, have a look at http://www.memtest86.com/ to pinpoint the exact areas that are bad.
Post 05 Dec 2004, 19:44
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 05 Dec 2004, 23:49
f0dder, thank you very much for your reply. It's the closest I've got to a hint about how to proceed to fix it. Do you know anybody or any forum or any way to get this driver written? Do you think it's even possible? I've posted this questions to some C and C++ forums and everybody, without exception has told me it's not possible to do. However, it's seems to me logically possible so I'm surprised.
Juan
P.S. I have the exact address of the area that's bad (windiag.exe determined it)
Post 05 Dec 2004, 23:49
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea 06 Dec 2004, 01:44
I have a question and a sugestion, then where is the problem in the RAM or in the mother board????


The suesgtion is, I guess is posible to write a application pheraphs not necesary to be a driver, but instead of mark the address permanently, alloc some memory there making a "shield" around this address, dont know if is posible to use the mark of allocation directly for an address instead of let the OS select where is, if is posible that, then your programm will only run at startup, allocate a shield around this addres and by this flag of allocation, any other programm not will be able of request this memory.


Pheraphs you get the idea, andpheraphs is exactly equal dificult than do the driver, but instead of limit your memory to 160 you make make a shield of about some Kb, and you dont loss much memory Wink.

Hope that sugestion serve, and the question that remain is: is posible to do a like allocation directly for a range of address, only for the porpuose of dont let others application use exactly this range of memory?
Post 06 Dec 2004, 01:44
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 06 Dec 2004, 05:44
if its @ the end , win 9x has a function to set maximum memory to use, it clips the end
Post 06 Dec 2004, 05:44
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Dec 2004, 13:00
There's a thread in order to get started writing a driver of your own:
http://board.flatassembler.net/topic.php?t=256
Post 06 Dec 2004, 13:00
View user's profile Send private message Yahoo Messenger Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 06 Dec 2004, 13:09
Matrix, any idea of what function is that of win 9x that allows you to clip the end? It may work; I don't mind switching back to win98.
Post 06 Dec 2004, 13:09
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 06 Dec 2004, 13:11
pelaillo, as far as you know, is there a function that could be used in a driver to either reserve or exclude memory with a certain phisical address?
Post 06 Dec 2004, 13:11
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 06 Dec 2004, 13:45
Juan, if you're on NT, get hold of Four-F's KMD tutorials and perhaps also the NTDDK (for documentation). I'm pretty sure there's a way to allocate a specific memory region. Since your bad region isn't near the start or end of your memory region, I guess there's a good chance the memory isn't allocated by other drivers/applications if you load your driver at system boot.

It's been a while since I did driver development, and I never really touched memory allocation, so I don't know whether there's an "easy" API to use, or if you have to build MDLs describing the bad areas. But once you find the right APIs to use, it should be very easy to develop the driver.

It probably has to be done from a driver, though - I know of no ring3 APIs that allow you to reserve physical memory.
Post 06 Dec 2004, 13:45
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 878
Location: Colombia
pelaillo 06 Dec 2004, 14:39
JuanPedro, as per f0dder's advice, the allocation cannot be done in ring3 because any allocation will be in virtual memory and is windows that decide the final physical address to use.

In win98 you may allocate the memory before booting windows (config.sys ?) or using a simple ring0 resident program that allocate the bad region. Once allocated, win98 detect it as used and skip it (by compatibility with old DOS programs)
Post 06 Dec 2004, 14:39
View user's profile Send private message Yahoo Messenger Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 06 Dec 2004, 14:52
run msconfig.exe
click to special, then set memory limiting
that's all
Post 06 Dec 2004, 14:52
View user's profile Send private message Visit poster's website Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea 06 Dec 2004, 15:38
Where is Four-F? I was trying access http://masm32.cjb.net/ but I cant get the redirection and I dont know the real name Very Happy...


Last edited by rea on 06 Dec 2004, 16:49; edited 1 time in total
Post 06 Dec 2004, 15:38
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 06 Dec 2004, 16:15
I posted a topic on hiro's board, have a look: http://www.win32asmcommunity.net/board/topic.php?p=153796
Post 06 Dec 2004, 16:15
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 07 Dec 2004, 00:54
f0dder, pelaillo, what you say about winNT allowing me to allocate a specific memory region is also valid for XP?
I'll switch to NT if I have to; I currently have XP and I'm curious.
Thanks
Post 07 Dec 2004, 00:54
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 07 Dec 2004, 01:44
f0dder, I just now realized about the topic you posted on hiro's board. It's great, thank you very much !!!!!
I don't understand most of it but you and these guys are terrific; I'll try to follow it and see what I can get from it.

Juan
Post 07 Dec 2004, 01:44
View user's profile Send private message Reply with quote
JuanPedro



Joined: 05 Dec 2004
Posts: 8
JuanPedro 07 Dec 2004, 04:10
I went into the topic posted into hiro's board and, even though I didn't understand much, I was able to realize that the suggested approaches led to something very similar to what Matrix suggested. In addition, as I was able to find out, Matrix approach is also do-able in XP (via boot.ini). This is very clean, easy and achieves the same thing as the suggestions in hiro's board.

f0dder, I wander if the approach suggested by the people who reponded to your posted topic may be used to actually selectively take out that memory address (0b5d9270) instead of just cutting off everything above 190MB as I had to do.
Post 07 Dec 2004, 04:10
View user's profile Send private message Reply with quote
rea



Joined: 14 Nov 2004
Posts: 92
rea 07 Dec 2004, 06:59
Some like this should be nice, http://msdn.microsoft.com/library/en-us/memory/base/creating_guard_pages.asp?frame=true

I have also watched that Windows CE have a function for alloc a address http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wcecoreos5/html/wce50lrfAllocPhysMem.asp

But is only for Windows CE, altought pheraphs something similar is posible for Windows.

Like write a driver that combine this two concepts using allocation and some flags like PAGE_GUARD|NOREAD|NOWRITE. Hehe, altought I think it should not be a easy problem?? to solve??
Post 07 Dec 2004, 06:59
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 07 Dec 2004, 15:07
I had a quick poke around, and I guess some of these might be starting points if you feel like playing with driver development - unfortunately I don't have the time to play around myself right now :/

NTOSKRNL::IoAllocateMdl
NTOSKRNL::MmAllocatePagesForMdl
NTOSKRNL::MmProbeAndLockPages
Post 07 Dec 2004, 15:07
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 06 Jul 2006, 03:09
Any progress? Razz

I'm having the same trouble with a computer but with two defective address located at 6.0 MB and 6.5 MB. As you can see I can't just set a config to exclude all memory above 6.0 MB. Apart of MmAllocatePagesForMdl I found IoReportResourceForDetection and IoReportDetectedDevice that seems to be another way. The computer has a WinMe installed (and the user does not want another OS), can I use those function over WinME freely?

Any other ideas of how to exclude memory regions will be much appreciated.

Regards
Post 06 Jul 2006, 03:09
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.