LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

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

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


Hi,

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)
{
return IRQ_HANDLED;
}

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

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

module_init(mydriver_init);
module_exit(mydriver_exit);


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


Thanks

Last edited by justthething; 08-02-2004 at 01:32 PM.
 
Old 08-02-2004, 01:43 PM   #2
infamous41md
Member
 
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.
 
  


Reply


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 12:20 PM
"segmentation fault" when run a simple c program acer_peri Programming 11 05-28-2004 04:14 AM
menudrake on 9.2 quits with "segmentation fault" error JustSlack Mandriva 11 11-20-2003 11:46 AM
"Segmentation Fault" error message when trying to run Yahoo Messenger on Linux 8.0 niranjanpage Linux - Software 6 10-27-2003 01:21 AM
f-prot anti-virus "Segmentation fault" error and other weird stuff dalek Linux - Software 9 10-22-2003 07:37 PM


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

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