LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 12-03-2015, 12:44 PM   #1
goblinhack
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Rep: Reputation: Disabled
how to debug (printk/printf/uart?) inside vdso (arch/x86/vdso/vclock_gettime.c)


I have an issue where clock_gettime is stuck in a loop. I've seen
a few threads on workarounds, but I'm more interested in simply how
to debug inside vdso (arch/x86/vdso/vclock_gettime.c)

I cannot use printk as this is not a true part of the kernel.
I don't think I can use printf - at least I've not been able to find
a way how. And even directly printing to the serial uart e.g.:

static cycle_t vread_pvclock(int *mode)
...
outb('x', 0x3f8);

gives me a kernel crash with nothing specific to this function in
the traceback. In fact doing almost any change in here seems to lead
to a crash.

Are there any ways to debug in here ? I'm really just wanting to
print some output to the serial port when I find clock_gettime in
a loop - and I can't easily use gdb in this embedded platform

any advice welcome

tx

neil
 
Old 12-10-2015, 07:16 AM   #2
goblinhack
LQ Newbie
 
Registered: Dec 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
trying syslog syscall from vdso now...

Just an update, I've decided to try and invoke the syslog system call
inside vdso. It seems this *should* work


Code:
   notrace int __vdso_gettimeofday(struct timeval *tv, struct timezone *tz)
    {
    + my_syslog(0, "NEIL getttime", 10);
but I think I was crafting it wrong and instead of

Code:
   static ssize_t my_syslog(int fd, const void *buf, int size)
    {
        ssize_t ret;
        asm volatile
        (
            "syscall"
            // outputs
            : "=a" (ret)

            // inputs
            : "0"(103), "D"(fd), "S"(buf), "d"(size)

            : "cc", "rcx", "memory"
        );
        return ret;
    }
should be maybe:

Code:
    static notrace long my_syslog(long fd, const void *buf, long size)
    {
        long ret;

        asm(
                "call VDSO32_vsyscall \n"
                : "=a" (ret)
                : "0" (103), "g" (fd), "c" (buf), "d" (size)
                : "memory", "edx");
        return ret;
    }
will update if I get any joy out of this. There has to be some way to get
some debug out of vdso... 8)

tx

neil
 
  


Reply



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
[SOLVED] gdb run error: linux-vdso.so.1 lupe Slackware 1 10-13-2012 05:52 PM
LXer: Creating a vDSO: the Colonel's Other Chicken LXer Syndicated Linux News 0 02-06-2012 11:40 PM
linux-vdso vs linux-gate yurii Linux - General 1 11-17-2008 03:05 PM
LXer: Saxnet introduces mesh networking router based on x86 arch., Linux Bios inside LXer Syndicated Linux News 0 10-29-2007 02:50 PM
How can i make centos 4.5's system call using vDSO(call *%gs:0x10) instead of int80 tclwp Red Hat 3 08-06-2007 12:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:50 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration