Explain the following ASM code in detail giving the reasons

Explain the following ASM code in detail, giving the reasons for the status of flags (CZNV) after every instruction is executed. Initialize: R_1 = 0 times FFFFFFF0 (assume them as unsigned values) ADD r0, rl, r2; ADDS r0, rl, r2; ADDSCS r0, rl, r2; CMP r0, rl; ADD rl, #0 times 1 ADD r0, rl, r2; ADDS r0, rl, r2; ADDSCS r0, rl, r2; CMP r0, rl

Solution

#include <iostream>
#include <string>
#include<sstream>
#include<unistd.h>
#include<sys/wait.h>
#include<stdlib.h>
#include<sys/types.h>
#define MAX_LINE 80
using namespace std;

int main()
{
   int should_run = 1;
   string s,s1,a;
   string arg[10];
   char *arr[10];

   while (should_run)
   {
       cout<< (\"ubos>\") ;  
       cin>> s1;
      
       {  
       istringstream f(s1);
       while (getline(f,s, \' \'))
      
       for(int i=0; i<10; i++)
           {
          
           arg[i] = s;
arr[i] = (char*)arg[i].c_str(); //converting string to char          
           arr[1] = NULL;
                      
           }
          
   pid_t pid =fork();
   int i;

   if(pid<0)
   {
       cout<<\"fork\"<<endl;
   }
   else if (pid == 0 )
   {
      
       cout<<\"child: \" << pid << endl;
       for(int i=0; i<10; i++)
           {
               execvp(arr[i],arr);
           }
      
   }
   else if(pid > 0 )
   {
       wait(NULL);
       cout<<\"parent \" << pid<<endl;
   }
       }  
   }  
  
   return 0;
}

 Explain the following ASM code in detail, giving the reasons for the status of flags (CZNV) after every instruction is executed. Initialize: R_1 = 0 times FFFF
 Explain the following ASM code in detail, giving the reasons for the status of flags (CZNV) after every instruction is executed. Initialize: R_1 = 0 times FFFF

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site