I tried to find anything that will show code but I wasn't able to
find anything expect for an answer on stackoverflow. I would find
a lot of theory but no practical code that works. What I want to
do is allocate memory (with execution mapping), add the machine
instructions and then allocate ano
Note , it is also possible to do inline assembly with asm{...}
or __asm(T) {..}.
On Monday, 6 June 2022 at 15:27:12 UTC, Alain De Vos wrote:
Note , it is also possible to do inline assembly with asm{...}
or __asm(T) {..}.
Thank you for the info! I am aware of that, I don't want to
practically do this. I just want to learn how it works. It will
be useful when I'll built m
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
void* code = mmap(null, cast(ulong)500, PROT_READ |
PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0);
On a lot of systems, it can't be executable and writable at the
same time, it is a security measure.
see https://en.wikipedia.or
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
Any ideas?
See:
https://github.com/GhostRain0/xbyak
https://github.com/MrSmith33/vox/blob/master/source/vox/utils/mem.d
On Monday, 6 June 2022 at 16:08:28 UTC, Adam D Ruppe wrote:
On a lot of systems, it can't be executable and writable at the
same time, it is a security measure.
see https://en.wikipedia.org/wiki/W%5EX
so you might have to mprotect it to remove the write permission
before trying to execute
On Monday, 6 June 2022 at 16:24:58 UTC, Guillaume Piolat wrote:
See:
https://github.com/GhostRain0/xbyak
https://github.com/MrSmith33/vox/blob/master/source/vox/utils/mem.d
Thank you! And I just noticed that the second source is from
Vox
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
```
// mov rdx,
*cast(char*)(code + 14) = 0x48;
*cast(char*)(code + 15) = 0xC7;
*cast(char*)(code + 16) = 0xC2;
*cast(char*)(code + 17) = 12;
*cast(char*)(code + 18) = 0x00;
*cast(char*)(code + 19) = 0x00;
*cast(char*)(code +
On Monday, 6 June 2022 at 18:05:23 UTC, Johan wrote:
This instruction is wrong. Note that you are writing twice to
RDX, but also that you are using `mov sign_extend imm32, reg64`
instead of `mov imm64, reg64` (`0x48 0xBA`?). Third, why append
an extra zero (`*cast(char*)(code + 32) = 0x00;`)? T
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
In case someone is wondering, I found an answer in another
forum. The code is the following:
```d
import core.stdc.stdio;
import core.stdc.string;
import core.stdc.stdlib;
import core.sys.posix.sys.mman;
void putbytes(char **code, const char
On Monday, 6 June 2022 at 15:13:45 UTC, rempas wrote:
I tried to find anything that will show code but I wasn't able
to find anything expect for an answer on stackoverflow. I would
find a lot of theory but no practical code that works. What I
want to do is allocate memory (with execution mappin
11 matches
Mail list logo