assembly

C#: Hijacking a near relative call

Alright, I'm trying to write a vary basic modification to a program NOT written by me. I DO NOT have the source to it. I also do not care if this only works for a single version of the program, so hard coding offsets is feasible. Anyways, I've found the function and where it is called in the compiled program. .text:1901C88F loc_1901C88...

Effect of suffixes in memory to cache operations

In x86 GNU Assembler there are different suffixes for memory related operations. E.g.: movb, movs, movw, movl, movq, movt(?) Now my question is the following: Does the suffix has ANY effect on how the processor is getting the data out of main memory or will always be one or more 32-bit (x86) chunks loaded into the cache ? What are t...

Question about Objective C calling convention and argument passing on ARM

I want to know how objective C runtime handle arguments when I call a objective C method like [NSString stringWithFomat:@"%@, %@", @"Hello", @"World"] There are three arguments for this objective C call, how does it work compared to typical way on a ARM system. I have known register r0, r1, r2, r3 will hold first 4 arguments, how abou...

What about Programmer "Invisible" registers?

These are "Programmer Visible" x86-64 registers: What about the invisible registers? Just now I learned that MMU registers, Interrupt Descriptor Table (IDT) uses these invisible registers. I'm learning these things in the hard way. Is there any resource (book/documentation/etc) that gives me the complete picture at once? I am aware ...

What does the Kernel Virtual Memory of each process contain?

When say 3 programs (executables) are loaded into memory the layout might look something like this: I've following questions: Is the concept of Virtual Memory limited to user processes? Because, I am wondering where does the Operating System Kernel, Drivers live? How is its memory layout? I want to know more about kernel side memory...

error A2070: invalid instruction operands IN SSE MASM64

when compiling this in ml64.exe 64bit (masm64) the SSE command give me an error what do i need to do to include the SSE commands in 64 bit? .code foo PROC movlps [rdx], xmm7 ;;error A2070: invalid instruction operands movhlps xmm6, xmm7 movss [rdx+8], xmm6 ;;rror A2070: invalid instruction operands ret foo ENDP end i get t...

grdb not working variables

hi, i know this is kinda retarded but I just can't figure it out. I'm debugging this: xor eax,eax mov ah,[var1] mov al,[var2] call addition stop: jmp stop var1: db 5 var2: db 6 addition: add ah,al ret the numbers that I find on addresses var1 and var2 are 0x0E and 0x07. I know it's not segmented, but that ain't reason for it to d...

an 8085 assembly language program to find the factorial of a number

i want to find factorial a number which i take memory first.(intel 8085) edit: i'm beginner. i don't know how to write it's assembly codes. pseudo code: input n fact = 1 loop: ..multiply fact by n ..decrement n ..test n ..jump if not zero to loop output fact ...

How do you dynamically allocate memory in Mac OS X assembly?

I would like to dynamically allocate memory from an assembly program that does not link against the standard C library. Since brk(2) and sbrk(2) are unavailable on Mac OS X (10.6.2), what are the alternatives? (I'm guessing that it involves a Mach call, but there seems to be little documentation around that) ...

P6 Architecture - Register renaming aside, does the limited user registers result in more ops spent spilling/loading?

I'm studying JIT design with regard to dynamic languages VM implementation. I haven't done much Assembly since the 8086/8088 days, just a little here or there, so be nice if I'm out of sorts. As I understand it, the x86 (IA-32) architecture still has the same basic limited register set today that it always did, but the internal register...

Declaring local variables in assembly

Is it possible to allocate locally-scoped memory in assembly? For example, consider the following (completely contrived) situation: I have two macros, one of which is dependent on the other. The first is: minimum MACRO dest, num1, num2 ; Finds the minimum of two unsigned numbers, stores the result in dest And the second is: tripMin...

Is there assembler REPL under linux?

Recently I've started plaing with assembler under linux, there's good debuger, but comming from Ruby I'm missing simple REPL that would let me enter a line of assembler code and see the result on registers flags and stack. Can anyone point me in good direction? ...

How can I do compression in assembly?

Is there any code that I can look at to see how compression would be done in assembly? ...

What does subl do here?

So... I'm compiling into assembler, with gcc -S -O2 -m32: void h(int y){int x; x=y+1; f(y); f(2); } And it gives me the following: .file "sample.c" .text .p2align 4,,15 .globl h .type h, @function h: pushl %ebp movl %esp, %ebp subl $24, %esp movl 8(%ebp), %eax movl %eax, (%esp) call f movl $2, 8(%ebp) leave j...

what does JMP do to stack and frame pointers?

When an assembly has an instruction like jmp f what happens to the stack and frame pointers? I mean - f is a label in memory right? How can we jump to different address in memory and not update our frame and stack pointers... EDIT: I am talking about Intel x86 assembly yes :) ...

Drawing a stack frame for x86 assembly

So, I am kind of confused about drawing a stack frame for my assembly code. I have a feeling I started out wrong. Here is what I got so far, but as you can see I am confused at step 5, because I think my initial layout is wrong. Can you tell me where I went wrong? ...

How to access C arrays from assembler for Windows x64?

I've written an assembler function to speed up a few things for image processing (images are created with CreateDIBSection). For Win32 the assembler code works without problems, but for Win64 I get a crash as soon as I try to access my array data. I put the relevant info in a struct and my assembler function gets a pointer to this stru...

Easiest/Best Way to Learn the x86 Instruction Set?

I would like to learn the x86 Instruction Set Architecture. I don't meaning learning an assembly for x86. I want to understand the machine code baby. The reason is that I would like to write an assembler for x86. Then I want to write a compiler that compiles to that assembly. I know that there are the Intel manuals and AMD manuals that...

Is OSCompareAndSwap (Mac OS X) equivalent to CMPXCHG8B?

Is OSCompareAndSwap (Mac OS X) equivalent to CMPXCHG8B? ...

Is OSCompareAndSwap is immune to ABA problem like CMPXCHG8B?

Is OSCompareAndSwap is immune to ABA problem like CMPXCHG8B? ...