Hi, Dave, Thank you for the kind explanation and I think it will help much for me.
I searched down the uClib as you told me and could locate the kernel sys_write function. In my case, the arch is sparc, and it is defined in fs/read_write.c as you said(in linux kernel source). I've checked that SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, size_t, count) is expanded to => asmlinkage long sys_write(unsigned int fd, const char __user * buf, size_t count) and I was able to use prom_printf (write to uart) to print what I tried to print in busybox with printf. Now I can see busybox printf at least through the uart port though it's not yet shown on the LCD(which I'm trying to map to tty1 and the shell). Thank you! Chan ________________________________ From : "Dave Hylands" <[email protected]> Sent : 2014-03-13 02:54:40 ( +09:00 ) To : Kim Chan <[email protected]> Cc : Mohan L <[email protected]>, [email protected] <[email protected]> Subject : Re: where is the printf source for busybox? Hi, On Tue, Mar 11, 2014 at 11:55 PM, Kim Chan <[email protected]<mailto:[email protected]>> wrote: Wow, that was it. I'm happy to hear that because I thought it should end up with a system call anyway. Then isn't there some codes making the system call? Or is it that the compiler understands that 'write' is a system call and inserts the assembly code for calling it by itself? In uclibc, the write source code is found here: http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux/common/write.c How the syscall is actually implemented is architecture specific, and will be in one of the directories here: http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux For example, for ARM, with EABI, then I believe that it winds up here: http://git.uclibc.org/uClibc/tree/libc/sysdeps/linux/arm/syscall-eabi.S The SWI instruction transfers control to the kernel. On the kernel side, how the syscalls get handled is also architecture specific, but it will generally wind up at a function called sys_FUNCTION, however the generation of the function name is usually hidden behind a macro. So sys_write in the kernel winds up being declared here: http://lxr.linux.no/#linux+v3.13.5/fs/read_write.c#L514 -- Dave Hylands Shuswap, BC, Canada http://www.davehylands.com<http://www.davehylands.com/>
_______________________________________________ Kernelnewbies mailing list [email protected] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
