Advertisement
Guest User

Untitled

a guest
Feb 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define __NR_exit 1
  2. #define __NR_fork 2
  3. #define __NR_read 3
  4. #define __NR_write 4
  5.  
  6. #include <stdio.h>
  7.  
  8. int _start() {
  9.     volatile char x;
  10.     asm volatile (
  11.         "movl $3, %%eax\n"
  12.         "movl $0, %%ebx\n"
  13.         "movl %1, %%ecx\n"
  14.         "movl %2, %%edx\n"
  15.         "int  $0x80\n"
  16.         :"=g" (x)
  17.         :"g" (&x), "g" (sizeof(x))
  18.         :"eax", "ebx", "ecx", "edx");
  19.     while (x != EOF) {
  20.         if (x - 'a' < 'z') {
  21.             x = x - 'a' + 'A';
  22.         }
  23.         asm volatile (
  24.             "movl 4, %%eax\n"      
  25.             "movl $1, %%ebx\n"    
  26.             "movl %1, %%ecx\n"
  27.             "movl %2, %%edx\n"
  28.             "int  $0x80\n"
  29.             :
  30.             :"g" (&x), "g" (sizeof(x))
  31.             :"eax", "ebx", "ecx", "edx");
  32.         asm volatile (
  33.             "movl $3, %%eax\n"
  34.             "movl $0, %%ebx\n"
  35.             "movl %1, %%ecx\n"
  36.             "movl %2, %%edx\n"
  37.             "int  $0x80\n"
  38.             :
  39.             :"g" (&x), "g" (sizeof(x))
  40.             :eax", "ebx", "ecx", "edx");
  41.    }  
  42.    asm volatile (
  43.        "movl $1, %%eax\n"
  44.        "xorl %%ebx, %%ebx\n"
  45.        "int  $0x80\n"
  46.        :
  47.        :
  48.        :"eax", "ebx");
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement