[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Help regarding booting application processor
From: |
Swapnil Pimpale |
Subject: |
Help regarding booting application processor |
Date: |
Wed, 24 Feb 2010 12:27:17 +0530 |
Hi all,
I am a final year engineering student and I am doing my project in
GRUB-1.97~beta4 and Linux Kernel 2.6.24.7.
I am working on Intel Core 2 Duo architecture. I want to boot a
separate kernel on the second core.
As 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.
I 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.
I am using the following code as the trampoline code for the AP.
Can someone please let me know what is wrong in the following code.
Awaiting your reply,
Thanks,
Swapnil Pimpale
----- trampoline.S -----
/* Tell GAS to generate 16-bit instructions so that this code works
in real mode. */
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
.align 4096
.code16
FUNCTION(TRAMPOLINE_CODE)
initial:
mov %cs, %ax
mov %ax, %ds
cli
lidtl idtdesc - initial
lgdtl gdtdesc - initial
mov $0x9e00, %bx // 9e00 is the cs
shl $4, %ebx
movl $(gdt - initial + 8), %eax
movl %ebx, %eax
mov $0x10, %bx
xor %ecx, %ecx
mov $0xb800, %cx // address of video RAM in %cx
shl $4, %ecx
mov $0x0744, %dx // for printing D
xor %eax, %eax
pushw %ax
mov $0x08, %ax
pushw %ax
xor %eax, %eax
mov $0x9e00, %ax
shl $4, %eax
add protcseg - initial, %eax
pushl %eax
xor %eax, %eax
movl %cr0, %eax // turn on the PE bit
orl $0x1, %eax
movl %eax, %cr0
jmp l1
l1:
mov %bx, %ds
mov %dx, (%ecx) // Print D
add $2, %ecx
add $1, %dx
ADDR32 ljmpl $0x8,$((protcseg - initial) + (0x9e00 << 4))
.align 256
.code32
protcseg:
l3:
mov %dx, (%ecx)
movw %bx, %es
movw %bx, %fs
movw %bx, %gs
movw %bx, %ss
l4:
// The following is the code used by /loader/i386/linux.c for entering Linux
mov $0x8c000, %esi
xor %ebx, %ebx
mov $0x8c000, %eax
jmp *0x214(%eax) // System reboots here
l5:
jmp l5
.p2align 2
gdt:
.word 0, 0
.byte 0, 0, 0, 0
.word 0xFFFF, 0
.byte 0, 0x9A, 0xCF, 0
.word 0xFFFF, 0
.byte 0, 0x92, 0xCF, 0
.word 0xFFFF, 0
.byte 0, 0x9E, 0, 0
.word 0xFFFF, 0
.byte 0, 0x92, 0, 0
gdtdesc:
.word 0x27
.long gdt
idtdesc:
.word 0
.long 0
FUNCTION(TRAMPOLINE_END)
- Help regarding booting application processor,
Swapnil Pimpale <=