Reputation: 49
I'm trying to understand how memory works, and how every instruction allocates memory. I'm also trying to understand the concept of offset, and base pointers. I am doing this for intel processors and MIPS. I am able to access memory windows in Visual Studio, however when i use gcc and gdb on UNIX, i get the this error on my code ![after compilation code][1]
error: use of undeclared identifier "_asm" _asm
I do not get this error in VISUAL STUDIO Here's what I'm trying to run (Very simple code)
void main()
{
int quizint = 0x01000080;
int n = 0xfffffff;
int MIPSzint = 0x80000001;
register int m = 3;
register int p = 256;
static int q = 0x7fffffff;
static int r = 0x10000000;
static int R = 0x8000000;
_asm
{
start_loop:
mov ebx, MIPSzint
add ebx, -2
mov ecx, quizint
mov eax, n
sub eax, q
add eax, R
mov edx, 1
add edx, q
add edx, 1
add edx, n
add R, -1
}
}
====>>> _asm gives me the error. Question is, do I need to add something in order to make it work in gcc?
Upvotes: 1
Views: 7194
Reputation: 145829
Use __asm__
if you are compiling with GNU extensions disabled. With GNU extensions you can also use asm
but _asm
is not supported by gcc
.
Upvotes: 1
Reputation: 249153
GCC calls it asm
instead of _asm
and the syntax is a little different. See https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html and http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html
Upvotes: 4