CS460 LAB Assignment 5
               DUE: Friday 10-20-2023

1. Download files from samples/LAB5, which will be explained in class 

int umenu()
{
  uprintf("--------------------------------\n");
  uprintf("ps chname switch kfork wait exit\n");
  uprintf("--------------------------------\n");
}

2. ADD these Umode commands and syscalls to kernel

kfork: syscall #5 to kfork(filename) in kernel, as specified below.

wait : syscall #6 to kwait() in kernel, print results
exit : syscall #7 to kexit() in kernel, are the SAME as in your MID2.

==========================================================================
3. kfork(filename) in fork.c:
	       
   assumes each process P1 to P8 has a 1MB Umode space at
	    8MB + (pid-1)*1MB
   e.g. P1 at 8MB, P2 at 9MB, ..., P8 at 15MB.

3-1. NOW: assume each process has 4MB Umode space at
	       
       1.   8MB + (pid-1)*1MB;
       2.  16MB + (pid-1)*1MB;
       3.  24MB + (pid-1)*1MB;
       4.  32MB + (pid-1)*1MB;
	       
Modify kfork(filename) to suit the new Umode image.
As usual, the Umode sp MUST be at the HIGH end of Umode image.  
	       
3-2. When a proc enters main(char *s) in Umode, s -> a string of your name,
     e.g. "My name is Joe Biden"

print the string and its virtual address in Umode main()
==========================================================================
	       
4. Add memory protection check in USER mode:

Program C6.1 in Chapter 6 contains code for data abort exception in Kmode.
Modify it to perform memory protection checking in Umode:

	       In u1.c, u2.c, add:
	       
  printf("test memory at 0x1000\n");
  u32 *up = 0x1000;
  *up = 123;

  printf("test memory 0x80001000 VA=4KB\n");
  up = 0x80001000;
  *up = 1234;

  printf("test memory 0x80100000 VA=1MB\n");
  up = 0x80001000;
  *up = 1234;

  printf("test memory 0x80500000 VA=5MB\n");
  up = 0x80500000;
  *up = 1234;

EXPLAIN the results: Which address is invalid, WHY?