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

Lesson 23: Error correction: Invalid opcode(6 interrupt) #281

Open
Mr666dd opened this issue Oct 28, 2024 · 0 comments
Open

Lesson 23: Error correction: Invalid opcode(6 interrupt) #281

Mr666dd opened this issue Oct 28, 2024 · 0 comments

Comments

@Mr666dd
Copy link

Mr666dd commented Oct 28, 2024


Description

Good afternoon! While working through Lesson 23, I encountered an issue when running the code. After compiling and starting the machine, I invoked PAGE(kmalloc() in kernel) and observed that the console began endlessly displaying error messages:
received interrupt: 6
Invalid Opcode

Steps to Reproduce

  1. Compile the code from Lesson 23.
  2. Start the machine.
  3. Call PAGE.

Issue

The console floods with the above error messages without stopping.

Debugging Attempts

I tried debugging with gdb, but it didn’t help. Upon reviewing and modifying the code manually, I found the cause of the issue: the variables char page_str[16] and char phys_str[16] were initialized with empty strings, which triggered this problem.

Solution

After removing the empty string initialization, the issue was resolved. I suggest modifying the following lines in the code:

// kernel/kernel.c

void user_input(char *input) {
// Change this:
char page_str[16] = "";
char phys_str[16] = "";
// To this:
char page_str[16];
char phys_str[16];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant