PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Self Modifying Code and Cachesync Issues

Hi,

I'm messing around with self modifying code, and from reading the forums, (hm's comments), I've done the following

Code:
pCodeMemory = reinterpret_cast<u8 *>(VirtualAlloc(0, 1024, MEM_COMMIT, PAGE_EXECUTE_READWRITE));


I then put the self modifying code into this allocated area.

After this I then perform the following

Code:
CacheSync(CACHE_SYNC_INSTRUCTIONS | CACHE_SYNC_WRITEBACK);


However this is causing errors in the linker,

error LNK2019: unresolved external symbol "void __cdecl CacheSync(int)" (?CacheSync@@YAXH@Z) referenced in function ....

I've searched all the ms headers, and cannot find a reference to any of these definitions. Any help would be most appreciated!

Glen.
Your "CacheSync" was declared as a C++ function (notice the mangled name reported by the linker). Make sure you declare it as (extern "C").

Also, I think this is a WinCE 4.0 API, I don't think it's available in WinCE 3.0. Make sure you have a Win CE 4.0 SDK.
Hi Thierry,

Thats fixed the linking issues thanks, now its just the defines CACHE_SYNC_xxxxxxx, I cannot find these anywhere. Not too bothered about having them as such, the final number will do :)

Update: It appears to be defined in a header file called Pkfuncs.h, this is only included with the platform sdk, and I really don't want to install that just to get a header file.

Can anyone post it to me please, or at least tell me what they are defined too.

glen@acepocket.com

Cheers

Glen.
GlenC wrote:Hi Thierry,

Update: It appears to be defined in a header file called Pkfuncs.h, this is only included with the platform sdk, and I really don't want to install that just to get a header file.
Can anyone post it to me please, or at least tell me what they are defined too.

http://cvs.sourceforge.net/viewcvs.py/ogl-es/ogles/src/arm/CodeGenerator.cpp?view=markup

Here you go.

- hm
Thanks mate :D

Glen.