Re: how do you start learning assembly language
- From: //\\\\o//\\\\annabee <w@xxxxxxxx>
- Date: Sat, 12 Jan 2008 19:40:10 +0100
På Sat, 12 Jan 2008 20:07:00 +0100, skrev Keith Kanios <keith@xxxxxxxxxx>:
On Jan 12, 9:57 am, "Ratch" <watc...@xxxxxxxxxxx> wrote:Just by definition, the paging mechanism is a relocation method. It
converts a logical address to a physical address. Isn't that obvious?
I haven't heard that one before.
However, I've heard/implemented other definitions of what paging is/
does...
1.) To get around physical address space fragmentation/holes.
2.) For memory space isolation, a form of protection.
3.) To abstract the architecture's full memory address space even if
you don't have the equivalent amount of RAM to support it.
4.) To establish shared memory regions despite potential barriers,
e.g. a monolithic kernel, dynamic libraries and file buffers.
5.) As a means of memory/buffer overflow protection, e.g. stack
"guard" pages.
I think there may be a few more definitions, but the above should
cover the majority of expected use.
I've always heard of relocation as a by-product of #2 and a result of
#4 above, but never as a method *of* paging.
As an example, your standard PE is linked with the assumption of
having a base address at 0x00400000. If for some reason it can't load
there, the loader will try to find a memory location sufficient for
loading and recalculate all appropriate relocatable addresses based
upon the newly established base address. Please note that this is
beyond your standard relocation calculations like those done for DLL
linking.
I have gaps to fill here for sure.
What happens with the datasegment, inside the PE?
if I say
[somedata: 100]
mov ecx D$SomeData ; "static" data "segment"
Does the CPU perform the relative translation of the label based on information elsewhere, or does the "linker", do it?? What about a dynamic segment. That is allocated at runtime, yes? So then it must be the CPU doing the translation. And the relocation must then just be telling somehow the CPU the new relative adresse?
[somedata2: ?]
mov ecx D$SomeData2
If I save this code (its binary) to a file,
and CHANGE the PE, and then load the binary file, then
it will no more work. The address will be incorrectly translated.
So all data and code can be "relocated" and this must be just some small operation for the loader, to just somehow inform the CPU where to find the new relative address for the page(s)?. then what I said earlier must be wrong.
The binary:
8b 0d 00 30 40 00 (00403000) ; mov ecx D$Somedata
8b 0d 04 30 40 00 (00403004) ; mov ecx D$SomeData2
6A 00 ; push 0
FF 15 03 10 40 00 (00401030) ; call "kernel32.ExitProcess"
hmm. just 4 bytes appart? thats weird isnt it?
shouldnt those segements be at further apart?
Whats the rest of the PE filled with then?
Did you do some trickey here Betov? Did you get fed
up with beeing critized of the PE being sooooo "large" and
implemented some trixs to make it smaller in the case
of small PES????? :D
Then why it is so big????
See what I am saying?
:)
a hexlisting is definitly needed sometimes.
.
- Follow-Ups:
- Re: how do you start learning assembly language
- From: Keith Kanios
- Re: how do you start learning assembly language
- References:
- how do you start learning assembly language
- From: Greg
- Re: how do you start learning assembly language
- From: Wolfgang Kern
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Wolfgang Kern
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Wolfgang Kern
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Wolfgang Kern
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Wolfgang Kern
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Frank Kotler
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Frank Kotler
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Frank Kotler
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Frank Kotler
- Re: how do you start learning assembly language
- From: Ratch
- Re: how do you start learning assembly language
- From: Keith Kanios
- how do you start learning assembly language
- Prev by Date: Re: how do you start learning assembly language
- Next by Date: Re: which way is faster?
- Previous by thread: Re: how do you start learning assembly language
- Next by thread: Re: how do you start learning assembly language
- Index(es):
Relevant Pages
|