From: Itsuro O. <od...@us...> - 2006-02-14 05:50:37
|
Update of /cvsroot/mkdump/mkexec/3.0/2.6/arch/x86_64/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17390/arch/x86_64/kernel Modified Files: machine_mkexec.c minik_dump.c start_new_kernel.S Log Message: the v3.0 initial Index: minik_dump.c =================================================================== RCS file: /cvsroot/mkdump/mkexec/3.0/2.6/arch/x86_64/kernel/minik_dump.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** minik_dump.c 14 Feb 2006 05:30:26 -0000 1.1 --- minik_dump.c 14 Feb 2006 05:50:28 -0000 1.2 *************** *** 49,52 **** --- 49,53 ---- static struct dump_header *dhp; extern void mkexec_exec(void); + extern void reserve_seg_init(struct kimage *image, struct mem_seg *mem_segp); static void mem_seg_init(struct mem_seg *mem_segp) *************** *** 129,133 **** } *addrp = 0; ! } } --- 130,136 ---- } *addrp = 0; ! } else if (image->minik_type == MINIK_V3) { ! reserve_seg_init(image, (void *)((u8 *)dhp + PAGE_SIZE * 2)); ! } } Index: start_new_kernel.S =================================================================== RCS file: /cvsroot/mkdump/mkexec/3.0/2.6/arch/x86_64/kernel/start_new_kernel.S,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** start_new_kernel.S 14 Feb 2006 05:30:26 -0000 1.1 --- start_new_kernel.S 14 Feb 2006 05:50:28 -0000 1.2 *************** *** 32,36 **** * %rdx start address * %rcx page_table ! * %r8 arg5 * %r9 arg6 */ --- 32,36 ---- * %rdx start address * %rcx page_table ! * %r8 swap page * %r9 arg6 */ *************** *** 44,47 **** --- 44,48 ---- /* store the parameters back on the stack */ pushq %rdx /* store the start address */ + pushq %rdi /* Set cr0 to a known state: *************** *** 83,86 **** --- 84,152 ---- movq %rcx, %cr3 + /* add */ + cmpq $0, %r8 + je final + /* + * ### swap ### + */ + movq %r8, %r9 + addq $4096, %r9 /* addr of copy_pages list */ + 1: + cmpq $0, 16(%r9) /* if num_pages == 0 */ + je 2f + cmpq $0, 24(%r9) /* if is_swap == 0 */ + je 4f + /* swap copy */ + movq 16(%r9), %r10 + 5: + cmpq $0, %r10 + je 6f + pushq %r10 + subq $1, %r10 + shl $12, %r10 + /* src -> work */ + movq (%r9), %rsi + addq %r10, %rsi + movq %r8, %rdi + movq $0x200, %rcx + cld + rep + movsq + /* dst -> src */ + movq 8(%r9), %rsi + addq %r10, %rsi + movq (%r9), %rdi + addq %r10, %rdi + movq $0x200, %rcx + cld + rep + movsq + /* work -> dst */ + movq %r8, %rsi + movq 8(%r9), %rdi + addq %r10, %rdi + movq $0x200, %rcx + cld + rep + movsq + popq %r10 + subq $1, %r10 + jmp 5b + 4: /* simple copy */ + movq (%r9), %rsi + movq 8(%r9), %rdi + movq 16(%r9), %rcx + shl $9, %rcx /* pages -> words */ + cld + rep + movsq + 6: + addq $32, %r9 + jmp 1b + 2: /* end */ + + final: + /* add end */ + /* set all of the registers to known values */ /* leave %rsp alone */ *************** *** 91,94 **** --- 157,161 ---- xorq %rdx, %rdx xorq %rsi, %rsi + popq %rdi // xorq %rdi, %rdi xorq %rbp, %rbp Index: machine_mkexec.c =================================================================== RCS file: /cvsroot/mkdump/mkexec/3.0/2.6/arch/x86_64/kernel/machine_mkexec.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** machine_mkexec.c 14 Feb 2006 05:30:26 -0000 1.1 --- machine_mkexec.c 14 Feb 2006 05:50:28 -0000 1.2 *************** *** 268,272 **** typedef asmlinkage void (*start_new_kernel_t)( unsigned long indirection_page, unsigned long reboot_code_buffer, ! unsigned long start_address, unsigned int has_pae); const extern unsigned char start_new_kernel[]; --- 268,272 ---- typedef asmlinkage void (*start_new_kernel_t)( unsigned long indirection_page, unsigned long reboot_code_buffer, ! unsigned long start_address, unsigned long start_pgtable, unsigned long swap_page); const extern unsigned char start_new_kernel[]; *************** *** 280,286 **** void machine_mkexec(struct kimage *image) { - unsigned long control_code_buffer; unsigned long start_pgtable; start_new_kernel_t rnk; /* Interrupts aren't acceptable while we reboot */ --- 280,287 ---- void machine_mkexec(struct kimage *image) { unsigned long start_pgtable; start_new_kernel_t rnk; + unsigned long new_addr; + unsigned long start_addr; /* Interrupts aren't acceptable while we reboot */ *************** *** 289,293 **** /* Calculate the offsets */ start_pgtable = page_to_pfn(image->control_code_page) << PAGE_SHIFT; - control_code_buffer = image->reboot_code_addr; /* Set the low half of the page table to my identity mapped --- 290,293 ---- *************** *** 327,333 **** /* now call it */ rnk = (start_new_kernel_t)image->reboot_code_addr; ! ! (*rnk)(image->new_kernel_paddr, image->reboot_code_addr, ! image->start+image->new_kernel_paddr, start_pgtable); ! } --- 327,338 ---- /* now call it */ rnk = (start_new_kernel_t)image->reboot_code_addr; ! if (image->minik_type == MINIK_V3) { ! new_addr = 0; ! start_addr = image->start; ! } else { ! new_addr = image->new_kernel_paddr; ! start_addr = image->start + image->new_kernel_paddr; ! } ! (*rnk)(new_addr, image->reboot_code_addr, ! start_addr, start_pgtable, image->swap_page_addr); } |