2
私はmmap linuxシステムコールを使ってメモリを割り当てる次のコードを持っています。これらの命令を実行した後、割り当てられたメモリへのポインタはeaxに格納されます。このポインタを人間が読める形式、例えば "00ffbfff"で印刷するにはどうすればいいですか?x86のstdoutへのポインタを出力しますか?
writeシステムコールを使用してstdoutに印刷する方法を理解していますが、eaxに格納された値を16進表現に変換する方法が不思議でした。
section .text
global _start
_start:
; mmap struct
push 0 ;
push -1 ; set the file dsc to -1 for MAP_ANONYMOUS
push 0x20 ; set MAP_ANONYMOUS
push 0x07 ; set Protections WRX
push 0x04 ; size to allocate
push 0 ; geuss - Not Applicable
;; syscall
push eax, 90 ; mmap opcode
push ebx, esp ; mmap struct
int 0x80 ; execute the system call
; allocated address in in eax