Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1NkBhP-0000Th-Ig for mharc-grub-devel@gnu.org; Wed, 24 Feb 2010 02:30:24 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkBhI-0000Su-7l for grub-devel@gnu.org; Wed, 24 Feb 2010 02:30:16 -0500 Received: from [140.186.70.92] (port=58535 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkBhB-0000Rq-Lj for grub-devel@gnu.org; Wed, 24 Feb 2010 02:30:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NkBh9-0007mh-Tq for grub-devel@gnu.org; Wed, 24 Feb 2010 02:30:09 -0500 Received: from mail-fx0-f222.google.com ([209.85.220.222]:45031) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NkBh9-0007mH-KZ for grub-devel@gnu.org; Wed, 24 Feb 2010 02:30:07 -0500 Received: by fxm22 with SMTP id 22so4744794fxm.26 for ; Tue, 23 Feb 2010 23:30:05 -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=NnfeMg/xT3loGE9TJnQPxzg9kQmlBd8Uk5lwdbZDFYw=; b=aXG+rV36bdEDo43ph/lRKJqIy9kWRXMxKHA81kY4rZ22zd1ZQFATQbxxBGdgLdjiK0 Nr/gSH7sQJmYJLHs/pUdVWY2cVdAdCyND1OglxMgo8uRK0HsNiR59hKpIWPv0dgDWeaB h07ESE9Br+gsAIw50b8yzOreLtRGTgAT7E8T8= 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=ITdB3NAIhbGPdneKmnt+BmA7bf7UegjlHNtgsFna/TCcYycj8XsXfrIb+90gQFLuTh F5rsw0/bFfDBY3bH+DpFxcclTcmFppbxdBIY9JPws8VdGUYGfpTsdsDR0e5P0AmVSe6J g43YSHn/I8LVVdUleeCxvqRNYvlAh9eDsaCs8= MIME-Version: 1.0 Received: by 10.239.187.206 with SMTP id m14mr202910hbh.49.1266996604813; Tue, 23 Feb 2010 23:30:04 -0800 (PST) In-Reply-To: References: Date: Wed, 24 Feb 2010 01:30:04 -0600 Message-ID: <2e59e6971002232330i3e3813cey85201cc82998751c@mail.gmail.com> From: "richardvoigt@gmail.com" To: The development of GNU GRUB Content-Type: text/plain; charset=UTF-8 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 07:30:17 -0000 On Wed, Feb 24, 2010 at 12:57 AM, Swapnil Pimpale wrote: > Hi all, > > =C2=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. > > =C2=A0I am working on Intel Core 2 Duo architecture. I want to boot a > separate kernel on the second core. > =C2=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. > > =C2=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. You'll need to tell Linux not to touch the second core and not to touch the memory used by your second OS. I 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. For example, the second OS won't be able to use a hard disk connected to a SATA controller visible to the first one. Especially 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. > =C2=A0I am using the following code as the trampoline code for the AP. > > =C2=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. Even 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. If 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. > =C2=A0Awaiting your reply, > > Thanks, > Swapnil Pimpale > > ----- trampoline.S ----- > /* Tell GAS to generate 16-bit instructions so that this code works > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0in real mode. */ > > #include > #include > > > .align 4096 > .code16 > FUNCTION(TRAMPOLINE_CODE) > initial: > > =C2=A0 =C2=A0 =C2=A0 mov =C2=A0 =C2=A0 %cs, %ax > =C2=A0 =C2=A0 =C2=A0 mov =C2=A0 =C2=A0 %ax, %ds > =C2=A0 =C2=A0 =C2=A0 cli > > =C2=A0 =C2=A0 =C2=A0 lidtl =C2=A0 idtdesc - initial > =C2=A0 =C2=A0 =C2=A0 lgdtl =C2=A0 gdtdesc - initial > > =C2=A0 =C2=A0 =C2=A0 mov $0x9e00, %bx =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 // 9e00 is the cs > =C2=A0 =C2=A0 =C2=A0 shl $4, %ebx > =C2=A0 =C2=A0 =C2=A0 movl $(gdt - initial + 8), %eax > =C2=A0 =C2=A0 =C2=A0 movl %ebx, %eax > > =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0x10, %bx > =C2=A0 =C2=A0 =C2=A0 =C2=A0xor %ecx, %ecx > =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0xb800, %cx =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 // address of video RAM in %cx > =C2=A0 =C2=A0 =C2=A0 =C2=A0shl $4, %ecx > =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0x0744, %dx =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 // for printing D > =C2=A0 =C2=A0 =C2=A0 =C2=A0xor %eax, %eax > =C2=A0 =C2=A0 =C2=A0 =C2=A0pushw %ax > =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0x08, %ax > =C2=A0 =C2=A0 =C2=A0 =C2=A0pushw %ax > =C2=A0 =C2=A0 =C2=A0 =C2=A0xor %eax, %eax > =C2=A0 =C2=A0 =C2=A0 =C2=A0mov $0x9e00, %ax > =C2=A0 =C2=A0 =C2=A0 =C2=A0shl $4, %eax > =C2=A0 =C2=A0 =C2=A0 =C2=A0add protcseg - initial, %eax > =C2=A0 =C2=A0 =C2=A0 =C2=A0pushl %eax > > =C2=A0 =C2=A0 =C2=A0 xor %eax, %eax > =C2=A0 =C2=A0 =C2=A0 movl %cr0, %eax =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 // turn on the PE bit > =C2=A0 =C2=A0 =C2=A0 orl $0x1, %eax > =C2=A0 =C2=A0 =C2=A0 movl %eax, %cr0 > > =C2=A0 =C2=A0 =C2=A0jmp l1 > > l1: > > =C2=A0mov %bx, %ds > =C2=A0mov %dx, (%ecx) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 // Print D > =C2=A0add $2, %ecx > =C2=A0add $1, %dx > > =C2=A0ADDR32 ljmpl $0x8,$((protcseg - initial) + (0x9e00 << 4)) > > =C2=A0.align 256 > =C2=A0.code32 > =C2=A0protcseg: > > l3: > =C2=A0mov %dx, (%ecx) > > =C2=A0movw %bx, %es > =C2=A0movw %bx, %fs > =C2=A0movw %bx, %gs > =C2=A0movw %bx, %ss > > l4: > // The following is the code used by /loader/i386/linux.c for entering Li= nux > =C2=A0mov $0x8c000, %esi > =C2=A0xor %ebx, %ebx > =C2=A0mov $0x8c000, %eax > =C2=A0jmp *0x214(%eax) =C2=A0 =C2=A0 =C2=A0 =C2=A0 // System reboots here > > l5: > =C2=A0 =C2=A0 =C2=A0 jmp l5 > > > .p2align 2 > gdt: > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0, 0 > =C2=A0 =C2=A0 =C2=A0 .byte =C2=A0 0, 0, 0, 0 > > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0xFFFF, 0 > =C2=A0 =C2=A0 =C2=A0 .byte =C2=A0 0, 0x9A, 0xCF, 0 > > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0xFFFF, 0 > =C2=A0 =C2=A0 =C2=A0 .byte =C2=A0 0, 0x92, 0xCF, 0 > > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0xFFFF, 0 > =C2=A0 =C2=A0 =C2=A0 .byte =C2=A0 0, 0x9E, 0, 0 > > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0xFFFF, 0 > =C2=A0 =C2=A0 =C2=A0 .byte =C2=A0 0, 0x92, 0, 0 > > gdtdesc: > =C2=A0 =C2=A0 =C2=A0 .word =C2=A0 0x27 > =C2=A0 =C2=A0 =C2=A0 .long =C2=A0 gdt > > idtdesc: > =C2=A0 =C2=A0 =C2=A0 .word 0 > =C2=A0 =C2=A0 =C2=A0 .long 0 > FUNCTION(TRAMPOLINE_END) > > > _______________________________________________ > Grub-devel mailing list > Grub-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/grub-devel >