Skip to content

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

Description

@Mr666dd

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];
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions