Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NkD95-0002x6-Oh for mharc-grub-devel@gnu.org; Wed, 24 Feb 2010 04:03:03 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkD92-0002vV-3b for grub-devel@gnu.org; Wed, 24 Feb 2010 04:03:00 -0500 Received: from [140.186.70.92] (port=45080 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkD90-0002uf-Iq for grub-devel@gnu.org; Wed, 24 Feb 2010 04:02:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NkD8z-0008Cu-MB for grub-devel@gnu.org; Wed, 24 Feb 2010 04:02:58 -0500 Received: from mail-px0-f180.google.com ([209.85.216.180]:54610) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NkD8z-0008Co-Bq for grub-devel@gnu.org; Wed, 24 Feb 2010 04:02:57 -0500 Received: by pxi10 with SMTP id 10so2201738pxi.13 for ; Wed, 24 Feb 2010 01:02:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=7PK05JC1lEFMK8gplrRVl/D5OhPlQNKIuk7fxaTJxaI=; b=bksPmeKB2bAru4rMbrTZi5YgyNTrP2dxhXpSUh+rUFIVFbh13T8ymbfzW0Om70uLSz yfOIr7aaE/YAeKAVFTvoubBJriKJJvqa7TOli5kXhqu1Rtu2AAcR7liO4CESS7B7c4oi 5/jDTtYUzOrw5zvSWgbK84AaLGj5zRb0pfyNI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=O/Dzen73lNZMgzUKieVeC/QK5E2br+3nVxBMlrDNfl/Z1DipSi40cPLgm3D0DMI2AJ 2sT6D10ZeLbQyP0ED1GGnvGLDdyc9mzZvBfAxQaICkAMDcsLA12PkmxWnho/LgWw9XQp /c7q+UER+dtzDsZrQmPRkfrWwpgJpB9mqSo/8= MIME-Version: 1.0 Received: by 10.142.120.10 with SMTP id s10mr1509915wfc.103.1267002176177; Wed, 24 Feb 2010 01:02:56 -0800 (PST) In-Reply-To: <2e59e6971002232330i3e3813cey85201cc82998751c@mail.gmail.com> References: <2e59e6971002232330i3e3813cey85201cc82998751c@mail.gmail.com> Date: Wed, 24 Feb 2010 14:32:56 +0530 Message-ID: From: Swapnil Pimpale To: The development of GNU GRUB Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Subject: Re: Help regarding booting application processor X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 09:03:00 -0000 Thanks for your quick reply. On Wed, Feb 24, 2010 at 1:00 PM, richardvoigt@gmail.com wrote: > On Wed, Feb 24, 2010 at 12:57 AM, Swapnil Pimpale > wrote: >> Hi all, >> >> =A0I am a final year engineering student and I am doing my project in >> GRUB-1.97~beta4 and Linux Kernel 2.6.24.7. >> >> =A0I am working on Intel Core 2 Duo architecture. I want to boot a >> separate kernel on the second core. >> =A0As of now, I have brought up the halted AP from the GRUB by sending >> IPIs in the INIT-SIPI-SIPI sequence. I have also allocated a 4KB page >> below 1MB and asked the AP to jump to that address. >> >> =A0I am trying to put the BSP in while(1) loop and I want the AP to >> switch from real to protected mode and then jump to start of kernel. >> But whenever I do a jump to 1MB the system reboots. > > Remember that the RAM physical address space is shared between both > processors. =A0You'll need to tell Linux not to touch the second core > and not to touch the memory used by your second OS. =A0I think you can > accomplish both of these goals using the right kernel command line. > Then you'll have to divide up other hardware, like PCI devices, so > that only one OS accesses any given device. =A0For example, the second > OS won't be able to use a hard disk connected to a SATA controller > visible to the first one. =A0Especially the second kernel needs to be > written not to address the PCI bus controller(s), including > enumeration of bus devices. > > If you can't partition the hardware like this then you'll need a > hypervisor, which uses protected mode to intercept and virtualize > attempted hardware access from the other OS. > I have considered these issues in the design. >> =A0I am using the following code as the trampoline code for the AP. >> >> =A0Can someone please let me know what is wrong in the following code. > > Probably you've stomped on a shared resource being used by the first > processor. =A0Even if you run an infinite while loop on the first core, > it can still execute interrupt service routines installed by grub (or > by the second kernel, if not careful about interrupt-processor masks) > which would access grub global data structures. =A0If you overwrite > anything you may end up with a protection fault or invalid instruction > exception, both of which would probably vector back to BIOS startup > code. > Ok, I will think in this direction. I just wanted to verify whether the code in the trampoline.S is correct or not. >> =A0Awaiting your reply, >> >> Thanks, >> Swapnil Pimpale >> >> ----- trampoline.S ----- >> /* Tell GAS to generate 16-bit instructions so that this code works >> =A0 =A0 =A0 =A0 =A0in real mode. */ >> >> #include >> #include >> >> >> .align 4096 >> .code16 >> FUNCTION(TRAMPOLINE_CODE) >> initial: >> >> =A0 =A0 =A0 mov =A0 =A0 %cs, %ax >> =A0 =A0 =A0 mov =A0 =A0 %ax, %ds >> =A0 =A0 =A0 cli >> >> =A0 =A0 =A0 lidtl =A0 idtdesc - initial >> =A0 =A0 =A0 lgdtl =A0 gdtdesc - initial >> >> =A0 =A0 =A0 mov $0x9e00, %bx =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // 9e00= is the cs >> =A0 =A0 =A0 shl $4, %ebx >> =A0 =A0 =A0 movl $(gdt - initial + 8), %eax >> =A0 =A0 =A0 movl %ebx, %eax >> >> =A0 =A0 =A0 =A0mov $0x10, %bx >> =A0 =A0 =A0 =A0xor %ecx, %ecx >> =A0 =A0 =A0 =A0mov $0xb800, %cx =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // addre= ss of video RAM in %cx >> =A0 =A0 =A0 =A0shl $4, %ecx >> =A0 =A0 =A0 =A0mov $0x0744, %dx =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // for p= rinting D >> =A0 =A0 =A0 =A0xor %eax, %eax >> =A0 =A0 =A0 =A0pushw %ax >> =A0 =A0 =A0 =A0mov $0x08, %ax >> =A0 =A0 =A0 =A0pushw %ax >> =A0 =A0 =A0 =A0xor %eax, %eax >> =A0 =A0 =A0 =A0mov $0x9e00, %ax >> =A0 =A0 =A0 =A0shl $4, %eax >> =A0 =A0 =A0 =A0add protcseg - initial, %eax >> =A0 =A0 =A0 =A0pushl %eax >> >> =A0 =A0 =A0 xor %eax, %eax >> =A0 =A0 =A0 movl %cr0, %eax =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // turn on t= he PE bit >> =A0 =A0 =A0 orl $0x1, %eax >> =A0 =A0 =A0 movl %eax, %cr0 >> >> =A0 =A0 =A0jmp l1 >> >> l1: >> >> =A0mov %bx, %ds >> =A0mov %dx, (%ecx) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 // Print D >> =A0add $2, %ecx >> =A0add $1, %dx >> >> =A0ADDR32 ljmpl $0x8,$((protcseg - initial) + (0x9e00 << 4)) >> >> =A0.align 256 >> =A0.code32 >> =A0protcseg: >> >> l3: >> =A0mov %dx, (%ecx) >> >> =A0movw %bx, %es >> =A0movw %bx, %fs >> =A0movw %bx, %gs >> =A0movw %bx, %ss >> >> l4: >> // The following is the code used by /loader/i386/linux.c for entering L= inux >> =A0mov $0x8c000, %esi >> =A0xor %ebx, %ebx >> =A0mov $0x8c000, %eax >> =A0jmp *0x214(%eax) =A0 =A0 =A0 =A0 // System reboots here >> >> l5: >> =A0 =A0 =A0 jmp l5 >> >> >> .p2align 2 >> gdt: >> =A0 =A0 =A0 .word =A0 0, 0 >> =A0 =A0 =A0 .byte =A0 0, 0, 0, 0 >> >> =A0 =A0 =A0 .word =A0 0xFFFF, 0 >> =A0 =A0 =A0 .byte =A0 0, 0x9A, 0xCF, 0 >> >> =A0 =A0 =A0 .word =A0 0xFFFF, 0 >> =A0 =A0 =A0 .byte =A0 0, 0x92, 0xCF, 0 >> >> =A0 =A0 =A0 .word =A0 0xFFFF, 0 >> =A0 =A0 =A0 .byte =A0 0, 0x9E, 0, 0 >> >> =A0 =A0 =A0 .word =A0 0xFFFF, 0 >> =A0 =A0 =A0 .byte =A0 0, 0x92, 0, 0 >> >> gdtdesc: >> =A0 =A0 =A0 .word =A0 0x27 >> =A0 =A0 =A0 .long =A0 gdt >> >> idtdesc: >> =A0 =A0 =A0 .word 0 >> =A0 =A0 =A0 .long 0 >> FUNCTION(TRAMPOLINE_END) >> >> >> _______________________________________________ >> Grub-devel mailing list >> Grub-devel@gnu.org >> http://lists.gnu.org/mailman/listinfo/grub-devel >> > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel >