SYS "RtlMoveMemory"

Discussions related to graphics (2D and 3D), animation and games programming
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

SYS "RtlMoveMemory"

Post by Ric »

Afternoon all.
I currently writing a Minecraft style game, which is going quite well. I have a simple question that may not have a simple answer. When you call "RtlMoveMemory", I assume it runs on a different thread, because if you call twice very close together it has some interesting side effects. This can be solved by placing a WAIT X statement between calls, but inevitably wastes time and may not work on a different system as the "RtlMoveMemory" call may take a different time depending on the OS being used. My question is, Is there a way of knowing when the call has finished and for the rest of the program to then execute?

Kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023
Hated Moron

Re: SYS "RtlMoveMemory"

Post by Hated Moron »

Ric wrote: Tue 06 Dec 2022, 11:54 When you call "RtlMoveMemory", I assume it runs on a different thread, because if you call twice very close together it has some interesting side effects.
This is news to me, I would have expected RtlMoveMemory to run in the same thread as the code calling it. Like all memory operations there may be a cache-coherency issue (e.g. multiple CPU cores seeing 'consistent' memory) but modern CPUs, particularly x86 CPUs, do a pretty good job of hiding this from the programmer.

I assume you are not using it to move code (i.e. the contents of the CPU's Instruction Cache) because that could certainly trigger the Self-Modifying Code provision of x86 CPUs. Otherwise I'm surprised at your findings and a Google search hasn't found any supporting evidence, can you create a small program which demonstrates them?
Ric
Posts: 208
Joined: Tue 17 Apr 2018, 21:03

Re: SYS "RtlMoveMemory"

Post by Ric »

Thanks Richard

I will upload a demo when i get my resolution problem sorted.

Kind regards Ric
Kind Regards Ric.

6502 back in the day, BB4W 2017 onwards, BBCSDL from 2023