Hello
Can you tell me what is the value of the esp before the instructin lss ...when
it crashes...
it should be 0x90000. Yours might be different because you are skipping
uncompression part and the esp is
being set there in head.S.
you can see /usr/src/linux/arch/i386/boot/compressed/head.S there it is being
initialised to
0x90000 and you are skipping that...
Let me know if you are successful or unsucessful...
All the best..
Regards,
Naushit
Andy Waddell wrote:
> I've been attemping to get Linux to boot up out of FLASH on a SC400 eval
> board and I've run into a little snag that someone may be able to help me
> with.
>
> Since I already had a fairly full featured bootloader running on the board
> which sets up the board and switches to protected mode, etc, I took the
> approach of skipping the initial code in bootsect.S and setup.S and loading
> the 32-bit code directly into memory and just jumping in. I figured that
> any of the stuff I skipped I could just add into my bootloader or to some
> place early the the 32-bit code. This seemed to work fairly well. The
> decompression code seems to run just fine, and after decompression it jumps
> in to the kernel proper at abosolute address 0x100000 (1 Meg). Once in the
> kernel I'm executing fine for several instructions, but then the board
> reboots. I've narrowed it down to one instruction (set ATW: comment below)
> that is causing the problem, but I can't see why. I've dumped memory (after
> the decompression) and everything seems to be in the correct place.
> Something about turning on paging is causing things to fail, but I can't see
> why. There must be something which is either set up by the BIOS or by the
> code in setup.S (which I skipped) but I'm not enough of an x86 person to
> know. This same kernel/code will run fine if I make a boot disk out of it
> and use one of the BIOS's included with the board.
>
>
>
> from arch/i386/kernel/head.S
>
> /*
> * swapper_pg_dir is the main page directory, address 0x00101000
> */
> ENTRY(stext)
> ENTRY(_stext)
> startup_32:
> /*
> * Set segments to known values
> */
> cld
> movl $(__KERNEL_DS),%eax
> movl %ax,%ds
> movl %ax,%es
> movl %ax,%fs
> movl %ax,%gs
> #ifdef __SMP__
> orw %bx,%bx
> jz 1f
> /*
> * New page tables may be in 4Mbyte page mode and may
> * be using the global pages.
> *
> * NOTE! We have to correct for the fact that we're
> * not yet offset PAGE_OFFSET..
> */
> #define cr4_bits mmu_cr4_features-__PAGE_OFFSET
> movl %cr4,%eax # Turn on 4Mb pages
> orl cr4_bits,%eax
> movl %eax,%cr4
> #endif
> /*
> * Setup paging (the tables are already set up, just switch them on)
> */
> 1:
> movl $0x101000,%eax
> movl %eax,%cr3 /* set the page table pointer.. */
> movl %cr0,%eax
> orl $0x80000000,%eax
> movl %eax,%cr0 /* ..and set paging (PG) bit */
> jmp 1f /* flush the prefetch-queue */
> 1:
> movl $1f,%eax
> jmp *%eax /* make sure eip is relocated */
> 1:
>
>
>
> /* ATW: my Elan board reboots on this instruction!!! (lss) */
>
>
> /* Set up the stack pointer */
> lss stack_start,%esp
>
> #ifdef __SMP__
> orw %bx,%bx
> jz 1f /* Initial CPU cleans BSS */
> pushl $0
> popfl
> jmp checkCPUtype
> 1:
> #endif __SMP__
> /*
> * Clear BSS first so that there are no surprises...
> */
> xorl %eax,%eax
> movl $ SYMBOL_NAME(__bss_start),%edi
> movl $ SYMBOL_NAME(_end),%ecx
> subl %edi,%ecx
> cld
> rep
> stosb
>
> --andy
>