Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session 9 Report #9

Open
16 tasks
ParsaEnayatiCE opened this issue Dec 27, 2024 · 0 comments
Open
16 tasks

Session 9 Report #9

ParsaEnayatiCE opened this issue Dec 27, 2024 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@ParsaEnayatiCE
Copy link

Team Name: 99101592-99105623

Student Name of member 1: Mahnoosh Ramtin
Student No. of member 1: 99101592

Student Name of member 2: Parsa Enayati
Student No. of member 2: 99105623

  • Read Session Contents.

Section 9.3

  • Printing all linux interrupts
    • To display the interrupts in the Linux operating system, you can use various tools and system files such as /proc/interrupts. The goal of this code is to show all the system interrupts and their call counts. This code uses the /proc/interrupts file to read the interrupts and their counts. Functions like fopen, fgets, and fclose are used to read the contents of the file and display it on the terminal. This file provides information about hardware interrupts, the number of calls, and other details. The output shows the number of interrupt calls for each CPU.
    • ![image](https://github.com/user-attachments/assets/67fdb8d1-8bf9-4504-8185-d62ff491b822)
    • ![image](https://github.com/user-attachments/assets/3d93042f-fc67-4602-9dca-1f35805a3aef)
    • ![image](https://github.com/user-attachments/assets/865b3310-9982-42db-9b3e-b6897800ebb7)
    • To run this program, the following environment is required: First Linux Operating System: Since the /proc/interrupts file is available only in Linux systems. Then C Compiler: A C compiler such as GCC is required to compile the code. Third Access to System Files: We need read access to the /proc/interrupts file. This is usually available by default, but we need to ensure the program can read this file. Fourth Terminal Environment: We need a terminal to run the program and view the output.

Section 9.4

  • Adding a new interrupt
    • In this experiment, I worked on implementing a kernel module in Linux that interacts with hardware interrupts. Specifically, I did the following: Implemented an Interrupt Handler: I created a kernel module that registers an interrupt handler for a specific IRQ number (IRQ 1) using the request_irq() function. The handler prints a message whenever the interrupt is triggered. Loaded the Kernel Module: I loaded the module using insmod, which invoked the initialization function where the interrupt handler was registered. Monitored Interrupt Execution: I verified the interrupt handler by checking the kernel log output using the dmesg command. I observed multiple instances where the interrupt handler executed successfully, logging each time an interrupt was triggered. Unloaded the Module: After testing, I unloaded the module using rmmod, which freed the IRQ resource and cleaned up the module.
    • ![image](https://github.com/user-attachments/assets/6c706530-e057-4d00-8ccc-0dacd7eca641)
    • ![image](https://github.com/user-attachments/assets/eccbcad6-9d51-4de6-870d-0747870795b6)
    • ![image](https://github.com/user-attachments/assets/d17e1910-66d6-40a1-9ac0-43158101ca27)
    • ![image](https://github.com/user-attachments/assets/344a246e-85c0-4173-831a-f483054a0c77)
    • ![image](https://github.com/user-attachments/assets/73d42889-e007-4d28-9b44-4b6dc858a596)
    • ![image](https://github.com/user-attachments/assets/940a0ad1-0e76-449c-8f24-f95e74d5e88e)
    • The requirements for performing this experiment include: Linux Operating System: A working Linux system where you have access to load and unload kernel modules. Kernel Development Environment: Necessary tools for kernel development, such as make, kernel headers, and a proper development environment set up. Root (Administrator) Privileges: Since handling interrupts and loading kernel modules require administrative permissions, sudo or root access is necessary. Hardware with Configured Interrupts: A hardware component or device capable of triggering interrupts, such as a keyboard or a serial port, connected to the system.| Access to Kernel Logs: Tools like dmesg to monitor kernel log output and ensure the interrupt handler is functioning correctly.
@ParsaEnayatiCE ParsaEnayatiCE added the documentation Improvements or additions to documentation label Dec 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant