From: Itsuro O. <od...@us...> - 2006-02-14 05:50:37
|
Update of /cvsroot/mkdump/mkexec/3.0/2.6/arch/i386/kernel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17390/arch/i386/kernel Modified Files: machine_mkexec.c minik_dump.c mkexec-vmlinux.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/i386/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 *************** *** 50,53 **** --- 50,54 ---- 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) *************** *** 130,133 **** --- 131,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/i386/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 *************** *** 31,34 **** --- 31,35 ---- movl 12(%esp), %edx /* start address */ movl 16(%esp), %ecx /* cpu_has_pae */ + movl 20(%esp), %eax /* swap page */ /* zero out flags, and disable interrupts */ *************** *** 40,43 **** --- 41,46 ---- /* store the parameters back on the stack */ pushl %edx /* store the start address */ + pushl %ebx + movl %eax, %ebx /* Set cr0 to a known state: *************** *** 70,77 **** --- 73,158 ---- movl %eax, %cr3 + cmpl $0, %ebx + je final + /* + * ### swap ### + */ + pushl %ebp + movl %ebx, %ebp + addl $4096, %ebp /* addr of copy_pages list */ + 1: + cmpl $0, 8(%ebp) /* if num_pages == 0 */ + je 2f + cmpl $0, 12(%ebp) /* if is_swap == 0 */ + je 4f + /* swap copy */ + movl 8(%ebp), %eax + 5: + cmpl $0, %eax + je 6f + pushl %eax + subl $1, %eax + shl $12, %eax + /* src -> work */ + movl (%ebp), %esi + addl %eax, %esi + movl %ebx, %edi + // addl %eax, %edi + movl $0x400, %ecx + cld + rep + movsl + /* dst -> src */ + movl 4(%ebp), %esi + addl %eax, %esi + movl (%ebp), %edi + addl %eax, %edi + movl $0x400, %ecx + cld + rep + movsl + /* work -> dst */ + movl %ebx, %esi + // addl %eax, %esi + movl 4(%ebp), %edi + addl %eax, %edi + movl $0x400, %ecx + cld + rep + movsl + popl %eax + subl $1, %eax + jmp 5b + 4: /* simple copy */ + movl (%ebp), %esi + movl 4(%ebp), %edi + movl 8(%ebp), %ecx + shl $10, %ecx /* pages -> words */ + cld + rep + movsl + 6: + addl $16, %ebp + jmp 1b + 2: /* end */ + popl %ebp + + #if 0 + /* copy first 4pages */ + movl %ebp, %esi + movl $0x0, %edi + movl $0x1000, %ecx + cld + rep + movsl + #endif + + final: + /* set all of the registers to known values */ /* leave %esp alone */ xorl %eax, %eax + popl %ebx /* xorl %ebx, %ebx *//* new address */ xorl %ecx, %ecx Index: machine_mkexec.c =================================================================== RCS file: /cvsroot/mkdump/mkexec/3.0/2.6/arch/i386/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 *************** *** 120,124 **** 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[]; --- 120,124 ---- typedef asmlinkage void (*start_new_kernel_t)( unsigned long indirection_page, unsigned long reboot_code_buffer, ! unsigned long start_address, unsigned int has_pae, unsigned long swap_page_addr); const extern unsigned char start_new_kernel[]; *************** *** 147,150 **** --- 147,152 ---- { start_new_kernel_t rnk; + unsigned long new_addr; + unsigned long start_addr; /* Interrupts aren't acceptable while we reboot */ *************** *** 176,181 **** /* 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, cpu_has_pae); } --- 178,188 ---- /* 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, cpu_has_pae, image->swap_page_addr); } Index: mkexec-vmlinux.c =================================================================== RCS file: /cvsroot/mkdump/mkexec/3.0/2.6/arch/i386/kernel/mkexec-vmlinux.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mkexec-vmlinux.c 14 Feb 2006 05:30:26 -0000 1.1 --- mkexec-vmlinux.c 14 Feb 2006 05:50:28 -0000 1.2 *************** *** 161,165 **** int size; ! if (image->minik_type == MINIK_V1) { size = 0; for (i = 0; i < image->num_minik_mem; i++) { --- 161,165 ---- int size; ! if (image->minik_type == MINIK_V1 || image->minik_type == MINIK_V3) { size = 0; for (i = 0; i < image->num_minik_mem; i++) { *************** *** 167,170 **** --- 167,173 ---- } size = size / (1024 * 1024); + #ifdef CONFIG_X86_64 + size -= 1; + #endif buffer_append(buffer, " mem=%dM", size); return; *************** *** 186,206 **** } - static void string_arg_strip(char *string, const char *arg) - { - char *s, *s2; - - s = string; - while ((s = strstr(s, arg))) { - if (s > string && s[-1] != ' ') - continue; - s2 = s + strlen(arg); - while (*s2 && *s2 != ' ') - s2++; - while (*s2 == ' ') - s2++; - memmove(s, s2, strlen(s2) + 1); - } - } - int pimage_create(struct kimage *image) { --- 189,192 ---- *************** *** 223,237 **** * Prepare the minik command line arguments. */ ! /* Copy the current kernel's commandline. */ ! strncpy(image_command_line, saved_command_line, sizeof(image_command_line)); ! image_command_line[sizeof(image_command_line) - 1] = 0; ! /* Do not: append " crashkernel=no" ! * as the commandline may get too big to fit in. ! * Drop the original parameter instead. ! */ ! string_arg_strip(image_command_line, "crashdma="); ! string_arg_strip(image_command_line, "crashmain="); ! image_command_line_buffer.tail = image_command_line + strlen(image_command_line); ! if (image->minik_type == MINIK_V1) { buffer_append(&image_command_line_buffer, " dump_dev=%s maxcpus=1 noapic irqpoll", mkexec_inf.ddev); --- 209,219 ---- * Prepare the minik command line arguments. */ ! image_command_line[0] = 0; ! image_command_line_buffer.tail = image_command_line; ! if (image->minik_type == MINIK_V3) { ! buffer_append(&image_command_line_buffer, ! " dump_dev=%s dump_pfn=0x%lx maxcpus=1 noapic irqpoll", mkexec_inf.ddev, ! page_to_pfn(image->dump_header_pages)); ! } else if (image->minik_type == MINIK_V1) { buffer_append(&image_command_line_buffer, " dump_dev=%s maxcpus=1 noapic irqpoll", mkexec_inf.ddev); *************** *** 252,257 **** * These values are just random choice in the 640KB range. */ ! " memmap=64K@192K" ! , mkexec_inf.ddev, /* " dump_dev=%s" */ page_to_pfn(image->dump_header_pages)); /* " dump_pfn=0x%lx" */ --- 234,238 ---- * These values are just random choice in the 640KB range. */ ! " memmap=64K@192K" , mkexec_inf.ddev, /* " dump_dev=%s" */ page_to_pfn(image->dump_header_pages)); /* " dump_pfn=0x%lx" */ *************** *** 275,281 **** kern32_size = (setup_sects +1) *512; - // /* Can not get kernel version.(setup sector has version information.) */ - // kernel_version = ((unsigned char *)&header) + 512 + header.kver_addr; - /* The x86 code segment */ command_line_off = kern32_size; --- 256,259 ---- *************** *** 289,296 **** image->segment[0].memsz = image->segment[0].bufsz = size; ! ! image->segment[0].buf = (char *)((unsigned long)\ ! kmap(pfn_to_page(image->new_kernel_paddr >> PAGE_SHIFT)) ! + image->segment[0].mem); real_mode = image->segment[0].buf; cmdline = (char *)image->segment[0].buf + command_line_off; --- 267,271 ---- image->segment[0].memsz = image->segment[0].bufsz = size; ! image->segment[0].buf = __va(image->new_kernel_paddr + image->segment[0].mem); real_mode = image->segment[0].buf; cmdline = (char *)image->segment[0].buf + command_line_off; *************** *** 298,302 **** entry = (unsigned long)image->segment[0].mem + setup32_off; memset(image->segment[0].buf, 0, image->segment[0].bufsz); - kunmap(pfn_to_page(image->new_kernel_paddr>> PAGE_SHIFT)); /* --- 273,276 ---- *************** *** 306,314 **** real_mode->cl_magic = CL_MAGIC_VALUE; real_mode->cl_offset = command_line_off; - // if (header.protocol_version >= 0x0202) { - // real_mode->cmd_line_ptr = 0x90000 + command_line_off; - // } /* Provide absolute physical address of the commandline, it is not relocated. */ ! real_mode->cmd_line_ptr = __pa(cmdline); real_mode->heap_end_ptr = image->segment[0].bufsz + 1024; --- 280,289 ---- real_mode->cl_magic = CL_MAGIC_VALUE; real_mode->cl_offset = command_line_off; /* Provide absolute physical address of the commandline, it is not relocated. */ ! if (image->minik_type == MINIK_V3) { ! real_mode->cmd_line_ptr = 0x90000 + command_line_off; ! } else { ! real_mode->cmd_line_ptr = __pa(cmdline); ! } real_mode->heap_end_ptr = image->segment[0].bufsz + 1024; *************** *** 316,321 **** real_mode->loader_type = LOADER_TYPE_UNKNOWN; /* The ramdisk */ ! real_mode->initrd_start = 0; ! real_mode->initrd_size = 0; /* --- 291,301 ---- real_mode->loader_type = LOADER_TYPE_UNKNOWN; /* The ramdisk */ ! if (image->minik_type == MINIK_V3) { ! real_mode->initrd_start = image->segment[2].mem; ! real_mode->initrd_size = image->segment[2].memsz; ! } else { ! real_mode->initrd_start = 0; ! real_mode->initrd_size = 0; ! } /* |