Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : Instruction Movaps [ Algorithme / Autre ] (cedricbi)

mercredi 20 février 2008 à 12:38:22 | Instruction Movaps

cedricbi

Bonjour,

Je voudrais utiliser l'instruction SSE movaps.
J'utilise Borland Delphi Studio 2006, mais je n'arrive pas "à la faire" fonctionner: lorsque il l'exécute, Delphi m'informe d'une petite violation d'accès dans la mémoire.
Savez-vous comment l'utiliser?

Merci


Le plus dur dans un programme c'est de savoir pourquoi il marche !


jeudi 21 février 2008 à 00:57:25 | Re : Instruction Movaps

f0xi

Membre Club Administrateur CodeS-SourceS
Réponse acceptée !


MOVAPS

Copie 4 float32 (128 bits quels qu'ils soient)

movaps xmm1, xmm2

movaps mem128, xmm2
movaps xmm1, mem128

mem ALIGNEMENT SUR 16 OBLIGATOIRE sinon utiliser MOVUPS





jeudi 21 février 2008 à 13:12:37 | Re : Instruction Movaps

cedricbi

Bonjour,

Merci pour ces précisions. Maintenant, mon problème ce pose sur l'alignement sur 16.
Comment l'obtenir ?


Le plus dur dans un programme c'est de savoir pourquoi il marche !


jeudi 21 février 2008 à 16:16:48 | Re : Instruction Movaps

BruNews

Administrateur CodeS-SourceS
DWORD __fastcall bnAlign16(DWORD v)
{
  if(v & 15) v = (v + 16) & -16;
  return v;
}

ciao...
BruNews, MVP VC++

jeudi 21 février 2008 à 19:58:44 | Re : Instruction Movaps

f0xi

Membre Club Administrateur CodeS-SourceS
Réponse acceptée !

aie bunews qui pose du C a la place du delphi :)

