VOOZH about

URL: https://qiita.com/ohisama@github/items/6dd8451fa8689806dbc4

⇱ paizaでインラインアセンブラ その2 #paiza.IO - Qiita


👁 Image
0

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

More than 5 years have passed since last update.

@ohisama@github

paizaでインラインアセンブラ その2

0
Last updated at Posted at 2018-09-21

概要

x64で、インラインアセンブラやってみた。
helloworldやってみた。

サンプルコード

# include <stdio.h>
# include <unistd.h>

int main()
{
 const char str[] = "Hello World!\n";
 const size_t n = sizeof(str);
 unsigned int ret;
 __asm__ volatile ("mov $1, %%rax; mov $1, %%rdi; mov %1, %%rsi; mov %2, %%rdx; syscall;" : "=a" (ret) : "S" (str), "d" (n));
 return 0;
}

成果物

以上。

0

Go to list of users who liked

0
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0

Go to list of users who liked

0