From what I know, back in the days of 16bit PC's we had the Segment registers contain the address of each type of segment and you could access an offset with something like this SS:[EDI], this would take the value contained in EDI as an offset to the Stack Segment.
Now I know that in 32bit systems, we have the GDT (Global Descriptor Ta...
Is it true that the x86 ASM "LOCK" command prefix causes all cores to freeze while the instruction following "LOCK" is being executed?
I read this in a blog post and it doesn't make sense. I can't find anything that indicates if this is true or not.
...
Hello,
i am writing a simple c program and my requirement is to print RIP(Instruction Pointer) from some function of the program. i dont want to use ptrace.
the one thing i tried with inline asm is:
asm("movl %%rip, %0;" : "=r"(val) )
this should copy my rip register value to variable val, but i am getting compilation error.
if i use ...
I know how to use LOCK to thread-safely increment a value:
lock inc [J];
But how do I read [J] (or any value) in a thread-safe manner? The LOCK prefix can't be used with mov. And if I do the following:
xor eax, eax;
lock add eax, [J];
mov [JC], eax;
It raises an error on line 2.
...
I know how to atomically write a value in x86 ASM. But how do I read one? The LOCK prefix can't be used with mov.
To increase a value, I am doing:
lock inc dword ptr Counter
How do I read Counter in a thread-safe way?
...
I was coding a snake game, and i got an apple image to use in the game, so i created a DC and then loaded the apple to this DC, when the game is running, it should copy the apple to the buffer and then the buffer to the screen, but the apple ends black and white in the screen, any1 has idea why? here is some of my code, might help...
...
I was drawing a bitmap on the screen, and i wanted to set a transparent color on this bitmap (0xFFFFFF White) i wanted to know if its possible, and if it is, how to do so xP
I use this code to load the bitmap
invoke LoadBitmap,eax,10
push eax
invoke GetDC,0
invoke CreateCompatibleDC,eax
pop ecx
mov [mapple],eax
invoke SelectObject,[ma...
I'm learning asm on Linux (noobuntu 10.04)
I got the following code off of: http://asm.sourceforge.net/intro/hello.html
section .text
global _start ;must be declared for linker (ld)
_start: ;tell linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call numb...
I disassembled an .exe file and got this as its first line.
push ebp
What does it mean?
Why ebp?
Does it have anything to do with pop command? even though I don't see it in the disassembly!
...
Suppose you've written a portable C++ code which runs smoothly on different platforms. To make some modifications to optimize performance, you use inline assembly inside your code. Is it a good practice (compiler optimization set aside) or will it make troubles for portability?
...
Is there any list of the hardware interrupts? i was coding a 16-bit app and i wanted to check some INTs but, i couldnt find anything usefull in google, can any1 provide me some docs about it? if possible, with details.
Im sorry if its not a valid request but, its the only place that suits this question i think
Thanks in advance
...
I'd really like to find a small board (probably EBX size or smaller) that uses an x86 processor, can run Linux, has a PC/104 expansion bus, and has around 10 analogue and digital I/O ports. The only boards I can find that meet this criteria are from a company called Diamond Systems, but they seem to be having a lot of issues with their ...
Hi.
I have the code:
float *mu_x_ptr;
__m128 *tmp;
__m128 *mm_mu_x;
mu_x_ptr = _aligned_malloc(4*sizeof(float), 16);
mm_mu_x = (__m128*) mu_x_ptr;
for(row = 0; row < ker_size; row++) {
tmp = (__m128*) &original[row*width + col];
*mm_mu_x = _mm_add_ps(*tmp, *mm_mu_x);
}
From this I get:
First-chance exception at 0x00ad192e i...
Okay, so I understand all of us C/C++ programmers have at one time met our untimely nemesis, the diabolical signal SIGSEGV, the Segmentation Fault. Now, I understood (emphasis on the past tense) this to be some form of fail safe / checking system within some portion of the machine code spat out by the magical GCC (or g++) compiler, or wh...
Hi, can anyone give me a comprehensive description about ORG directive?
When and why is it used in assembly written applications?
Using Nasm on x86 or AMD64.
...
I'm writing an 8086 assembler for a college project . I've gone through some material on compiler design on the internet and am reading the 'dragon book' of compilers . But the problem is I couldn't find much about the assembling (generating object code) part here . Are there any good books or links for assembler design . Where do I star...
Is it possible to insert assembly code on Visual C++ Express 2010 64 Bit?
If not, is there an intrinsic for adc (add with carry)?
...
I am studying Intel Protected Mode. I found that Call Gate, Interrupt Gate, Trap Gate are almost the same. In fact, besides that Call Gate has the fields for parameter counter, and that these 3 gates have different type fields, they are identical in all other fields.
As to their functions, they are all used to transfer code control into...
I wrote a multi-threaded app to benchmark the speed of running LOCK CMPXCHG (x86 ASM).
On my machine (dual Core - Core 2), with 2 threads running and accessing the same variable, I can perform about 40M ops/second.
Then I gave each thread a unique variable to operate on. Obviously this means there's no locking contention between the th...
I'm creating a setup program in VS2008 for a C# application that uses SQLite, which requires different versions of the assembly for x86 and x64 environments. What is the best way to have the setup program automatically install the correct assembly based on the environment?
...