Click here to Skip to main content
15,065,644 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
C++
<pre lang="c++">


What I have tried:

i dont know any thing about interrupt also so please explain
Posted
Updated 24-Mar-16 11:02am
Comments
Patrice T 24-Mar-16 12:29pm
   
Google !
read rocumentation
explain what you want to do
Dave Kreskowiak 24-Mar-16 12:47pm
   
What kind of "interrupt" are you talking about? Hardware interrupts, software interrupts, something exposed by the O/S or BIOS? You're going to have to supply a deeper explanation of what you're trying to do if you want an answer to this.
Sergey Alexandrovich Kryukov 24-Mar-16 17:05pm
   
"Created" with software would assume software interrupts, but who knows? I tried to answer the question...
—SA
Ravinder Singh 26-Mar-16 2:38am
   
software interrupt relating bios.actually i am trying to create a thread library for turbo c(DOS) but i want to avoid system call n strict c without mixing other languages
Ashish Tyagi 40 2-Apr-16 12:24pm
   
Why you wanna avoid system calls only why not DOS?

1 solution

The question really makes no certain sense, because it all depends on the OS and CPU. When you are talking of "library", it probably means that you need to create a software interrupt. Hardware interrupts are only caused by hardware, your "library" can only handle them.

Now, modern OS are highly protected (and even hardware-protected) and don't give you direct access to interrupts. Some old stuff, like DOS, was broadly based on interrupts. With C++, you could create an interrupt using C++ inline assembler (see, for example, Inline Assembler[^]); and it never required any "libraries".

On 8088/8086 CPU family, it would look like
MOV AH, 0Eh
MOV AL, 'A'
INT 10h  ; BIOS interrupt, call to interrupt procedure

On modern systems, the trend is: software interrupts are not used at all, and the hardware interrupts can only be handled in the inner protection ring, in kernel mode, which is only designed for inner OS components and kernel-mode drivers. It's not possible to provide even a short introduction to these topics in a Quick Answer. See also:
Protection ring — Wikipedia, the free encyclopedia[^],
Kernel-Mode Driver Framework — Wikipedia, the free encyclopedia[^].

—SA
   
v5
Comments
Sascha Lefèvre 24-Mar-16 20:25pm
   
My 5
Sergey Alexandrovich Kryukov 24-Mar-16 20:35pm
   
Thank you, Sascha.
—SA
Ravinder Singh 26-Mar-16 7:55am
   
plz provide me link for inline assembler in turbo c(Dos)
Sergey Alexandrovich Kryukov 26-Mar-16 12:57pm
   
Why? I did not even know that turbo C was alive. If you have this product, you do have the documentation for it. Honestly...

And I hope the inline assembly C++ syntax is still the same: http://en.cppreference.com/w/cpp/language/asm.

You need something different: CPU instructions for your CPU, understanding how it works. It's not too complicated, compared to modern-time CPUs, but still a whole big skill set...

—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900