0
votes

Im following James Molloy`s guide to create small OS and now i stuck on interrupt. I dont really understand how to call my interrupt handlers instead of this command:

    asm volatile("int $0x21");

Main file

    #include "monitor.h"
    #include "multiboot.h"
    #include "descriptor_tables.h"
    #include "timer.h"
    #include "paging.h"
    #include "simple.h"

    int main(struct multiboot *mboot_ptr){
     // Initialise all the ISRs and segmentation
        init_descriptor_tables();
     // Initialise the screen (by clearing it)
        monitor_clear();
        monitor_write("Hello, paging world!\n");          
        init_simple();
        asm volatile("int $0x21");
        return 0;
    }

Where 0x21 is an interrupt`s number in vector.Is there a method to make a interrupt using a c command?

For example i want use this commands:

    char c; // for interrupt created and handler allocate memory for char/int etc.
    char c = 'a'; // allocate + assing 
    c; // get value
    c = 'b'; // assing new value

Is there any possible way to do it?

1
There is no notion of interrupts in standard C.Eugene Sh.
Oh , ok Is there a way to do it in asm?Ivnsky
"allocate + assing" ? Is that the end of allocation? Perhaps "allocate + assign"?chux - Reinstate Monica

1 Answers

0
votes

Interrupts are generated by the CPU itself.

While C is commonly used to write the interrupt handlers in the kernel, there is no unique facility (or machine model) dictating their creation using it.