Module usage after loading problem

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Module usage after loading problem

Post by piranha »

I have a module loader function, and a test module (hard drive function).
It sets a syscall to a function inside the module and exits. I call the syscall from the main kernel function after the module is loaded, and it calls the correct address (I think) but then it pagefaults, even when the syscall handler has nothing but a for(;;); function.

I looked at the page fault EIP and:
It calls: 0xC0185089
The EIP of the pagefault is: 0xC087FFC9.

The part of actually calling the syscall has the correct address.
The modules is set in mapped memory (with kmalloc()), and is initialized.
The message says "Calling..." and then nothing happens for a second, and then it pagefaults.
And, the the module is loaded to a specific address and the syscall register takes that offset into accout.
I have been trying things for a month, and it don't seem to work.

Can you help?
-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
User avatar
JamesM
Member
Member
Posts: 2935
Joined: Tue Jul 10, 2007 5:27 am
Location: York, United Kingdom
Contact:

Post by JamesM »

Have you memory dumped the starting EIP to check that there's actually valid instructions there, and not junk?
User avatar
thepowersgang
Member
Member
Posts: 734
Joined: Tue Dec 25, 2007 6:03 am
Libera.chat IRC: thePowersGang
Location: Perth, Western Australia
Contact:

Post by thepowersgang »

The problem may be that there is a loop that is overrunning a buffer, hence the delay before the PF. Not meaning to sound patronizing, but have you tried placing a print call at the beginning of the module code?
User avatar
piranha
Member
Member
Posts: 1391
Joined: Thu Dec 21, 2006 7:42 pm
Location: Unknown. Momentum is pretty certain, however.
Contact:

Post by piranha »

During the loading call?
I know that works, I've tested it several times.

It's when I do something with the module after I load it that it dies.

-JL
SeaOS: Adding VT-x, networking, and ARM support
dbittman on IRC, @danielbittman on twitter
https://dbittman.github.io
Post Reply