Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
| Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 24th, 2007, 10:58 AM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default inline assembly on VS2005 c++ PROBLEM

Hi!

I am just beginning my adventure with inline assembler and I encountered a problem. I tried to find some solution through google, but after a long time with no success I decided to write here. My problem is as follows: I am writing an application to blur images with box-blur; I have to load a bitmap and do some operation with it. I thought I would use SSE2 as it would speed-up my progam. I have two structs
__declspec(align(0x4)) struct ARGB{
//__m128 m;
char r;
char g;
char b;
char a;
};

__declspec(align(0x10)) struct pixel4{
//__m128;
ARGB p[4];
};
and I store the data in an array:
input = (pixel4*) _aligned_malloc(sizeof(pixel4)*length, 0x10);
Now I would like to load the first 128 bits ( in C++ input[0] ) into an xmm register:

MOV esi, input;
MOVAPS xmm0, XMMWORD PTR [esi];

but it won't work. I get an access violation error at line MOVAPS... .

I did watch the esi register in debug mode. Its value is 44 (0x0000002c)
and I get this error msg:

Unhandled exception at 0x0043deec in testBMP.exe: 0xC0000005: Access violation reading location 0xffffffff.

Shouldn't it be access violation at 0x0000002c ? (Maybe I'm wrong, but I'm no expert - just a beginner, so excuse me :) )

Another thing I noticed is that the esi register contains the value 0x0000002c which is NOT dividable by 16 :/ it's also weird to me, because I used _aligned_malloc with 0x10 (16) to allocate 'input'; so after
MOV esi, input
esi should store the address to input which should be divisible by 16 (should have a zero at the end of its address in hex) and it it not :(


I also tried the following code:

MOV esi, [input];
MOVAPS xmm0, XMMWORD PTR [esi]

and I tried MOVUPS the same way as well - it still wouldn't work.
What did compile was:
MOV esi, [input];
MOVAPS xmm0, esi;
but I don't think it gives the result I want to get...

If anyone could help I would be grateful!

Kind Regards,


Reply With Quote


Similar Threads
Thread Thread Starter Forum Replies Last Post
VS2003 to VS2005 conversion problem mrleokarthik1 Visual Studio 2005 2 August 25th, 2010 07:58 AM
VS2005 Team Edition Problem - Text does not appear asmodeos Visual Studio 2005 0 August 19th, 2007 02:51 PM
problem in assembly salnavddin BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 8th, 2007 05:27 AM
problem in installing vs2005 prashant_telkar General .NET 0 June 19th, 2007 04:02 AM
Problem with Inline Excel Output Filename Sir Guso ASP.NET 1.0 and 1.1 Professional 2 May 31st, 2007 08:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.