From 5c8e7d1afc36100b98030b2ff87b5289c6556d4f Mon Sep 17 00:00:00 2001 From: mycroft Date: Mon, 13 Jun 1994 19:32:05 +0000 Subject: [PATCH] Format police. --- sys/arch/i386/boot/asm.S | 87 +++++++++++++++++++++++++-------------- sys/arch/i386/boot/boot.c | 33 ++++++++++++++- 2 files changed, 88 insertions(+), 32 deletions(-) diff --git a/sys/arch/i386/boot/asm.S b/sys/arch/i386/boot/asm.S index a7245eb376c4..015420ee925b 100644 --- a/sys/arch/i386/boot/asm.S +++ b/sys/arch/i386/boot/asm.S @@ -60,11 +60,9 @@ CR0_PE = 0x1 .text /* -# -# real_to_prot() -# transfer from real mode to protected mode. -*/ - + * real_to_prot() + * transfer from real mode to protected mode. + */ ENTRY(real_to_prot) # guarantee that interrupt is disabled when in prot mode cli @@ -97,12 +95,9 @@ xprot: ret /* -# -# prot_to_real() -# transfer from protected mode to real mode -# -*/ - + * prot_to_real() + * transfer from protected mode to real mode + */ ENTRY(prot_to_real) # set up a dummy stack frame for the second seg change. @@ -139,19 +134,16 @@ xreal: ret /* -# -# startprog(phyaddr) -# start the program on protected mode where phyaddr is the entry point -# -*/ - + * startprog(phyaddr) + * start the program on protected mode where phyaddr is the entry point + */ ENTRY(startprog) pushl %ebp movl %esp, %ebp # get things we need into registers movl 0x8(%ebp), %ecx # entry offset - movl 0x0c(%ebp), %eax # &argv + movl 0xc(%ebp), %eax # &argv # make a new stack at 0:0xa0000 (big segs) movl $0x10, %ebx @@ -169,7 +161,7 @@ ENTRY(startprog) pushl $0 # dummy 'return' address # push on our entry address - movl $0x08, %ebx # segment + movl $0x8, %ebx # segment pushl %ebx pushl %ecx @@ -180,12 +172,11 @@ ENTRY(startprog) # convert the PC (and code seg) lret -/* -# -# pbzero( dst, cnt) -# where src is a virtual address and dst is a physical address -*/ +/* + * pbzero(dst, cnt) + * where dst is a virtual address and cnt is the length + */ ENTRY(pbzero) pushl %ebp movl %esp, %ebp @@ -201,7 +192,7 @@ ENTRY(pbzero) movl 0x8(%ebp), %edi # destination movl 0xc(%ebp), %ecx # count - movl $0x0, %eax # value + xorl %eax, %eax # value rep stosb @@ -212,13 +203,11 @@ ENTRY(pbzero) popl %ebp ret -/* -# -# pcpy(src, dst, cnt) -# where src is a virtual address and dst is a physical address -# -*/ +/* + * pcpy(src, dst, cnt) + * where src is a virtual address and dst is a physical address + */ ENTRY(pcpy) pushl %ebp movl %esp, %ebp @@ -247,3 +236,39 @@ ENTRY(pcpy) popl %ebp ret + +#ifdef CHECKSUM +/* + * cksum(src, cnt) + * where src is a virtual address and cnt is the length + */ +ENTRY(cksum) + pushl %ebp + movl %esp, %ebp + pushl %es + pushl %edi + pushl %ecx + + cld + + # set %es to point at the flat segment + movl $0x10, %eax + movl %ax, %es + + movl 0x8(%ebp), %edi # destination + movl 0xc(%ebp), %ecx # count + shrl $2, %ecx + xorl %edx, %edx # value + +1: es + lodsl + xorl %eax, %edx + loop 1b + + movl %edx, %eax + + popl %ecx + popl %edi + popl %es + popl %ebp +#endif diff --git a/sys/arch/i386/boot/boot.c b/sys/arch/i386/boot/boot.c index b7ce3c6e407f..a67fe269d572 100644 --- a/sys/arch/i386/boot/boot.c +++ b/sys/arch/i386/boot/boot.c @@ -25,7 +25,7 @@ * any improvements or extensions that they make and grant Carnegie Mellon * the rights to redistribute these changes. * - * $Id: boot.c,v 1.19 1994/05/01 06:46:27 cgd Exp $ + * $Id: boot.c,v 1.20 1994/06/13 19:32:07 mycroft Exp $ */ /* @@ -58,6 +58,9 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. struct exec head; int argv[9]; +#ifdef CHECKSUM +int cflag; +#endif char *name; char *names[] = { "/netbsd", "/onetbsd", "/netbsd.old", @@ -139,6 +142,10 @@ loadprog(howto) /********************************************************/ printf("%d", head.a_text); xread(addr, head.a_text); +#ifdef CHECKSUM + if (cflag) + printf("(%x)", cksum(addr, head.a_text)); +#endif addr += head.a_text; /********************************************************/ @@ -154,6 +161,10 @@ loadprog(howto) printf("+%d", head.a_data); xread(addr, head.a_data); +#ifdef CHECKSUM + if (cflag) + printf("(%x)", cksum(addr, head.a_data)); +#endif addr += head.a_data; /********************************************************/ @@ -176,6 +187,10 @@ loadprog(howto) /********************************************************/ printf("+[%d", head.a_syms); xread(addr, head.a_syms); +#ifdef CHECKSUM + if (cflag) + printf("(%x)", cksum(addr, head.a_syms)); +#endif addr += head.a_syms; /********************************************************/ @@ -189,6 +204,10 @@ loadprog(howto) addr += sizeof(int); printf("+%d", i); xread(addr, i); +#ifdef CHECKSUM + if (cflag) + printf("(%x)", cksum(addr, i)); +#endif addr += i; } @@ -203,6 +222,11 @@ loadprog(howto) /********************************************************/ printf("=0x%x\n", addr); +#ifdef CHECKSUM + if (cflag) + return; +#endif + /* * We now pass the various bootstrap parameters to the loaded * image via the argument list @@ -243,6 +267,9 @@ getbootdev(howto) char c, *ptr = namebuf; printf("Boot: [[[%s(%d,%c)]%s][-adrs]] :- ", devs[maj], unit, 'a'+part, name); +#ifdef CHECKSUM + cflag = 0; +#endif if (gets(namebuf)) { while (c = *ptr) { while (c == ' ') @@ -255,6 +282,10 @@ getbootdev(howto) *howto |= RB_ASKNAME; else if (c == 'b') *howto |= RB_HALT; +#ifdef CHECKSUM + else if (c == 'c') + cflag = 1; +#endif else if (c == 'd') *howto |= RB_KDB; else if (c == 'r')