4

could somebody show me how to generate software interrupt under Linux and then handle it with request_irq?

or maybe this is not possible.

a3f
  • 8,517
  • 1
  • 41
  • 46
Jack
  • 255
  • 1
  • 3
  • 14
  • 2
    Why do you ask? On the application side, why can't you use signals? – Basile Starynkevitch Sep 24 '14 at 20:27
  • signals are t h e software interrupts in linux userspace. – askmish Sep 24 '14 at 20:44
  • Eventually I want to pass interrupts from host system to guest system in qemu. This is for testing and educational purpose. – Jack Sep 25 '14 at 06:39
  • What architecture? On x86 you generate a software interrupt with the `int` instruction. `int 0x80` is how you make old-style system calls, for example. – Jonathon Reinhart Oct 01 '14 at 07:57
  • In generalized manner interrupt handlers are part of the kernel. Jumping to your own code is just a function call. What problem are you actually trying to solve? – SD. Nov 06 '14 at 17:08
  • @codegeek It is for my virtualization system with qemu. I want to be able to send interupts from host to guest. I need software interupts to test it and I'm curious how to do this. – Jack Nov 07 '14 at 08:13
  • OK. ARM interrupt vector table can be modified for software interrupts,may you can find this helpful. [here](http://geekwentfreak-raviteja.rhcloud.com/blog/2011/01/16/writing-interrupt-routines-using-gcc-for-arm/) and [here](http://balau82.wordpress.com/2012/04/15/arm926-interrupts-in-qemu/) – SD. Nov 07 '14 at 14:03

1 Answers1

2

You can use softirq instead. You can define your sofirq via editing include/linux/interrupt.h. and then use function rasie_softirq() instead of reuqest_irq(),which notify the kernel there is softirq needs to be processed. then kernel will execute it at a appropriate in software interrupt context.

Example API

1. open_softwareirq();
2. raise_softirq();
kikigood
  • 241
  • 1
  • 4