LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 05-05-2013, 11:29 AM   #1
GrahamVH
LQ Newbie
 
Registered: Apr 2009
Location: USA
Distribution: Red Hat Based Distros
Posts: 20

Rep: Reputation: 0
Linux Kernel Questions - learning the sourcecode


Howdy,
I'm attempting to learn the general structure of the Linux kernel for the purpose of debugging and greater understanding. I'm looking to ask C related questions about the linux kernel regarding things I don't understand. First off, Is this a good place to do this?

Second an actual kernel question (using linux-3.8.11):
I have decided to go about this by starting with following the boot process. I figure I can follow this into a general structure for how each piece of the kernel ties together.
I'm currently stumped on this function in arch/x86/boot/pm.c:
Code:
void go_to_protected_mode(void)
{
        /* Hook before leaving real mode, also disables interrupts */
        realmode_switch_hook();

        /* Enable the A20 gate */
        if (enable_a20()) {
                puts("A20 gate not responding, unable to boot...\n");
                die();
        }

        /* Reset coprocessor (IGNNE#) */
        reset_coprocessor();

        /* Mask all interrupts in the PIC */
        mask_all_interrupts();

        /* Actual transition to protected mode... */
        setup_idt();
        setup_gdt();
        protected_mode_jump(boot_params.hdr.code32_start,
                            (u32)&boot_params + (ds() << 4));
}

On the last line I can't seem to find the function protected_mode_jump using my cscope map. Without knowing about that function, I can't reliably determine where to go from this point. I feel I must be missing something obvious, but what?
 
Old 05-06-2013, 02:26 AM   #2
mina86
Member
 
Registered: Aug 2008
Distribution: Slackware
Posts: 414

Rep: Reputation: 173Reputation: 173
That's because it's written in Assembly: http://lxr.linux.no/linux+*/arch/x86/boot/pmjump.S#L24 I recommend either using “git grep” in source code tree or [url=http://lxr.linux.no/linux/]LXR[/url.

In general, I wouldn't recommend trying to figure out kernel by following the boot process. There's a lot of weird stuff happening when kernel starts and to understand all of it, you'd have to dig into a whole lot of subsystems (eg. memory management, block, etc).

Instead you could first try reading through Understanding the Linux Kernel or Linux Device Drivers.
 
Old 05-06-2013, 08:10 PM   #3
GrahamVH
LQ Newbie
 
Registered: Apr 2009
Location: USA
Distribution: Red Hat Based Distros
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks Mina,
I forgot that cscope only looks at c files :P.
 
  


Reply


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
Hi Linux questions. Another old dog learning new tricks is here.... gtrub00 LinuxQuestions.org Member Intro 1 01-07-2011 11:31 AM
add global variable in linux kernel sourcecode sid18 Linux - Kernel 3 01-18-2008 09:43 PM
MEPIS/Linux learning curve questions 21Williamkp Linux - Software 3 05-01-2006 10:40 PM
kernel-sourcecode-2.6.8-1.603.noarch.rpm RottenMutt Fedora 5 10-13-2004 11:21 PM
kernel-sourcecode-2.6.8-1.603.noarch.rpm RottenMutt Red Hat 1 10-12-2004 03:42 PM


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