Find the answer to your Linux question:
Results 1 to 2 of 2
So I'm following the functions in main.c/start_kernel but when I search for their locations via a website with all the source code, I see a function could be declared in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2012
    Posts
    19

    Hacking the Kernel, how do you know what function is from which file?


    So I'm following the functions in main.c/start_kernel but when I search for their locations via a website with all the source code, I see a function could be declared in 3-10+ places! Is there some logic I can follow to make sure I'm looking at the right function?

    Just a simple example but trap_init() in start_kernel could come from
    Code:
    function definition		/arch/alpha/kernel/traps.c	1070
    function definition		/arch/arc/kernel/traps.c	25
    function definition		/arch/arm/kernel/traps.c	805
    function definition		/arch/arm64/kernel/traps.c	351
    function definition		/arch/avr32/kernel/traps.c	258
    function definition		/arch/blackfin/kernel/traps.c	56
    function definition		/arch/c6x/kernel/traps.c	22
    function definition		/arch/cris/kernel/traps.c	236
    function definition		/arch/frv/kernel/traps.c	656
    function definition		/arch/h8300/kernel/traps.c	40
    function definition		/arch/hexagon/kernel/traps.c	42
    function definition		/arch/ia64/kernel/traps.c	31
    function definition		/arch/m32r/kernel/traps.c	113
    function definition		/arch/m68k/kernel/vectors.c	74
    function definition		/arch/m68k/platform/68000/ints.c	153
    function definition		/arch/m68k/platform/68360/ints.c	61
    function definition		/arch/m68k/platform/coldfire/vectors.c	42
    function definition		/arch/metag/kernel/traps.c	834
    function definition		/arch/microblaze/kernel/traps.c	20
    function definition		/arch/mips/kernel/traps.c	1696
    function definition		/arch/mn10300/kernel/traps.c	580
    function definition		/arch/openrisc/kernel/traps.c	294
    function definition		/arch/parisc/kernel/traps.c	869
    function definition		/arch/powerpc/kernel/traps.c	1727
    function definition		/arch/s390/kernel/traps.c	630
    function definition		/arch/score/kernel/traps.c	308
    function definition		/arch/sh/kernel/traps_32.c	771
    function definition		/arch/sparc/kernel/traps_32.c	431
    function definition		/arch/sparc/kernel/traps_64.c	2668
    function definition		/arch/tile/kernel/traps.c	30
    function definition		/arch/um/kernel/trap.c	314
    function definition		/arch/unicore32/kernel/traps.c	306
    class, struct, or union member	x86_init_irqs	/arch/x86/include/asm/x86_init.h	58
    function definition		/arch/x86/kernel/traps.c	704
    function prototype or declaration		/arch/x86/kernel/traps.c	760
    function definition		/arch/xtensa/kernel/traps.c	344
    function prototype or declaration		/include/linux/sched.h
    I'm worried I'll modify the wrong function and would like to make sure I know exactly what I'm doing (currently in the learning process)

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,737
    Most of those are for other platforms, such as ARM vs x86. Assuming you are working with an x86 system, then it would here:
    Code:
    function definition		/arch/x86/kernel/traps.c	704
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •