Hi all,
I am writing a module driver and have run into a problem and just wanted to check I’m not doing anything stupid!
I am not currently using the latest SVN version I am using an export from the 25/2/09 – I am in the process of updating to the latest version.
I have made an example which on my system causes an illegal instruction Oops:
---------------------------------------
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/module.h>
MODULE_AUTHOR("Ian Whitmore");
MODULE_DESCRIPTION("Discovery communications example");
MODULE_LICENSE("Dual BSD/GPL");
static void test1(void);
static void test2(void);
static int __init startGoing(void)
{
printk("I'm in startGoing\n");
test1();
test1();
return 0;
}
static void __exit stopGoing(void)
{
printk("I'm in stopGoing\n");
test1();
test1();
return;
}
static void test1(void)
{
printk("I'm in test1\n");
test2();
test2(); //If this call is commented out the module does not crash!
return;
}
static void test2(void)
{
printk("I'm in test2\n");
return;
}
module_init(startGoing);
module_exit(stopGoing);
This is the error message I get:
# insmod discovery-module.ko
I'm in startGoing
Oops: Exception in kernel mode, sig: 4
Registers dump: mode=8816FEC0
r1=88038130, r2=8809408C, r3=00000015, r4=FFFFFFFF
r5=881605A4, r6=00000001, r7=FFFFFFFF, r8=00000000
r9=23410000, r10=00000049, r11=00000000, r12=84000000
r13=8F023B10, r14=88096654, r15=8F5881B0, r16=881788F8
r17=881787DC, r18=00000000, r19=8802651C, r20=881788E0
r21=00000001, r22=881788F8, r23=00000001, r24=00000004
r25=00000001, r26=88004598, r27=8818172C, r28=8813F808
r29=88178904, r30=00000000, r31=00000000, rPC=88175968
msr=00000000, ear=00000000, esr=880020B4, fsr=00000A33
Illegal instruction
---------------------------------------
If I comment out the 2nd call to test2() the module does not crash:
---------------------------------------
# insmod discovery-module.ko
I'm in startGoing
I'm in test1
I'm in test2
I'm in test1
I'm in test2
#
Has anyone got any ideas?
Ian.
PS. sorry about the footer to this email – It’s a work address and I can’t get rid of it!!!
The information contained in this E-Mail and any subsequent
correspondence is private and is intended solely for the intended
recipient(s). The information in this communication may be
confidential and/or legally privileged. Nothing in this e-mail is
intended to conclude a contract on behalf of QinetiQ or make QinetiQ
subject to any other legally binding commitments, unless the e-mail
contains an express statement to the contrary or incorporates a formal Purchase Order.For those other than the recipient any disclosure, copying,
distribution, or any action taken or omitted to be taken in reliance
on such information is prohibited and may be unlawful.Emails and other electronic communication with QinetiQ may be
monitored and recorded for business purposes including security, audit
and archival purposes. Any response to this email indicates consent
to this.Telephone calls to QinetiQ may be monitored or recorded for quality
control, security and other business purposes.QinetiQ Limited
Registered in England & Wales: Company Number:3796233
Registered office: 85 Buckingham Gate, London SW1E 6PD, United Kingdom
Trading address: Cody Technology Park, Cody Building, Ively Road, Farnborough, Hampshire, GU14 0LX, United Kingdom
http://www.qinetiq.com/home/notices/legal.html