Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-02-2004, 02:28 PM   #1
LQ Newbie
Registered: Aug 2004
Posts: 1

Rep: Reputation: 0
Segmentation fault with asm("int 0x0f")


I am trying to write a kernel module that services IRQ 7. I look in one of my trusty HW books and this corresponds to interrupt 0x0f. However, when I call it using:

asm("int 0x0f");

from my test application, I get a "Segmentation fault". But when I substitute 0x80 for the interrupt, I don't get a Segmentation fault. I can load and unload the module fine and it appears in the /proc/interrupts table.

I am running Red Hat 9 upgraded to kernel 2.6.7.

module code
static irqreturn_t irq_handler(int irq, void *dev_id, struct pt_regs *regs)

static int mydriver_init(void)
return request_irq(7, irq_handler, SA_INTERRUPT, "mydriver", NULL);

static void mydriver_exit(void)
free_irq(7, NULL);


app code
int main(void)
asm("int $0x0f");
return 0;


Last edited by justthething; 08-02-2004 at 02:32 PM.
Old 08-02-2004, 02:43 PM   #2
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
hardware interrupts and software interrupts are two different things. when u use the int instruction, taht is a software interrupt. int 0x80 for example is the entry point for system calls. it runs the exception handler, not interrupt handler, at slot 0x80. i dont think u can send yourself hardware interrupts.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
why iam getting problems like "...too many files opened" or "segmentation fault" naren_0101bits Linux - Newbie 2 07-19-2004 01:20 PM
"segmentation fault" when run a simple c program acer_peri Programming 11 05-28-2004 05:14 AM
menudrake on 9.2 quits with "segmentation fault" error JustSlack Mandriva 11 11-20-2003 12:46 PM
"Segmentation Fault" error message when trying to run Yahoo Messenger on Linux 8.0 niranjanpage Linux - Software 6 10-27-2003 02:21 AM
f-prot anti-virus "Segmentation fault" error and other weird stuff dalek Linux - Software 9 10-22-2003 08:37 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:40 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration