Task 3: hello
Return Process PID – Modify
sys_helloto return the calling process's PID instead of returning a fixed 0.Repeating Message – Update the syscall
hello(void)tohello(int n), where the kernel prints the messagentimes.Print Execution Core – Modify the kernel handler to print which CPU core (hart ID) is currently executing the call.
User-Provided Name – Create a syscall
hello_user(char *name)that fetches a string from user space to print "Hello [name]".Global Call Counter – Add a global counter in
kernel/sysproc.cthat tracks and returns the total timeshellowas called.PID Filtering – Modify the kernel handler to print "Hello from Kernel!" only if the caller has PID 1 or 2.
Rate Limiting – Change the syscall to return -1 (failure) if it is called more than 3 times by the same process.
Kernel Arithmetic – Implement a version where
hello(int a, int b)prints the sum of the two integers in the kernel log.Syscall Number Logging – Modify
kernel/syscall.cto log the syscall number specifically wheneverSYS_hellois invoked.Conditional Success Output – Update the user program
hello.cto print "Syscall Successful" only if the return value is exactly 0.
Last updated