From owner-freebsd-hackers@FreeBSD.ORG Sat Nov 24 03:59:57 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F9E916A417 for ; Sat, 24 Nov 2007 03:59:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from outK.internet-mail-service.net (outK.internet-mail-service.net [216.240.47.234]) by mx1.freebsd.org (Postfix) with ESMTP id 52EDF13C46A for ; Sat, 24 Nov 2007 03:59:57 +0000 (UTC) (envelope-from julian@elischer.org) Received: from mx0.idiom.com (HELO idiom.com) (216.240.32.160) by out.internet-mail-service.net (qpsmtpd/0.40) with ESMTP; Fri, 23 Nov 2007 19:59:56 -0800 X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e X-Client-Authorized: MaGic Cook1e Received: from julian-mac.elischer.org (home.elischer.org [216.240.48.38]) by idiom.com (Postfix) with ESMTP id 75829126AB0; Fri, 23 Nov 2007 19:59:55 -0800 (PST) Message-ID: <4747A1BA.6020505@elischer.org> Date: Fri, 23 Nov 2007 19:59:54 -0800 From: Julian Elischer User-Agent: Thunderbird 2.0.0.9 (Macintosh/20071031) MIME-Version: 1.0 To: Aryeh Friedman References: <3bbf2fe10711231937y1e9af357hd8b6a63cbf6ae077@mail.gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Attilio Rao , freebsd-hackers@freebsd.org Subject: Re: a strange/stupid question X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2007 03:59:57 -0000 Aryeh Friedman wrote: > On 11/24/07, Attilio Rao wrote: >> 2007/11/24, Aryeh Friedman : >>> Where do I find the main() [and/or other entery point] for the >>> kernel.... I tend to understand stuff better if I follow the flow of >>> exec from the start >> It is highly MD. >> For IA32 it is in i386/i386/locore.s::btext > > For AMD64 I assume something close to that... > > I just relized that I actually want to understand everything from POST > on (actually from power on but I know that is very mobo dependant) so > I guess the question is where do I find the first executed statement > for BTX (I know how to disamble the MBR so that part is not an issue) > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" As Attilio said: for the kernel, execution starts (for the x86) in /usr/src/sys/i386/i386/locore.s at around line 205. look for: /********************************************************************** * * This is where the bootblocks start us, set the ball rolling... * */ NON_GPROF_ENTRY(btext) it then skips to sys/kern/init_main.c (mi_startup) (from memory) and that jumps back to machdep.c (cpu_startup()) I suggest of course that you also read the bootblocks.