Register to reply

Memory Flags and ASM

by martix
Tags: flags, memory
Share this thread:
martix
#1
Feb10-08, 07:17 PM
P: 128
I'm fiddling around with a hex editor here and the processes have memory blocks that have certain flags like MEM_COMMIT, MEM_RESERVE, PAGE_READWRITE. That sort of stuff. And I was wondering what all these exactly mean.
Also I'd like some resources on x86 assembly. Something that really starts at the beginning of how and why things are the way they are. Because I'm having a little bit of trouble grasping the registers concept(among other things)...
Phys.Org News Partner Science news on Phys.org
World's largest solar boat on Greek prehistoric mission
Google searches hold key to future market crashes
Mineral magic? Common mineral capable of making and breaking bonds
ranger
#2
Feb10-08, 08:09 PM
PF Gold
ranger's Avatar
P: 1,685
See the VirtualAllocEx function (windows) and mmap() (POSIX) for more info:

http://msdn2.microsoft.com/en-us/lib...90(VS.85).aspx
http://www.opengroup.org/onlinepubs/...ions/mmap.html
chroot
#3
Feb10-08, 08:27 PM
Emeritus
Sci Advisor
PF Gold
chroot's Avatar
P: 10,429
Can you say more about what you mean by "grasping the registers concept?"

- Warren

martix
#4
Feb10-08, 08:42 PM
P: 128
Memory Flags and ASM

Well like what type of data goes where and why. Are they used just like an even faster memory than RAM or do they also have some special function? Are they the L1/L2 cache of the processor? Do you have to load everything in the registers manually? Does the compiler usually do that for you?
I mean I don't even know what to ask. I'm just starting so I basically know exactly SQUAT about ASM.
mgb_phys
#5
Feb10-08, 09:07 PM
Sci Advisor
HW Helper
P: 8,954
In simple terms registers are the only storge inside the processor.
To add 2 numbers you load the first number into register A, the second number into register B and call ADD_AB
They are also used to store arguements to functions, so under DOS to change directory you load register A with the address of a string in memory with the directory name and call a particiular software interupt.
ranger
#6
Feb11-08, 09:24 AM
PF Gold
ranger's Avatar
P: 1,685
Quote Quote by martix View Post
Well like what type of data goes where and why. Are they used just like an even faster memory than RAM or do they also have some special function? Are they the L1/L2 cache of the processor? Do you have to load everything in the registers manually? Does the compiler usually do that for you?
I mean I don't even know what to ask. I'm just starting so I basically know exactly SQUAT about ASM.
Theres a lot that goes into learning about registers and their functions. This info can be found in any computer architecture book and most intro asm books. In order to appreciate this concept you'll have to get a grasp about different memory modes, instructions sets, CPU storage and organization, and so on. There are a few books that I can recommend, but you'll want to check your local library or school for a copy and gauge whether or not its language appeals to you.

Null, Linda (2003). The Essentials of Computer Organization and Architecture
Dandamudi, Sivarama (2005) Guide to Assembly Language Programming in Linux

You may also find it in your best interest to have knowledge about digital logic. For non-electrical engineers, I would recommend The Science of Electronics: Digital by Thomas L. Floyd and David M. Buchla.
DualCortex
#7
Feb14-08, 06:34 PM
P: 9
I found this book to be a really nice intro to ASM:
http://www.amazon.com/Definitive-Gui.../dp/0471732788

You'll have fun developing the "DIY calculator".
ChrisLeslie
#8
Feb16-08, 01:46 AM
P: n/a
MEM_COMMIT, MEM_RESERVE, PAGE_READWRITE are examples of constants either defined by the program or defined by Windows. They will equate to some simple integer usually and used perhaps as parameters for APIs or other procedures etc. They make life simpler for the programmer so that he/she can read something meaningfull rather that just a number. They are not flags. Flags are hardware bits in a CPU register that mean something to the assembler program. For example, the "zero" flag is set upon an operation resulting in a zero result. That content of that flag will be picked up by another part of a program to test for some other action. There are about 17 different flags I think in a x86 CPU.
martix
#9
Feb18-08, 04:01 PM
P: 128
I wasn't talking about flags in assembly. It was on a separate note, something I found when exploring my memory with a hex editor(it said certain ranges of RAM have certain flags). Some appear to be self-explanatory, but others are not.
But basically thanks for the links. This book may be nice, but I doubt I'll be getting seriously into that stuff until I have to(which is still some time away).
Actually the ASM part of the thread was meant to be more on a side note, not the other way around.


Register to reply

Related Discussions
Verbal memory/semantic memory, also long-term memory Social Sciences 0
Small town outlaws flags Current Events 14
Six flags commercial General Discussion 1
Six Flags rotation problem Introductory Physics Homework 8
Who's sick of seeing all those flags everywhere? Current Events 52