The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: bluescreen on September 01, 2005, 10:22:38 PM

Title: How to read from linear address?
Post by: bluescreen on September 01, 2005, 10:22:38 PM
Hi, i have a linear memory address. How do i read a value from it?

if i do:

mov eax, linearaddress
mov ecx, [eax]

to get value from linearaddress to ecx, i get a PAGE_FAULT_IN_NONPAGED_AREA


sry for this noob question   ::)
Title: Re: How to read from linear address?
Post by: PBrennick on September 01, 2005, 11:05:05 PM
bluescreen,

You need to use:

mov eax, offset linearaddress

Paul
Title: Re: How to read from linear address?
Post by: gabor on September 02, 2005, 06:19:21 AM
Hi!

I cannot decide what is the exact addressing you want to use.

1. the linear address is a calcuated address, like [esi+ebx*4+6] then your code was syntactically correct.

2. the linear address is a reference to an address, like a label, a proc name. Then PBrennick is right, you need to add offset or you can use the 'lea' instruction.

BTW: when I have memory memory access error, I mainly get protection fault read or write from or to the memory is not permitted, but i've never received page fault. That's strange!

Greets, Gábor

Title: Re: How to read from linear address?
Post by: Tedd on September 02, 2005, 11:58:54 AM
..unless you're expecting to be able to just access any area of memory (like in DOS) which you're not allowed to do :naughty:
You can only access memory that is 'yours' :P
Title: Re: How to read from linear address?
Post by: Opcode on September 02, 2005, 12:51:54 PM
Hi,

The bugcheck PAGE_FAULT_IN_NONPAGED_AREA appears when your are
programming a device driver in Windows NT platform.

Search in the MS DDK to know more about it and read this
excellent article at OSROnline:
http://www.osronline.com/article.cfm?id=335

Regards,
Opc0de
Title: Re: How to read from linear address?
Post by: ToutEnMasm on September 03, 2005, 04:44:28 PM
Ho,Ho
  :boohoo:
You ask something without saying what API return this adress,several kind of adress are returned by the api.It is not sure that you can qualified it very well.
The intel Books are of good advise on this.
Some API can translate adresses.
The question is , what sort of adress have You ?
                                          ToutEnMasm