Advertisement
Guest User

Untitled

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