si je dis pas de betise :
tu peu l'obtenir grace a la fonction Windows VirtualAlloc ... (regarder l'aide du SDK windows dans delphi / ou msdn)
(confirmation de brunews, virtualalloc garantis l'allignement des données)

The VirtualAlloc function reserves or commits a region of pages in the virtual address space of the calling process. Memory allocated by this function is automatically initialized to zero.

LPVOID VirtualAlloc(

    LPVOID lpAddress,    // address of region to reserve or commit 
    DWORD dwSize,    // size of region
    DWORD flAllocationType,    // type of allocation
    DWORD flProtect     // type of access protection
   );   
 

Parameters

lpAddress

Specifies the desired starting address of the region to allocate. If the memory is being reserved, the specified address is rounded down to the next 64-kilobyte boundary. If the memory is already reserved and is being committed, the address is rounded down to the next page boundary. To determine the size of a page on the host computer, use the GetSystemInfo function. If this parameter is NULL, the system determines where to allocate the region.

dwSize

Specifies the size, in bytes, of the region. If the lpAddress parameter is NULL, this value is rounded up to the next page boundary. Otherwise, the allocated pages include all pages containing one or more bytes in the range from lpAddress to (lpAddress+dwSize). This means that a 2-byte range straddling a page boundary causes both pages to be included in the allocated region.

flAllocationType

Specifies the type of allocation. You can specify any combination of the following flags:

Flag    Meaning
MEM_COMMIT    Allocates physical storage in memory or in the paging file on disk for the specified region of pages.
An attempt to commit an already committed page will not cause the function to fail. This means that a range of committed or decommitted pages can be committed without having to worry about a failure.
MEM_RESERVE    Reserves a range of the process's virtual address space without allocating any physical storage. The reserved range cannot be used by any other allocation operations (the malloc function, the LocalAlloc function, and so on) until it is released. Reserved pages can be committed in subsequent calls to the VirtualAlloc function.
MEM_TOP_DOWN    Allocates memory at the highest possible address.
 

flProtect

Specifies the type of access protection. If the pages are being committed, any one of the following flags can be specified, along with the PAGE_GUARD and PAGE_NOCACHE protection modifier flags, as desired:

Flag    Meaning
PAGE_READONLY    Enables read access to the committed region of pages. An attempt to write to the committed region results in an access violation. If the system differentiates between read-only access and execute access, an attempt to execute code in the committed region results in an access violation.
PAGE_READWRITE    Enables both read and write access to the committed region of pages.
PAGE_EXECUTE    Enables execute access to the committed region of pages. An attempt to read or write to the committed region results in an access violation.
PAGE_EXECUTE_READ    Enables execute and read access to the committed region of pages. An attempt to write to the committed region results in an access violation.
PAGE_EXECUTE_READWRITE    Enables execute, read, and write access to the committed region of pages.
PAGE_GUARD    Pages in the region become guard pages. Any attempt to read from or write to a guard page causes the operating system to raise a STATUS_GUARD_PAGE exception and turn off the guard page status. Guard pages thus act as a one-shot access alarm.The PAGE_GUARD flag is a page protection modifier. An application uses it with one of the other page protection flags, with one exception: It cannot be used with PAGE_NOACCESS. When an access attempt leads the operating system to turn off guard page status, the underlying page protection takes over.If a guard page exception occurs during a system service, the service typically returns a failure status indicator.
PAGE_NOACCESS    Disables all access to the committed region of pages. An attempt to read from, write to, or execute in the committed region results in an access violation exception, called a general protection (GP) fault.
PAGE_NOCACHE    Allows no caching of the committed regions of pages. The hardware attributes for the physical memory should be specified as "no cache." This is not recommended for general usage. It is useful for device drivers; for example, mapping a video frame buffer with no caching. This flag is a page protection modifier, only valid when used with one of the page protections other than PAGE_NOACCESS.
 

Return Values

If the function succeeds, the return value is the base address of the allocated region of pages.
If the function fails, the return value is NULL. To get extended error information, call GetLastError.

Remarks

VirtualAlloc can perform the following operations:

·    Commit a region of pages reserved by a previous call to the VirtualAlloc function.
·    Reserve a region of free pages.
·    Reserve and commit a region of free pages.

 

You can use VirtualAlloc to reserve a block of pages and then make additional calls to VirtualAlloc to commit individual pages from the reserved block. This enables a process to reserve a range of its virtual address space without consuming physical storage until it is needed.
Each page in the process's virtual address space is in one of three states:

State    Meaning
Free    The page is not committed or reserved and is not accessible to the process. VirtualAlloc can reserve, or simultaneously reserve and commit, a free page.
Reserved    The range of addresses cannot be used by other allocation functions, but the page is not accessible and has no physical storage associated with it. VirtualAlloc can commit a reserved page, but it cannot reserve it a second time. The VirtualFree function can release a reserved page, making it a free page.
Committed    Physical storage is allocated for the page, and access is controlled by a protection code. The system initializes and loads each committed page into physical memory only at the first attempt to read or write to that page. When the process terminates, the system releases the storage for committed pages. VirtualAlloc can commit an already committed page. This means that you can commit a range of pages, regardless of whether they have already been committed, and the function will not fail. VirtualFree can decommit a committed page, releasing the page's storage, or it can simultaneously decommit and release a committed page.
 

If the lpAddress parameter is not NULL, the function uses the lpAddress and dwSize parameters to compute the region of pages to be allocated. The current state of the entire range of pages must be compatible with the type of allocation specified by the flAllocationType parameter. Otherwise, the function fails and none of the pages are allocated. This compatibility requirement does not preclude committing an already committed page; see the preceding list.

The PAGE_GUARD protection modifier flag establishes guard pages. Guard pages act as one-shot access alarms. See Guard Pages. 

See Also

GlobalAlloc, HeapAlloc, VirtualFree, VirtualLock, VirtualProtect, VirtualQuery


deefsign.gif

jeudi 21 février 2008 à 21:04:38 | Re : Instruction Movaps

cedricbi

Merci !


Le plus dur dans un programme c'est de savoir pourquoi il marche !




Cette discussion est classé dans : utiliser, delphi, instruction, movaps


Répondre à ce message

Sujets en rapport avec ce message

Comment utiliser l'instruction "Goto"? [ par Manthis ] Salut,Je voudrais savoir comment utiliser l'instruction Goto.Je sais qu'en VB il suffit de faire:Goto Fin...(et plus loin dans le code)...Fin: instruc utiliser excel depuis delphi [ par manudel ] Depuis delphi, j'appelles Excel, et je veux pouvoir fermer la feuille excel, sans une demande de confirmation d'enregistrement. EMail sans POP ni SMTP [ par Fanzy ] Bonjour,J'ai besoin d'envoyer un EMail a un utilisateur a partir d'uneappli en Delphi. Ce mail est entierement automatise, l'adresse du destinataire, Comment utiliser une BASE SQL avec delphi 7 [ par jorox ] Bonjour,N'ayant que très peu de compétence en matière de SQL avec Delphi 7, est-ce que quelqu'un pourrai m'expliquer comment faire pour que par exempl Delphi + mysql.... [ par Pipi ] Bonjour,Je connais Delphi, je connai mysql, mais je ne sais pas utiliser mysql avec Delphi!!!!J'essaye de mettre au point une application de gestion d Aide pour utiliser un "module" [ par Sylvainlefou ] Je debute plus ou moins en Pascal sous Delphi 7 et je viens du Basic (VB).J'aimerai utiliser facilement et simplement les sockets client, a la Winsock Utiliser des tabulations dans word [ par fil1974 ] Bonjour,Je génère un document word à partir d'une appli delphi, et je voudrais ajouter des tabulations.J'ai regardé comment word le fait à l'aide d'un Utiliser les commande dos avec delphi [ par cricri_b34 ] salut,j'aimerais utiliser le dos dans mon appliactionJ'utilise : winexec('ftp', SW_SHOWNORMAL) ;mais la j'aimerais entré d'atre commande a la suite(po char** et Delphi [ par ptitmanu ] Bonjour,Je suis débutant en Delphi et je souhaiterais utiliser une DLL programmée en C++. J'utilise une méthode qui retourne un char**, mais je ne sai Delphi et Informix [ par Ammoniak ] Bonjour à tous, J'ai un petit problème: je dois faire une appli qui se connecte à une base Informix sur serveur distant. Je sais qu'il faut utiliser


Nos sponsors

Sondage...

CalendriCode

Janvier 2009
LMMJVSD
   1234
567891011
12131415161718
19202122232425
262728293031 

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,281 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.