|
From: Kenn H. <ke...@us...> - 2004-09-28 22:26:49
|
Update of /cvsroot/linux-vax/kernel-2.5/arch/vax/boot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31158 Modified Files: head.S hexdump.S Log Message: Our compiler is built to consider r0-r5 as not-preserved-across-call registers (I thought it was only r0 and r1). So avoid using these registers where we're calling C code. Also use boot_memmove to relocate the booting kernel image (slightly slower, but more readable) Index: hexdump.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/hexdump.S,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- hexdump.S 26 Sep 2004 14:44:06 -0000 1.5 +++ hexdump.S 28 Sep 2004 22:26:39 -0000 1.6 @@ -7,6 +7,10 @@ # .globl hexdump hexdump: +# This is broken since the C code can clobber r0 to r5 and this +# code has not been updated for this + halt + # move offset to start dumping at into r4 # movl $0xffa800,r4 # movl ap,r4 Index: head.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.5/arch/vax/boot/head.S,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- head.S 28 Sep 2004 08:48:52 -0000 1.14 +++ head.S 28 Sep 2004 22:26:38 -0000 1.15 @@ -60,16 +60,16 @@ # pointers to virtual addresses in S0 space. We need to change # the pointers to the functions we use before VM init to point # into the newly-loaded kernel image.) - movl mv, %r2 - moval start, %r3 + movl mv, %r10 + moval start, %r8 - subl2 $PAGE_OFFSET+KERNEL_START_PHYS, %r3 - addl2 %r3, MV_PRE_VM_PUTCHAR(%r2) - addl2 %r3, MV_PRE_VM_GETCHAR(%r2) - addl2 %r3, MV_CPU_TYPE_STR(%r2) + subl2 $PAGE_OFFSET+KERNEL_START_PHYS, %r8 + addl2 %r8, MV_PRE_VM_PUTCHAR(%r10) + addl2 %r8, MV_PRE_VM_GETCHAR(%r10) + addl2 %r8, MV_CPU_TYPE_STR(%r10) # pre_vm_init is called after we relocate - subl2 $PAGE_OFFSET, MV_PRE_VM_INIT(%r2) + subl2 $PAGE_OFFSET, MV_PRE_VM_INIT(%r10) # print the cpu type calls $0, boot_crlf @@ -114,47 +114,29 @@ movl mv, boot_mv # copy the loaded image higher up in physical RAM - # chunks of 65535B data are moved top-to-bottom while - # inside one chunk the data is moved bottom-to-top. - # Assumed that 1MB - load_address > 65535B otherwise - # it will break. + movl $__bss_start, %r6 subl2 $start, %r6 # byte count to r6 - movab __bss_start, %r1 - subl2 $0xffff, %r1 # r1 points to top chunk of source - movl $KERNEL_START_PHYS, %r3 # dest address to r3 - addl2 %r6, %r3 - subl2 $0xffff,%r3 # r3 points to top chunk of dest -copy_chunk: - cmpl $0xffff,%r6 - bgeq last_chunk - movc3 $0xffff, (%r1), (%r3) - subl2 $0x1fffe, %r1 # place r1 to bottom of new src. chunk - subl2 $0x1fffe, %r3 # place r3 to bottom of new dest. chunk - subl2 $0xffff, %r6 - beql copy_done # this instruction is probably not needed - brb copy_chunk -last_chunk: - movab start, %r1 - movl $KERNEL_START_PHYS, %r3 - movc3 %r6, (%r1), (%r3) -copy_done: + pushl %r6 + pushab start # source address + pushl $KERNEL_START_PHYS # dest address + calls $3, boot_memmove # Next we have to fill the .bss section will zeros. We do it now # instead of when we are preparing the loadable image because it # makes the image smaller. subl3 $__bss_start, $_end, %r6 # length of .bss to r6 - subl3 $start, $__bss_start, %r3 # offset of .bss to r3 - addl2 $KERNEL_START_PHYS, %r3 # phys address of .bss start now in r3 + subl3 $start, $__bss_start, %r7 # offset of .bss to r7 + addl2 $KERNEL_START_PHYS, %r7 # phys address of .bss start now in r7 pushl %r6 - pushl %r3 + pushl %r7 calls $2, boot_memzero - addl2 %r6, %r3 + addl2 %r6, %r7 - decl %r3 - movl %r3, %r9 # save phys addr of last byte of kernel + decl %r7 + movl %r7, %r9 # save phys addr of last byte of kernel # in R9. We will need this later. # Need to know the distance we have moved the kernel, so that we can @@ -163,10 +145,10 @@ subl3 %r2, $KERNEL_START_PHYS, %r2 # r2 = START_PHYS - load_address # calculate the position after jump to reloc - movl $KERNEL_START_PHYS, %r3 - addl2 $reloc, %r3 - subl2 $start, %r3 - jmp (%r3) + movl $KERNEL_START_PHYS, %r8 + addl2 $reloc, %r8 + subl2 $start, %r8 + jmp (%r8) halt reloc: @@ -176,12 +158,12 @@ # fix up the machine vector pointer (by restoring it from boot_mv and # adding in the distance that the kernel was re-located) addl3 %r2, boot_mv, mv - movl mv, %r3 + movl mv, %r10 #and the pre-vm i/o functions - addl2 %r2, MV_PRE_VM_PUTCHAR(%r3) - addl2 %r2, MV_PRE_VM_GETCHAR(%r3) - addl2 %r2, MV_CPU_TYPE_STR(%r3) + addl2 %r2, MV_PRE_VM_PUTCHAR(%r10) + addl2 %r2, MV_PRE_VM_GETCHAR(%r10) + addl2 %r2, MV_CPU_TYPE_STR(%r10) pushab msg_relocated # debugging line no 2 calls $1, boot_printstr @@ -196,8 +178,8 @@ # save RPB before it gets obliterated movl boot_r11, %r11 movc3 $RPB_SIZE, (%r11), boot_rpb - movl mv, %r3 - calls $0, *MV_PRE_VM_INIT(%r3) + movl mv, %r10 + calls $0, *MV_PRE_VM_INIT(%r10) # set up the system page table for all of physical memory. # for the i386, the first page only is setup. For us, as the @@ -235,7 +217,7 @@ blssu sysfill # We need to align the IOMAP/VMALLOC tables (well at least the VMALLOC - # tables, but no harm.. well waste the space here or later) on a Linux + # tables, but no harm.. we will waste the space here or later) on a Linux # PAGE boundary (4K) # we need to check is r7 4k-aligned if not we need to fill zero until it # is, so round up r7 to the next page, add 7 then and with 7, @@ -298,8 +280,8 @@ addl2 $PAGE_OFFSET, iomap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, vmallocmap_base # ... and the IOMAP PTEs addl2 $PAGE_OFFSET, mv # fix up machine vector pointer - movl mv, %r3 - addl2 $PAGE_OFFSET, MV_CPU_TYPE_STR(%r3) + movl mv, %r10 + addl2 $PAGE_OFFSET, MV_CPU_TYPE_STR(%r10) # relocate the interrupt stack. The C code will turn the # last page of the interrupt stack into a read-only guard @@ -314,7 +296,7 @@ # Now that we have ISP (the interrupt stack pointer) sorted, # we need to move over to working on the kernel stack. We do this - # my loading KSP with the top of the kernel stack for the 'init task' + # by loading KSP with the top of the kernel stack for the 'init task' # and faking a saved PC/PSL on the interrupt stack which we then # 'return' to moval init_thread_union, %r0 |