Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitda59f8dd2a739719776bddb1ff6173a6528c5140 (patch)
Author
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-12-19 15:42:30 +0200
Committer
 Dimitar Trendafilov <dimitar@coherent-labs.com>
2020-12-19 15:42:30 +0200
Filesa5d1a6a8917c541d79b1cff4c236635268b47d85
IPL-da59f8dd2a739719776bddb1ff6173a6528c5140.tar
IPL-da59f8dd2a739719776bddb1ff6173a6528c5140.tar.gz
IPL-da59f8dd2a739719776bddb1ff6173a6528c5140.zip
Parent07e489dc05a71fc5d96478c02a64ff93f7279551 (diff)
Fix code formatting
1 files changed, 17 insertions, 17 deletions
-rw-r--r--website/content/slides/11_jit/_index.md34
diff --git a/website/content/slides/11_jit/_index.md b/website/content/slides/11_jit/_index.md
index 7ac166d..18070e1 100644
--- a/website/content/slides/11_jit/_index.md
+++ b/website/content/slides/11_jit/_index.md
@@ -63,13 +63,13 @@ All is actually 2 instructions on a x86_64 CPU
---
### Create executable memory Linux
-virtualCodeAddress = mmap(
- NULL,
- codeBytes,
- PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_ANONYMOUS | MAP_PRIVATE,
- 0,
- 0);
+ virtualCodeAddress = mmap(
+ NULL,
+ codeBytes,
+ PROT_READ | PROT_WRITE | PROT_EXEC,
+ MAP_ANONYMOUS | MAP_PRIVATE,
+ 0,
+ 0);
---
### Create executable memory Windows
@@ -87,16 +87,16 @@ virtualCodeAddress = mmap(
---
### How to create and execute code
- typedef unsigned (*asmFunc)(void);
- ....
- unsigned char * memory = (unsigned char *) (virtualCodeAddress);
- // mov %rdi, %rax
- memory[i++] = 0x48; // REX.W prefix
- memory[i++] = 0x8b; // MOV opcode, register/register
- memory[i++] = 0xc7; // MOD/RM byte for %rdi -> %rax
- // ret
- memory[i++] = 0xc3; // RET opcode
- ((asmFunc) (virtualCodeAddress))();
+ typedef unsigned (*asmFunc)(void);
+
+ unsigned char * memory = (unsigned char *) (virtualCodeAddress);
+ // mov %rdi, %rax
+ memory[i++] = 0x48; // REX.W prefix
+ memory[i++] = 0x8b; // MOV opcode, register/register
+ memory[i++] = 0xc7; // MOD/RM byte for %rdi -> %rax
+ // ret
+ memory[i++] = 0xc3; // RET opcode
+ ((asmFunc) (virtualCodeAddress))();
---
### Generate code