<commit_before>#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "common.h"
#include "interrupt.h"

idt_entry idt_cache[IDT_ENTRY_MAX];

/* Previous system registers */
FLAGS PFLAGR;
Memory PPCR;
unsigned int PPSR;
Memory PPDTR;
unsigned int PTIDR;

int interrupt_nmi = -1;

void interrupt_entry(unsigned int num)
{
  /* interrupt vector is valid? */
  if(!IDT_ISVALID(num)) {
    DEBUGINT("[INTERRUPT] IRQ %x: invalid vector.\n", num);

    if(num == IDT_DOUBLEFAULT_NUM) {
      errx(EXIT_FAILURE, "Invalid double fault vector.");
    }
    else if(num == IDT_INVALID_IDT_NUM) {
      interrupt_entry(IDT_DOUBLEFAULT_NUM);
    }
    else {
      interrupt_entry(IDT_INVALID_IDT_NUM);<commit_msg>exit when trap double fault if vector is invalid<commit_after>#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "common.h"
#include "interrupt.h"

idt_entry idt_cache[IDT_ENTRY_MAX];

/* Previous system registers */
FLAGS PFLAGR;
Memory PPCR;
unsigned int PPSR;
Memory PPDTR;
unsigned int PTIDR;

int interrupt_nmi = -1;

void interrupt_entry(unsigned int num)
{
  /* interrupt vector is valid? */
  if(!IDT_ISVALID(num)) {
    DEBUGINT("[INTERRUPT] IRQ %x: invalid vector.\n", num);

    if(num == IDT_DOUBLEFAULT_NUM) {
      printf("[INTERRUPT] Invalid double fault vector.\n");
      exec_finish = true;
    }
    else if(num == IDT_INVALID_IDT_NUM) {
      interrupt_entry(IDT_DOUBLEFAULT_NUM);
    }
    else {
      interrupt_entry(IDT_INVALID_IDT_NUM);
{'fraction_non_alphanumeric': 0.12307692307692308, 'fraction_numerical': 0.0013377926421404682, 'mean_word_length': 4.140893470790378, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6381564', 'n_tokens_mistral': 548, 'n_tokens_neox': 540, 'n_words': 125}