https://github.com/kntt32/asmacro
assembler with preprocessor
https://github.com/kntt32/asmacro
assembly compiler preprocessor x64
Last synced: 4 months ago
JSON representation
assembler with preprocessor
- Host: GitHub
- URL: https://github.com/kntt32/asmacro
- Owner: kntt32
- Created: 2024-10-18T12:31:30.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-05-08T11:59:24.000Z (about 1 year ago)
- Last Synced: 2025-05-08T12:41:58.598Z (about 1 year ago)
- Topics: assembly, compiler, preprocessor, x64
- Language: Rust
- Homepage:
- Size: 6.51 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# asmacro
# 移行済みhttps://github.com/kntt32/as-macro
## とりあえずの目標
↓このようなコードを、
```
fn main() : (edx, esi, eax, fibo, aaa, stdout) -> () {
let mut a: u32@edx = 1;
let mut b: u32@esi = 1;
loop 100 {
let c: u32@eax = fibo(a@edi, b);
a = b;
b = c;
stdout(aaa(c@edi));
}
}
fn fibo(a: u32@rdi, b: u32@esi) : () -> u32@eax {
a@rax + b
}
```
↓このようなアセンブリに変換し、
```
main:
mov rdi 1
mov rsi 1
mov rcx 100
main_loop_begin:
call fibo
mov edx eax
mov esi eax
mov edi eax
call aaa
call stdout
loop main_loop_begin
ret
fibo:
mov edi eax
add eax esi
ret
```
さらにELF形式に自力で変換することだ
## 参考文献
- AMD64仕様書
https://www.amd.com/content/dam/amd/en/documents/processor-tech-docs/programmer-references/24594.pdf
- Oracleのマニュアル
https://docs.oracle.com/cd/E19683-01/817-4912/6mkdg541g/index.html
- 最小限のELF
https://keens.github.io/blog/2020/04/12/saishougennoelf/