CS433 Linux Kernel Programming Homework

Homework 1 on
Linux assembly inlining and
setting up Linux Cross Referencer LXR on your laptop

Submission: Prepare a tgz (tar gzip) file containing the source code file(s) and screen shots that show that your program executed properly. Upload the file to the class homework submission site found on the homework page.

  1. Write a bash script which sets up Linux Cross Referencerer LXR on your laptop. Use Fedora 30 or higher or Ubuntu. When submitting your script, include "readme" file to specify the distro and version used. Check http://sourceforge.net/projects/lxr

    Bring your machine to class to demonstrate. Will announce when to demonstrate. Without lxr, you won't be able to learn the kernel.

  2. Write a C program that extracts a substring with starting index s_idx and ending index e_idx, using assembly inlining.
    #include ...
    
    static inline char * sub_str(char * dest, char *src, int s_idx, int edix){
      ...
      ...
      return dest;
    }
    
    static inline char * asm_sub_str(char * dest, char *src, int s_idx, int edix){
      ...
      ...
      return dest;
    }
    
    int main(int argc,char **argv) {
      get a string and starting and ending indices from the command line,
      call a C function, d1=sub_str(d,s,s_idx,e_idx),
      call a C function, d2=asm_sub_str(d,s,s_idx,e_idx) using inlining,
      compare the two strings d1 and d2 and return the result.
    }
    
    
    See http://ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html for the strcpy discussed in class.