Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Linux - Kernel This forum is for all discussion relating to the Linux kernel.


Search this Thread
Old 01-28-2008, 01:47 PM   #1
LQ Newbie
Registered: Jan 2008
Posts: 2

Rep: Reputation: 0
Little Help Debugging some MINOR kernel assembly

What I'm trying to do here is add an overhead to every single system call. I can do this either by modifying ~320 C methods or I can do it in one place in i386 assembly land. As you might have guessed I'd much rather make this change in one place, the problem is I such at assembly and I'm having a hard time finding a resource that can help, so here I am asking for some help.

I'm working with the 2.6.22 kernel, and I'm trying to modify the arch/i386/kernel/entry.S file (I think that's the path). Right around like 370 or so is the main entry point after the processor interrupt has occurred. Here's what I have now:

       # system call handler stub
        movl %cx, 100000;
        add %eax, %eax;
        loop mylblb

        RING0_INT_FRAME                 # can't unwind into user space anyway
        pushl %eax                      # save orig_eax

                                # system call tracing in operation / emulation
        /* Note, _TIF_SECCOMP is bit number 8, and so it needs testw and not testb */
        jnz syscall_trace_entry
        cmpl $(nr_syscalls), %eax
        jae syscall_badsys

As you can see I'm just adding a loop that does something minimal like add some values together. It fails miserably. I'm sure it's because I'm overwriting something important and not putting it back, but I don't know how to do that.

Any help would be GREATLY appreciated as I'm dead in the water here.

Disclaimer: Yes, this is part of a project for my CS master's degree, I'm not trying to get anyone to help me cheat on my homework, just need some help. The real part of this assignment is doing the analysis on the effects of this overhead. Just want to get that out there.
Old 01-29-2008, 01:24 PM   #2
LQ Newbie
Registered: Jan 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Thumbs up

I changed my code a little bit but it's still overwriting something important.

       movl %cx, 100000;
        add %eax, %eax;
        loop mylblb

I just want this stupid loop to eat up some processor cycles and not affect anything else. Any pointers on what I might be missing?
Old 03-28-2008, 10:32 AM   #3
Registered: Nov 2006
Location: East Coast, USA (in "the great northeast")
Distribution: Custom / from source; Fedora, Debian, CentOS, Scientific; LFS.
Posts: 94

Rep: Reputation: 15
Originally Posted by Norweed View Post
Any pointers on what I might be missing?
I just stumbled across your post while looking for something else; you've probably figured this out already and moved on, but just in case...

Do you think it's possible that you've discovered some sort of race condition elsewhere in the kernel code?


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
Kernel debugging wood@addanc Linux - General 1 04-01-2006 09:01 AM
Difference between kernel - debugging and application debugging topworld Linux - Software 2 03-30-2006 12:50 AM
Visual Debugging and Linux Kernel Debugging Igor007 Programming 0 09-30-2005 10:33 AM
Assembly debugging using DDD bluknight43 Programming 1 02-28-2005 01:02 PM
Minor kernel upgrade kaon Linux - Software 1 08-18-2004 08:34 AM

All times are GMT -5. The time now is 12:57 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 @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration