Re: ZFS boot inside on the second partition inside a slice
On Wednesday, June 22, 2011 12:48:43 pm Henri Hennebert wrote: > No error message but a reboot... > > I add: > > loop main.6 # If not last, read another > > mov $msg_debug,%si > call putstr > > mov $MEM_BTX,%si# BTX > > .. > > msg_debug: .asciz "@\r\n" > > I don't get the @ on the console :-( Hmm, so it never exits the loop? > PS - I have to keep a short message otherwise: > > /usr/src/sys/boot/i386/zfsboot/zfsldr.S:322: Error: attempt to move .org > backwards Yeah, it's getting tight. I've commented the LBA printing bits out (so there is more room to play with) and made it print out a "." for each disk sector read: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1:mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -143,32 +134,35 @@ main.4: xor %dx,%dx # Partition:drive * (i.e. after the two vdev labels). We don't have do anything fancy * here to allow for an extra copy of boot1 and a partition table * (compare to this section of the UFS bootstrap) so we just load it - * all at 0x8000. The first part of boot2 is BTX, which wants to run + * all at 0x9000. The first part of boot2 is BTX, which wants to run * at 0x9000. The boot2.bin binary starts right after the end of BTX, * so we have to figure out where the start of it is and then move the - * binary to 0xc000. After we have moved the client, we relocate BTX - * itself to 0x9000 - doing it in this order means that none of the - * memcpy regions overlap which would corrupt the copy. Normally, BTX - * clients start at MEM_USR, or 0xa000, but when we use btxld to - * create zfsboot2, we use an entry point of 0x2000. That entry point is - * relative to MEM_USR; thus boot2.bin starts at 0xc000. + * binary to 0xc000. Normally, BTX clients start at MEM_USR, or 0xa000, + * but when we use btxld to create zfsboot2, we use an entry point of + * 0x2000. That entry point is relative to MEM_USR; thus boot2.bin + * starts at 0xc000. * * The load area and the target area for the client overlap so we have * to use a decrementing string move. We also play segment register * games with the destination address for the move so that the client * can be larger than 16k (which would overflow the zero segment since - * the client starts at 0xc000). Relocating BTX is easy since the load - * area and target area do not overlap. + * the client starts at 0xc000). */ main.5:mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BTX,%bx# Destination buffer +main.6:pushal
Re: ZFS boot inside on the second partition inside a slice
On 06/22/2011 17:58, John Baldwin wrote: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1: mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -143,32 +134,35 @@ main.4: xor %dx,%dx # Partition:drive * (i.e. after the two vdev labels). We don't have do anything fancy * here to allow for an extra copy of boot1 and a partition table * (compare to this section of the UFS bootstrap) so we just load it - * all at 0x8000. The first part of boot2 is BTX, which wants to run + * all at 0x9000. The first part of boot2 is BTX, which wants to run * at 0x9000. The boot2.bin binary starts right after the end of BTX, * so we have to figure out where the start of it is and then move the - * binary to 0xc000. After we have moved the client, we relocate BTX - * itself to 0x9000 - doing it in this order means that none of the - * memcpy regions overlap which would corrupt the copy. Normally, BTX - * clients start at MEM_USR, or 0xa000, but when we use btxld to - * create zfsboot2, we use an entry point of 0x2000. That entry point is - * relative to MEM_USR; thus boot2.bin starts at 0xc000. + * binary to 0xc000. Normally, BTX clients start at MEM_USR, or 0xa000, + * but when we use btxld to create zfsboot2, we use an entry point of + * 0x2000. That entry point is relative to MEM_USR; thus boot2.bin + * starts at 0xc000. * * The load area and the target area for the client overlap so we have * to use a decrementing string move. We also play segment register * games with the destination address for the move so that the client * can be larger than 16k (which would overflow the zero segment since - * the client starts at 0xc000). Relocating BTX is easy since the load - * area and target area do not overlap. + * the client starts at 0xc000). */ main.5: mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BTX,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx# next sector + loop main.6 # If not last, read another + mov $MEM_BTX,%si# BTX mov 0xa(%si),%bx# Get BTX length and set mov $NSECT*SIZ_SEC-1,%di# Size of load area (less one) mov %di,%si # End of load - add $MEM_BUF,%si# area +
Re: ZFS boot inside on the second partition inside a slice
On Wednesday, June 22, 2011 10:23:22 am Henri Hennebert wrote: > On 06/22/2011 16:19, Henri Hennebert wrote: > > This time: > > > > LBA: 3c802308 > > Read error: 04 > > > > This morning I was reading the code (I'm in Belgium) and find that the > > previous LBA output was DAP+4 and so was the addr of the buffer. 0x8200 > > = $MEM_BUF+512, and so we must be in the second read. > > > > OK I think I see, the first read mangle the partition table previously > read at $MEM_BUF and so the next one is wrong. Ahh, very true. I was planning to simplify the code to just load at MEM_BTX directly and avoid copying BTX. I went ahead and did that below: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1:mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -143,32 +134,35 @@ main.4: xor %dx,%dx # Partition:drive * (i.e. after the two vdev labels). We don't have do anything fancy * here to allow for an extra copy of boot1 and a partition table * (compare to this section of the UFS bootstrap) so we just load it - * all at 0x8000. The first part of boot2 is BTX, which wants to run + * all at 0x9000. The first part of boot2 is BTX, which wants to run * at 0x9000. The boot2.bin binary starts right after the end of BTX, * so we have to figure out where the start of it is and then move the - * binary to 0xc000. After we have moved the client, we relocate BTX - * itself to 0x9000 - doing it in this order means that none of the - * memcpy regions overlap which would corrupt the copy. Normally, BTX - * clients start at MEM_USR, or 0xa000, but when we use btxld to - * create zfsboot2, we use an entry point of 0x2000. That entry point is - * relative to MEM_USR; thus boot2.bin starts at 0xc000. + * binary to 0xc000. Normally, BTX clients start at MEM_USR, or 0xa000, + * but when we use btxld to create zfsboot2, we use an entry point of + * 0x2000. That entry point is relative to MEM_USR; thus boot2.bin + * starts at 0xc000. * * The load area and the target area for the client overlap so we have * to use a decrementing string move. We also play segment register * games with the destination address for the move so that the client * can be larger than 16k (which would overflow the zero segment since - * the client starts at 0xc000). Relocating BTX is easy since the load - * area and target area do not overlap. + * the client starts at 0xc000). */ main.5:mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BTX,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk
Re: ZFS boot inside on the second partition inside a slice
On 06/22/2011 16:23, Henri Hennebert wrote: On 06/22/2011 16:19, Henri Hennebert wrote: On 06/22/2011 15:57, John Baldwin wrote: On Wednesday, June 22, 2011 7:34:05 am Henri Hennebert wrote: I get LBA: 8200 Read error: 04 Odd. Oh, I fubar'd and read the wrong thing for the sector. Also, we should leave the EDD packet on the stack so it doesn't get trashed by calling hex8, etc. Please try this: Index: zfsldr.S === --- zfsldr.S (revision 223365) +++ zfsldr.S (working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di # Destination - incb %ch # Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx # Two passes main.1: mov $MEM_BUF+PRT_OFF,%si # Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5: mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6: mov $MEM_BUF,%si # BTX (before reloc) + mov $MEM_BUF,%bx # Destination buffer +main.6: pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx # next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si # BTX (before reloc) mov 0xa(%si),%bx # Get BTX length and set mov $NSECT*SIZ_SEC-1,%di # Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax - int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl - byte - drive to read from - * %dh - byte - num sectors to read * %si - ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es # Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al # blocks to - push %ax # transfer + push %bx # transfer buffer + push $0x1 # Read 1 sector push $0x10 # Size of packet mov %sp,%bp # Packet pointer callw read # Read from disk + jc nread.1 # If error, fail lea 0x10(%bp),%sp # Clear stack - jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + ret # If success, return +nread.1: mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + movl 0x8(%bp),%eax # Format + mov $lba,%di # LBA + call hex32 + mov $msg_lba,%si # Display + call putstr # LBA + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -259,14 +262,6 @@ putstr: lodsb # Get char jne putstr.0 # No /* - * Overused return code. ereturn is used to return an error from the - * read function. Since we assume putstr succeeds, we (ab)use the - * same code when we return from putstr. - */ -ereturn: movb $0x1,%ah # Invalid - stc # argument -return: retw # To caller -/* * Reads sectors from the disk. If EDD is enabled, then check if it is * installed and use it if it is. If it is not installed or not enabled, then * fall back to using CHS. Since we use a LBA, if we are using CHS, we have to @@ -294,14 +289,38 @@ read: cmpb $0x80,%dl # Hard drive? retw # To caller read.1: mov $msg_chs,%si jmp error -msg_chs: .asciz "CHS not supported" +/* + * Convert EAX, AX, or AL to hex, saving the result to [EDI]. + */ +hex32: pushl %eax # Save + shrl $0x10,%eax # Do upper + call hex16 # 16 + popl %eax # Restore +hex16: call hex16.1 # Do upper 8 +hex16.1: xchgb %ah,%al # Save/restore +hex8: push %ax # Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1: andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char
Re: ZFS boot inside on the second partition inside a slice
On 06/22/2011 15:57, John Baldwin wrote: On Wednesday, June 22, 2011 7:34:05 am Henri Hennebert wrote: I get LBA: 8200 Read error: 04 Odd. Oh, I fubar'd and read the wrong thing for the sector. Also, we should leave the EDD packet on the stack so it doesn't get trashed by calling hex8, etc. Please try this: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1: mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5: mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BUF,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx# next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si# BTX (before reloc) mov 0xa(%si),%bx# Get BTX length and set mov $NSECT*SIZ_SEC-1,%di# Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax - int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl- byte- drive to read from - * %dh - byte- num sectors to read * %si- ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es# Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al# blocks to - push %ax# transfer + push %bx# transfer buffer + push $0x1 # Read 1 sector push $0x10
Re: ZFS boot inside on the second partition inside a slice
On 06/22/2011 16:19, Henri Hennebert wrote: On 06/22/2011 15:57, John Baldwin wrote: On Wednesday, June 22, 2011 7:34:05 am Henri Hennebert wrote: I get LBA: 8200 Read error: 04 Odd. Oh, I fubar'd and read the wrong thing for the sector. Also, we should leave the EDD packet on the stack so it doesn't get trashed by calling hex8, etc. Please try this: Index: zfsldr.S === --- zfsldr.S (revision 223365) +++ zfsldr.S (working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di # Destination - incb %ch # Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx # Two passes main.1: mov $MEM_BUF+PRT_OFF,%si # Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5: mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6: mov $MEM_BUF,%si # BTX (before reloc) + mov $MEM_BUF,%bx # Destination buffer +main.6: pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx # next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si # BTX (before reloc) mov 0xa(%si),%bx # Get BTX length and set mov $NSECT*SIZ_SEC-1,%di # Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax - int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl - byte - drive to read from - * %dh - byte - num sectors to read * %si - ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es # Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al # blocks to - push %ax # transfer + push %bx # transfer buffer + push $0x1 # Read 1 sector push $0x10 # Size of packet mov %sp,%bp # Packet pointer callw read # Read from disk + jc nread.1 # If error, fail lea 0x10(%bp),%sp # Clear stack - jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + ret # If success, return +nread.1: mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + movl 0x8(%bp),%eax # Format + mov $lba,%di # LBA + call hex32 + mov $msg_lba,%si # Display + call putstr # LBA + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -259,14 +262,6 @@ putstr: lodsb # Get char jne putstr.0 # No /* - * Overused return code. ereturn is used to return an error from the - * read function. Since we assume putstr succeeds, we (ab)use the - * same code when we return from putstr. - */ -ereturn: movb $0x1,%ah # Invalid - stc # argument -return: retw # To caller -/* * Reads sectors from the disk. If EDD is enabled, then check if it is * installed and use it if it is. If it is not installed or not enabled, then * fall back to using CHS. Since we use a LBA, if we are using CHS, we have to @@ -294,14 +289,38 @@ read: cmpb $0x80,%dl # Hard drive? retw # To caller read.1: mov $msg_chs,%si jmp error -msg_chs: .asciz "CHS not supported" +/* + * Convert EAX, AX, or AL to hex, saving the result to [EDI]. + */ +hex32: pushl %eax # Save + shrl $0x10,%eax # Do upper + call hex16 # 16 + popl %eax # Restore +hex16: call hex16.1 # Do upper 8 +hex16.1: xchgb %ah,%al # Save/restore +hex8: push %ax # Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1: andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + /* Messages */ -msg_r
Re: ZFS boot inside on the second partition inside a slice
On Wednesday, June 22, 2011 7:34:05 am Henri Hennebert wrote: > I get > > LBA: 8200 > Read error: 04 Odd. Oh, I fubar'd and read the wrong thing for the sector. Also, we should leave the EDD packet on the stack so it doesn't get trashed by calling hex8, etc. Please try this: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1:mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5:mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BUF,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx# next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si# BTX (before reloc) mov 0xa(%si),%bx# Get BTX length and set mov $NSECT*SIZ_SEC-1,%di# Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax- int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl - byte- drive to read from - * %dh - byte- num sectors to read * %si - ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es# Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al# blocks to - push %ax# transfer + push %bx# transfer buffer + push $0x1 # Read 1 sector push $0x10 # Size of packet mov %sp,%bp
Re: ZFS boot inside on the second partition inside a slice
On 06/21/2011 23:27, John Baldwin wrote: On Tuesday, June 21, 2011 4:13:20 pm Henri Hennebert wrote: On 06/21/2011 21:25, John Baldwin wrote: and I get: Read error: 04 Hmm, that is the error for an invalid sector. Try this patch. It reshuffles a few more things and adds code to dump the low 32-bits of the LBA on an error: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1: mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5: mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BUF,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx# next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si# BTX (before reloc) mov 0xa(%si),%bx# Get BTX length and set mov $NSECT*SIZ_SEC-1,%di# Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax - int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl- byte- drive to read from - * %dh - byte- num sectors to read * %si- ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es# Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al# blocks to - push %ax# transfer + push %bx# transfer buffer + push $0x1 # Read 1 sector push $0
Re: ZFS boot inside on the second partition inside a slice
On Tuesday, June 21, 2011 4:13:20 pm Henri Hennebert wrote: > On 06/21/2011 21:25, John Baldwin wrote: > and I get: > > Read error: 04 Hmm, that is the error for an invalid sector. Try this patch. It reshuffles a few more things and adds code to dump the low 32-bits of the LBA on an error: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,18 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax # Read MBR + movw $MEM_BUF,%bx # from first + callw nread # sector mov $0x1,%cx# Two passes main.1:mov $MEM_BUF+PRT_OFF,%si# Partition table movb $0x1,%dh # Partition @@ -161,10 +152,16 @@ main.4: xor %dx,%dx # Partition:drive * area and target area do not overlap. */ main.5:mov %dx,MEM_ARG # Save args - movb $NSECT,%dh # Sector count + mov $NSECT,%cx # Sector count movl $1024,%eax # Offset to boot2 - callw nread.1 # Read disk -main.6:mov $MEM_BUF,%si# BTX (before reloc) + mov $MEM_BUF,%bx# Destination buffer +main.6:pushal # Save params + callw nread # Read disk + popal # Restore + incl %eax # Update for + add $SIZ_SEC,%bx# next sector + loop main.6 # If not last, read another + mov $MEM_BUF,%si# BTX (before reloc) mov 0xa(%si),%bx# Get BTX length and set mov $NSECT*SIZ_SEC-1,%di# Size of load area (less one) mov %di,%si # End of load @@ -214,29 +211,35 @@ seta20.3: sti # Enable interrupts * packet on the stack and passes it to read. * * %eax- int - LBA to read in relative to partition start + * %es:%bx - ptr - destination address * %dl - byte- drive to read from - * %dh - byte- num sectors to read * %si - ptr - MBR partition entry */ -nread: xor %eax,%eax # Sector offset in partition -nread.1: xor %ecx,%ecx # Get +nread: xor %ecx,%ecx # Get addl 0x8(%si),%eax # LBA adc $0,%ecx pushl %ecx # Starting absolute block pushl %eax # block number push %es# Address of - push $MEM_BUF # transfer buffer - xor %ax,%ax # Number of - movb %dh,%al# blocks to - push %ax# transfer + push %bx# transfer buffer + push $0x1 # Read 1 sector push $0x10 # Size of packet mov %sp,
Re: ZFS boot inside on the second partition inside a slice
On 06/21/2011 21:25, John Baldwin wrote: On Tuesday, June 21, 2011 3:02:28 pm Henri Hennebert wrote: On 06/21/2011 19:51, John Baldwin wrote: On Tuesday, June 21, 2011 12:15:58 pm Henri Hennebert wrote: On 06/21/2011 17:55, John Baldwin wrote: On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: On 06/21/2011 15:01, John Baldwin wrote: Index: zfsldr.S === --- zfsldr.S(revision 223339) +++ zfsldr.S(working copy) @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get callw read # Read from disk lea 0x10(%bp),%sp # Clear stack jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si jmp error msg_chs: .asciz "CHS not supported" +/* + * Convert AL to hex, saving the result to [EDI]. + */ +hex8: push %ax# Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1:andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + /* Messages */ -msg_read: .asciz "Read" -msg_part: .asciz "Boot" +msg_read: .ascii "Read error: " +read_err: .asciz "XX" +msg_part: .asciz "Boot error" -prompt:.asciz " error\r\n" +prompt:.asciz "\r\n" .org PRT_OFF,0x90 I get Read error: 01 Hmm, that would be 'invalid parameter'. Can you add a 'foo: jmp foo' infinite loop and move it around to figure out which read call is failing? main.5: mov %dx,MEM_ARG # Save args movb $NSECT,%dh # Sector count movl $1024,%eax # Offset to boot2 callw nread.1 # Read disk foo:jmp foo After this one I get 'Read error: 01' Hmm, ok. NSECT changed in the MFC (it is now larger). Try this patch. It changes the code to read zfsboot in one sector at a time: I encounter 2 problems - see in you patch Henri Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,19 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh
Re: ZFS boot inside on the second partition inside a slice
On Tuesday, June 21, 2011 3:02:28 pm Henri Hennebert wrote: > On 06/21/2011 19:51, John Baldwin wrote: > > On Tuesday, June 21, 2011 12:15:58 pm Henri Hennebert wrote: > >> On 06/21/2011 17:55, John Baldwin wrote: > >>> On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: > On 06/21/2011 15:01, John Baldwin wrote: > > Index: zfsldr.S > > === > > --- zfsldr.S(revision 223339) > > +++ zfsldr.S(working copy) > > @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get > > callw read # Read from disk > > lea 0x10(%bp),%sp # Clear stack > > jnc return # If success, return > > - mov $msg_read,%si # Otherwise, set the > > error > > - # message and fall > > through to > > - # the error routine > > + mov %ah,%al # Format > > + mov $read_err,%di # error > > + call hex8 # code > > + mov $msg_read,%si # Set the error message > > and > > + # fall through to the > > error > > + # routine > > /* > > * Print out the error message pointed to by %ds:(%si) followed > > * by a prompt, wait for a keypress, and then reboot the machine. > > @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si > > jmp error > > msg_chs:.asciz "CHS not supported" > > > > +/* > > + * Convert AL to hex, saving the result to [EDI]. > > + */ > > +hex8: push %ax# Save > > + shrb $0x4,%al # Do upper > > + call hex8.1 # 4 > > + pop %ax # Restore > > +hex8.1:andb $0xf,%al # Get lower 4 > > + cmpb $0xa,%al # Convert > > + sbbb $0x69,%al # to hex > > + das # digit > > + orb $0x20,%al # To lower case > > + stosb # Save char > > + ret # (Recursive) > > + > > /* Messages */ > > > > -msg_read: .asciz "Read" > > -msg_part: .asciz "Boot" > > +msg_read: .ascii "Read error: " > > +read_err: .asciz "XX" > > +msg_part: .asciz "Boot error" > > > > -prompt:.asciz " error\r\n" > > +prompt:.asciz "\r\n" > > > > .org PRT_OFF,0x90 > > > I get > > Read error: 01 > >>> > >>> Hmm, that would be 'invalid parameter'. > >>> > >>> Can you add a 'foo: jmp foo' infinite loop and move it around to figure > > out > >>> which read call is failing? > >>> > >> main.5: mov %dx,MEM_ARG # Save args > >> movb $NSECT,%dh # Sector count > >> movl $1024,%eax # Offset to boot2 > >> callw nread.1 # Read disk > >> > >> foo:jmp foo > >> > >> After this one I get > >> > >> 'Read error: 01' > > > > Hmm, ok. NSECT changed in the MFC (it is now larger). Try this patch. It > > changes the code to read zfsboot in one sector at a time: > > > > I encounter 2 problems - see in you patch > > Henri > > > > Index: zfsldr.S > > === > > --- zfsldr.S(revision 223365) > > +++ zfsldr.S(working copy) > > @@ -16,7 +16,6 @@ > >*/ > > > > /* Memory Locations */ > > - .set MEM_REL,0x700 # Relocation address > > .set MEM_ARG,0x900 # Arguments > > .set MEM_ORG,0x7c00 # Origin > > .set MEM_BUF,0x8000 # Load area > > @@ -91,26 +90,19 @@ main: cld # > > String ops inc > > mov %cx,%ss # Set up > > mov $start,%sp # stack > > /* > > - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets > > - * %cx == 0x100. > > - */ > > - mov %sp,%si # Source > > - mov $MEM_REL,%di# Destination > > - incb %ch# Word count > > - rep # Copy > > - movsw # code > > -/* > >* If we are on a hard
Re: ZFS boot inside on the second partition inside a slice
On 06/21/2011 19:51, John Baldwin wrote: On Tuesday, June 21, 2011 12:15:58 pm Henri Hennebert wrote: On 06/21/2011 17:55, John Baldwin wrote: On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: On 06/21/2011 15:01, John Baldwin wrote: Index: zfsldr.S === --- zfsldr.S(revision 223339) +++ zfsldr.S(working copy) @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get callw read # Read from disk lea 0x10(%bp),%sp # Clear stack jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si jmp error msg_chs:.asciz "CHS not supported" +/* + * Convert AL to hex, saving the result to [EDI]. + */ +hex8: push %ax# Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1:andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + /* Messages */ -msg_read: .asciz "Read" -msg_part: .asciz "Boot" +msg_read: .ascii "Read error: " +read_err: .asciz "XX" +msg_part: .asciz "Boot error" -prompt:.asciz " error\r\n" +prompt:.asciz "\r\n" .org PRT_OFF,0x90 I get Read error: 01 Hmm, that would be 'invalid parameter'. Can you add a 'foo: jmp foo' infinite loop and move it around to figure out which read call is failing? main.5: mov %dx,MEM_ARG # Save args movb $NSECT,%dh # Sector count movl $1024,%eax # Offset to boot2 callw nread.1 # Read disk foo:jmp foo After this one I get 'Read error: 01' Hmm, ok. NSECT changed in the MFC (it is now larger). Try this patch. It changes the code to read zfsboot in one sector at a time: I encounter 2 problems - see in you patch Henri Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,19 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No - movb $0x1,%dh # Block count - callw nread # Read MBR + xor %eax,%eax
Re: ZFS boot inside on the second partition inside a slice
On Tuesday, June 21, 2011 12:15:58 pm Henri Hennebert wrote: > On 06/21/2011 17:55, John Baldwin wrote: > > On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: > >> On 06/21/2011 15:01, John Baldwin wrote: > >>> Index: zfsldr.S > >>> === > >>> --- zfsldr.S (revision 223339) > >>> +++ zfsldr.S (working copy) > >>> @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get > >>> callw read # Read from disk > >>> lea 0x10(%bp),%sp # Clear stack > >>> jnc return # If success, return > >>> - mov $msg_read,%si # Otherwise, set the error > >>> - # message and fall through to > >>> - # the error routine > >>> + mov %ah,%al # Format > >>> + mov $read_err,%di # error > >>> + call hex8 # code > >>> + mov $msg_read,%si # Set the error message and > >>> + # fall through to the error > >>> + # routine > >>>/* > >>> * Print out the error message pointed to by %ds:(%si) followed > >>> * by a prompt, wait for a keypress, and then reboot the machine. > >>> @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si > >>> jmp error > >>>msg_chs: .asciz "CHS not supported" > >>> > >>> +/* > >>> + * Convert AL to hex, saving the result to [EDI]. > >>> + */ > >>> +hex8:push %ax# Save > >>> + shrb $0x4,%al # Do upper > >>> + call hex8.1 # 4 > >>> + pop %ax # Restore > >>> +hex8.1: andb $0xf,%al # Get lower 4 > >>> + cmpb $0xa,%al # Convert > >>> + sbbb $0x69,%al # to hex > >>> + das # digit > >>> + orb $0x20,%al # To lower case > >>> + stosb # Save char > >>> + ret # (Recursive) > >>> + > >>>/* Messages */ > >>> > >>> -msg_read:.asciz "Read" > >>> -msg_part:.asciz "Boot" > >>> +msg_read:.ascii "Read error: " > >>> +read_err:.asciz "XX" > >>> +msg_part:.asciz "Boot error" > >>> > >>> -prompt: .asciz " error\r\n" > >>> +prompt: .asciz "\r\n" > >>> > >>> .org PRT_OFF,0x90 > >>> > >> I get > >> > >> Read error: 01 > > > > Hmm, that would be 'invalid parameter'. > > > > Can you add a 'foo: jmp foo' infinite loop and move it around to figure out > > which read call is failing? > > > main.5: mov %dx,MEM_ARG # Save args > movb $NSECT,%dh # Sector count > movl $1024,%eax # Offset to boot2 > callw nread.1 # Read disk > > foo:jmp foo > > After this one I get > > 'Read error: 01' Hmm, ok. NSECT changed in the MFC (it is now larger). Try this patch. It changes the code to read zfsboot in one sector at a time: Index: zfsldr.S === --- zfsldr.S(revision 223365) +++ zfsldr.S(working copy) @@ -16,7 +16,6 @@ */ /* Memory Locations */ - .set MEM_REL,0x700 # Relocation address .set MEM_ARG,0x900 # Arguments .set MEM_ORG,0x7c00 # Origin .set MEM_BUF,0x8000 # Load area @@ -91,26 +90,19 @@ main: cld # String ops inc mov %cx,%ss # Set up mov $start,%sp # stack /* - * Relocate ourself to MEM_REL. Since %cx == 0, the inc %ch sets - * %cx == 0x100. - */ - mov %sp,%si # Source - mov $MEM_REL,%di# Destination - incb %ch# Word count - rep # Copy - movsw # code -/* * If we are on a hard drive, then load the MBR and look for the first * FreeBSD slice. We use the fake partition entry below that points to * the MBR when we call nread. The first pass looks for the first active * FreeBSD slice. The second pass looks for the first non-active FreeBSD * slice if the first one fails. */ - mov $part4,%si # Partition + mov $part4,%si # Dummy partition cmpb $0x80,%dl # Hard drive? jb main.4 # No
Re: ZFS boot inside on the second partition inside a slice
On 06/21/2011 17:55, John Baldwin wrote: On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: On 06/21/2011 15:01, John Baldwin wrote: Index: zfsldr.S === --- zfsldr.S(revision 223339) +++ zfsldr.S(working copy) @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get callw read # Read from disk lea 0x10(%bp),%sp # Clear stack jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si jmp error msg_chs: .asciz "CHS not supported" +/* + * Convert AL to hex, saving the result to [EDI]. + */ +hex8: push %ax# Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1:andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + /* Messages */ -msg_read: .asciz "Read" -msg_part: .asciz "Boot" +msg_read: .ascii "Read error: " +read_err: .asciz "XX" +msg_part: .asciz "Boot error" -prompt:.asciz " error\r\n" +prompt:.asciz "\r\n" .org PRT_OFF,0x90 I get Read error: 01 Hmm, that would be 'invalid parameter'. Can you add a 'foo: jmp foo' infinite loop and move it around to figure out which read call is failing? main.5: mov %dx,MEM_ARG # Save args movb $NSECT,%dh # Sector count movl $1024,%eax # Offset to boot2 callw nread.1 # Read disk foo:jmp foo After this one I get 'Read error: 01' Henri ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Tuesday, June 21, 2011 10:50:14 am Henri Hennebert wrote: > On 06/21/2011 15:01, John Baldwin wrote: > > Index: zfsldr.S > > === > > --- zfsldr.S(revision 223339) > > +++ zfsldr.S(working copy) > > @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get > > callw read # Read from disk > > lea 0x10(%bp),%sp # Clear stack > > jnc return # If success, return > > - mov $msg_read,%si # Otherwise, set the error > > - # message and fall through to > > - # the error routine > > + mov %ah,%al # Format > > + mov $read_err,%di # error > > + call hex8 # code > > + mov $msg_read,%si # Set the error message and > > + # fall through to the error > > + # routine > > /* > >* Print out the error message pointed to by %ds:(%si) followed > >* by a prompt, wait for a keypress, and then reboot the machine. > > @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si > > jmp error > > msg_chs: .asciz "CHS not supported" > > > > +/* > > + * Convert AL to hex, saving the result to [EDI]. > > + */ > > +hex8: push %ax# Save > > + shrb $0x4,%al # Do upper > > + call hex8.1 # 4 > > + pop %ax # Restore > > +hex8.1:andb $0xf,%al # Get lower 4 > > + cmpb $0xa,%al # Convert > > + sbbb $0x69,%al # to hex > > + das # digit > > + orb $0x20,%al # To lower case > > + stosb # Save char > > + ret # (Recursive) > > + > > /* Messages */ > > > > -msg_read: .asciz "Read" > > -msg_part: .asciz "Boot" > > +msg_read: .ascii "Read error: " > > +read_err: .asciz "XX" > > +msg_part: .asciz "Boot error" > > > > -prompt:.asciz " error\r\n" > > +prompt:.asciz "\r\n" > > > > .org PRT_OFF,0x90 > > > I get > > Read error: 01 Hmm, that would be 'invalid parameter'. Can you add a 'foo: jmp foo' infinite loop and move it around to figure out which read call is failing? -- John Baldwin ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On 06/21/2011 15:01, John Baldwin wrote: Index: zfsldr.S === --- zfsldr.S(revision 223339) +++ zfsldr.S(working copy) @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get callw read # Read from disk lea 0x10(%bp),%sp # Clear stack jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si jmp error msg_chs: .asciz "CHS not supported" +/* + * Convert AL to hex, saving the result to [EDI]. + */ +hex8: push %ax# Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1:andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb $0x69,%al # to hex + das # digit + orb $0x20,%al # To lower case + stosb # Save char + ret # (Recursive) + /* Messages */ -msg_read: .asciz "Read" -msg_part: .asciz "Boot" +msg_read: .ascii "Read error: " +read_err: .asciz "XX" +msg_part: .asciz "Boot error" -prompt:.asciz " error\r\n" +prompt:.asciz "\r\n" .org PRT_OFF,0x90 I get Read error: 01 Henri ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Tuesday, June 21, 2011 5:51:22 am Henri Hennebert wrote: > On 06/20/2011 15:51, John Baldwin wrote: > > On Saturday, June 18, 2011 5:04:07 am Henri Hennebert wrote: > >> On 06/17/2011 19:37, John Baldwin wrote: > >>> On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: > On 06/16/2011 19:35, John Baldwin wrote: > > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: > >> Exactly. The MFCed ZFSv28 is different from any patch maintained by > >> mm@. Maybe some untested changes involved. > > > > Can you try reverting this change: > > > > Author: jhb > > Date: Thu Apr 28 17:44:24 2011 > > New Revision: 221177 > > URL: http://svn.freebsd.org/changeset/base/221177 > > > > Log: > > Due to space constraints, the UFS boot2 and boot1 use an evil hack where > > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks > > do not have the same space constraints, so remove this hack for ZFS. > > While here, remove commented out code to support C/H/S addressing from > > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. > > > > MFC after:2 weeks > > > > Modified: > > head/sys/boot/i386/boot2/Makefile > > head/sys/boot/i386/common/drv.c > > head/sys/boot/i386/zfsboot/Makefile > > head/sys/boot/i386/zfsboot/zfsldr.S > > > I try with this revision (221177) reverted to no avail: > same error - 'read error' > >>> > >>> Hmm, ok. No other ideas off the top of my head. > >>> > >> I make the same test under virtualbox and get: > >> > >> A critical error has occurred while running the virtual machine and the > >> machine execution has been stopped. > >> > >> I attach VBox.log. > >> > >> PS - the message 'ZFS: supported version 28' comes from my patch: > >> > >> Index: sys/boot/zfs/zfsimpl.c > >> === > >> --- sys/boot/zfs/zfsimpl.c (revision 212549) > >> +++ sys/boot/zfs/zfsimpl.c (working copy) > >> @@ -61,6 +61,8 @@ > >>STAILQ_INIT(&zfs_vdevs); > >>STAILQ_INIT(&zfs_pools); > >> > >> + printf("ZFS: supported version %u\n", (unsigned) SPA_VERSION); > >> + > >>zfs_temp_buf = malloc(TEMP_SIZE); > >>zfs_temp_end = zfs_temp_buf + TEMP_SIZE; > >>zfs_temp_ptr = zfs_temp_buf; > > > > Hmm, can you add printfs and narrow down where the hang happens (or which > > reads are failing)? The VBOX log seems to make no sense. It shows the > > CPU trying to call into the BIOS from within protected mode in the loader > > but that shouldn't ever happen (note a cs of 0x2b (which is the loader's > > %cs selector) but an eip that looks like a cs:ip of a BIOS routine). > > > I just try to put printf but I get only 'Read error' without any of my > printf. > > Previously event my printf in zfs_init don't show up on the console of > my netbook. Under VBox it was printed. > > Maybe printf is not allowed so soon in zfsboot ? Rather, it may be that zfsldr.S is what is emitting 'Read error' and you are not getting into the zfsboot.c code itself. You can try this patch which should display the error code the BIOS returns when it fails: Index: zfsldr.S === --- zfsldr.S(revision 223339) +++ zfsldr.S(working copy) @@ -234,9 +234,12 @@ nread.1: xor %ecx,%ecx # Get callw read # Read from disk lea 0x10(%bp),%sp # Clear stack jnc return # If success, return - mov $msg_read,%si # Otherwise, set the error - # message and fall through to - # the error routine + mov %ah,%al # Format + mov $read_err,%di # error + call hex8 # code + mov $msg_read,%si # Set the error message and + # fall through to the error + # routine /* * Print out the error message pointed to by %ds:(%si) followed * by a prompt, wait for a keypress, and then reboot the machine. @@ -296,12 +299,28 @@ read.1: mov $msg_chs,%si jmp error msg_chs: .asciz "CHS not supported" +/* + * Convert AL to hex, saving the result to [EDI]. + */ +hex8: push %ax# Save + shrb $0x4,%al # Do upper + call hex8.1 # 4 + pop %ax # Restore +hex8.1:andb $0xf,%al # Get lower 4 + cmpb $0xa,%al # Convert + sbbb
Re: ZFS boot inside on the second partition inside a slice
On 06/20/2011 15:51, John Baldwin wrote: On Saturday, June 18, 2011 5:04:07 am Henri Hennebert wrote: On 06/17/2011 19:37, John Baldwin wrote: On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: On 06/16/2011 19:35, John Baldwin wrote: On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: Exactly. The MFCed ZFSv28 is different from any patch maintained by mm@. Maybe some untested changes involved. Can you try reverting this change: Author: jhb Date: Thu Apr 28 17:44:24 2011 New Revision: 221177 URL: http://svn.freebsd.org/changeset/base/221177 Log: Due to space constraints, the UFS boot2 and boot1 use an evil hack where boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks do not have the same space constraints, so remove this hack for ZFS. While here, remove commented out code to support C/H/S addressing from zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. MFC after:2 weeks Modified: head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/common/drv.c head/sys/boot/i386/zfsboot/Makefile head/sys/boot/i386/zfsboot/zfsldr.S I try with this revision (221177) reverted to no avail: same error - 'read error' Hmm, ok. No other ideas off the top of my head. I make the same test under virtualbox and get: A critical error has occurred while running the virtual machine and the machine execution has been stopped. I attach VBox.log. PS - the message 'ZFS: supported version 28' comes from my patch: Index: sys/boot/zfs/zfsimpl.c === --- sys/boot/zfs/zfsimpl.c (revision 212549) +++ sys/boot/zfs/zfsimpl.c (working copy) @@ -61,6 +61,8 @@ STAILQ_INIT(&zfs_vdevs); STAILQ_INIT(&zfs_pools); + printf("ZFS: supported version %u\n", (unsigned) SPA_VERSION); + zfs_temp_buf = malloc(TEMP_SIZE); zfs_temp_end = zfs_temp_buf + TEMP_SIZE; zfs_temp_ptr = zfs_temp_buf; Hmm, can you add printfs and narrow down where the hang happens (or which reads are failing)? The VBOX log seems to make no sense. It shows the CPU trying to call into the BIOS from within protected mode in the loader but that shouldn't ever happen (note a cs of 0x2b (which is the loader's %cs selector) but an eip that looks like a cs:ip of a BIOS routine). I just try to put printf but I get only 'Read error' without any of my printf. Previously event my printf in zfs_init don't show up on the console of my netbook. Under VBox it was printed. Maybe printf is not allowed so soon in zfsboot ? For the record, I write the bootcode with this 2 commands after booting with mfsbsd (from mm@) and fetching zfsboot in /tmp: dd if=/tmp/zfsboot of=/dev/ad0s2a bs=512 count=1 dd if=/tmp/zfsboot of=/dev/ad0s2a bs=512 skip=1 seek=1024 My debugging patch in zfsboot.c: [root@morzine zfsboot]# svn diff zfsboot.c Index: zfsboot.c === --- zfsboot.c (revision 223081) +++ zfsboot.c (working copy) @@ -447,10 +447,16 @@ off_t off; struct dsk *dsk; + printf("==>trying to boot\n"); + dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x1) - __base); + printf("==>about to call bios_getmem()\n"); + bios_getmem(); + printf("==>bios_getmem() completed\n"); + if (high_heap_size > 0) { heap_end = PTOV(high_heap_base + high_heap_size); heap_next = PTOV(high_heap_base); @@ -482,6 +488,8 @@ autoboot = 1; + printf("==>about to call zfs_init()\n"); + zfs_init(); /* Henri ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
I finally redo everything with GPT-based solution. At the same time, I found a problem with zpool.cache and I fixed with: http://forums.freebsd.org/showthread.php?t=4185 zpool.cache will be changed after you exported the zpool... Anyway, now I'm OK with my freebsd-only box, again. On Fri, Jun 17, 2011 at 9:18 PM, Zhihao Yuan wrote: > If this problem can not be solved, I probably have to redo everything > to use GPT-based solution and lose my Windows. > > On Fri, Jun 17, 2011 at 12:37 PM, John Baldwin wrote: >> On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: >>> On 06/16/2011 19:35, John Baldwin wrote: >>> > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: >>> >> Exactly. The MFCed ZFSv28 is different from any patch maintained by >>> >> mm@. Maybe some untested changes involved. >>> > >>> > Can you try reverting this change: >>> > >>> > Author: jhb >>> > Date: Thu Apr 28 17:44:24 2011 >>> > New Revision: 221177 >>> > URL: http://svn.freebsd.org/changeset/base/221177 >>> > >>> > Log: >>> > Due to space constraints, the UFS boot2 and boot1 use an evil hack where >>> > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot >>> > blocks >>> > do not have the same space constraints, so remove this hack for ZFS. >>> > While here, remove commented out code to support C/H/S addressing from >>> > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. >>> > >>> > MFC after: 2 weeks >>> > >>> > Modified: >>> > head/sys/boot/i386/boot2/Makefile >>> > head/sys/boot/i386/common/drv.c >>> > head/sys/boot/i386/zfsboot/Makefile >>> > head/sys/boot/i386/zfsboot/zfsldr.S >>> > >>> I try with this revision (221177) reverted to no avail: >>> same error - 'read error' >> >> Hmm, ok. No other ideas off the top of my head. >> >> -- >> John Baldwin >> > > > > -- > Zhihao Yuan, nickname lichray > The best way to predict the future is to invent it. > ___ > 4BSD -- http://4bsd.biz/ > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Saturday, June 18, 2011 5:04:07 am Henri Hennebert wrote: > On 06/17/2011 19:37, John Baldwin wrote: > > On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: > >> On 06/16/2011 19:35, John Baldwin wrote: > >>> On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: > Exactly. The MFCed ZFSv28 is different from any patch maintained by > mm@. Maybe some untested changes involved. > >>> > >>> Can you try reverting this change: > >>> > >>> Author: jhb > >>> Date: Thu Apr 28 17:44:24 2011 > >>> New Revision: 221177 > >>> URL: http://svn.freebsd.org/changeset/base/221177 > >>> > >>> Log: > >>>Due to space constraints, the UFS boot2 and boot1 use an evil hack > >>> where > >>>boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot > >>> blocks > >>>do not have the same space constraints, so remove this hack for ZFS. > >>>While here, remove commented out code to support C/H/S addressing from > >>>zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. > >>> > >>>MFC after:2 weeks > >>> > >>> Modified: > >>>head/sys/boot/i386/boot2/Makefile > >>>head/sys/boot/i386/common/drv.c > >>>head/sys/boot/i386/zfsboot/Makefile > >>>head/sys/boot/i386/zfsboot/zfsldr.S > >>> > >> I try with this revision (221177) reverted to no avail: > >> same error - 'read error' > > > > Hmm, ok. No other ideas off the top of my head. > > > I make the same test under virtualbox and get: > > A critical error has occurred while running the virtual machine and the > machine execution has been stopped. > > I attach VBox.log. > > PS - the message 'ZFS: supported version 28' comes from my patch: > > Index: sys/boot/zfs/zfsimpl.c > === > --- sys/boot/zfs/zfsimpl.c(revision 212549) > +++ sys/boot/zfs/zfsimpl.c(working copy) > @@ -61,6 +61,8 @@ > STAILQ_INIT(&zfs_vdevs); > STAILQ_INIT(&zfs_pools); > > + printf("ZFS: supported version %u\n", (unsigned) SPA_VERSION); > + > zfs_temp_buf = malloc(TEMP_SIZE); > zfs_temp_end = zfs_temp_buf + TEMP_SIZE; > zfs_temp_ptr = zfs_temp_buf; Hmm, can you add printfs and narrow down where the hang happens (or which reads are failing)? The VBOX log seems to make no sense. It shows the CPU trying to call into the BIOS from within protected mode in the loader but that shouldn't ever happen (note a cs of 0x2b (which is the loader's %cs selector) but an eip that looks like a cs:ip of a BIOS routine). -- John Baldwin ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
If this problem can not be solved, I probably have to redo everything to use GPT-based solution and lose my Windows. On Fri, Jun 17, 2011 at 12:37 PM, John Baldwin wrote: > On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: >> On 06/16/2011 19:35, John Baldwin wrote: >> > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: >> >> Exactly. The MFCed ZFSv28 is different from any patch maintained by >> >> mm@. Maybe some untested changes involved. >> > >> > Can you try reverting this change: >> > >> > Author: jhb >> > Date: Thu Apr 28 17:44:24 2011 >> > New Revision: 221177 >> > URL: http://svn.freebsd.org/changeset/base/221177 >> > >> > Log: >> > Due to space constraints, the UFS boot2 and boot1 use an evil hack where >> > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot >> > blocks >> > do not have the same space constraints, so remove this hack for ZFS. >> > While here, remove commented out code to support C/H/S addressing from >> > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. >> > >> > MFC after: 2 weeks >> > >> > Modified: >> > head/sys/boot/i386/boot2/Makefile >> > head/sys/boot/i386/common/drv.c >> > head/sys/boot/i386/zfsboot/Makefile >> > head/sys/boot/i386/zfsboot/zfsldr.S >> > >> I try with this revision (221177) reverted to no avail: >> same error - 'read error' > > Hmm, ok. No other ideas off the top of my head. > > -- > John Baldwin > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Friday, June 17, 2011 1:06:22 pm Henri Hennebert wrote: > On 06/16/2011 19:35, John Baldwin wrote: > > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: > >> Exactly. The MFCed ZFSv28 is different from any patch maintained by > >> mm@. Maybe some untested changes involved. > > > > Can you try reverting this change: > > > > Author: jhb > > Date: Thu Apr 28 17:44:24 2011 > > New Revision: 221177 > > URL: http://svn.freebsd.org/changeset/base/221177 > > > > Log: > > Due to space constraints, the UFS boot2 and boot1 use an evil hack where > > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot > > blocks > > do not have the same space constraints, so remove this hack for ZFS. > > While here, remove commented out code to support C/H/S addressing from > > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. > > > > MFC after:2 weeks > > > > Modified: > > head/sys/boot/i386/boot2/Makefile > > head/sys/boot/i386/common/drv.c > > head/sys/boot/i386/zfsboot/Makefile > > head/sys/boot/i386/zfsboot/zfsldr.S > > > I try with this revision (221177) reverted to no avail: > same error - 'read error' Hmm, ok. No other ideas off the top of my head. -- John Baldwin ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On 06/16/2011 19:35, John Baldwin wrote: > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: >> Exactly. The MFCed ZFSv28 is different from any patch maintained by >> mm@. Maybe some untested changes involved. > > Can you try reverting this change: > > Author: jhb > Date: Thu Apr 28 17:44:24 2011 > New Revision: 221177 > URL: http://svn.freebsd.org/changeset/base/221177 > > Log: > Due to space constraints, the UFS boot2 and boot1 use an evil hack where > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks > do not have the same space constraints, so remove this hack for ZFS. > While here, remove commented out code to support C/H/S addressing from > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. > > MFC after:2 weeks > > Modified: > head/sys/boot/i386/boot2/Makefile > head/sys/boot/i386/common/drv.c > head/sys/boot/i386/zfsboot/Makefile > head/sys/boot/i386/zfsboot/zfsldr.S > I try with this revision (221177) reverted to no avail: same error - 'read error' Henri ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On 06/16/2011 19:35, John Baldwin wrote: On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: Exactly. The MFCed ZFSv28 is different from any patch maintained by mm@. Maybe some untested changes involved. Can you try reverting this change: Author: jhb Date: Thu Apr 28 17:44:24 2011 New Revision: 221177 URL: http://svn.freebsd.org/changeset/base/221177 Log: Due to space constraints, the UFS boot2 and boot1 use an evil hack where boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks do not have the same space constraints, so remove this hack for ZFS. While here, remove commented out code to support C/H/S addressing from zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. MFC after:2 weeks Modified: head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/common/drv.c head/sys/boot/i386/zfsboot/Makefile head/sys/boot/i386/zfsboot/zfsldr.S I will try this saturday! Thanks Henri ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
I wish I can get a binary version... Because I have no working FreeBSD box now On Thu, Jun 16, 2011 at 12:35 PM, John Baldwin wrote: > On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: >> Exactly. The MFCed ZFSv28 is different from any patch maintained by >> mm@. Maybe some untested changes involved. > > Can you try reverting this change: > > Author: jhb > Date: Thu Apr 28 17:44:24 2011 > New Revision: 221177 > URL: http://svn.freebsd.org/changeset/base/221177 > > Log: > Due to space constraints, the UFS boot2 and boot1 use an evil hack where > boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks > do not have the same space constraints, so remove this hack for ZFS. > While here, remove commented out code to support C/H/S addressing from > zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. > > MFC after: 2 weeks > > Modified: > head/sys/boot/i386/boot2/Makefile > head/sys/boot/i386/common/drv.c > head/sys/boot/i386/zfsboot/Makefile > head/sys/boot/i386/zfsboot/zfsldr.S > > -- > John Baldwin > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Thursday, June 16, 2011 8:45:41 am Zhihao Yuan wrote: > Exactly. The MFCed ZFSv28 is different from any patch maintained by > mm@. Maybe some untested changes involved. Can you try reverting this change: Author: jhb Date: Thu Apr 28 17:44:24 2011 New Revision: 221177 URL: http://svn.freebsd.org/changeset/base/221177 Log: Due to space constraints, the UFS boot2 and boot1 use an evil hack where boot2 calls back into boot1 to perform disk reads. The ZFS MBR boot blocks do not have the same space constraints, so remove this hack for ZFS. While here, remove commented out code to support C/H/S addressing from zfsldr. The ZFS and GPT bootstraps always just use EDD LBA addressing. MFC after:2 weeks Modified: head/sys/boot/i386/boot2/Makefile head/sys/boot/i386/common/drv.c head/sys/boot/i386/zfsboot/Makefile head/sys/boot/i386/zfsboot/zfsldr.S -- John Baldwin ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
Exactly. The MFCed ZFSv28 is different from any patch maintained by mm@. Maybe some untested changes involved. On Thu, Jun 16, 2011 at 7:36 AM, Henri Hennebert wrote: > On 06/16/2011 07:32, Zhihao Yuan wrote: >> >> I just redo everything, and changed the order of freebsd-zfs and >> freebsd-swap. The "Read error" still happens! > > Just a me too. > > Everything was working great with zfsboot from 8.2-RELEASE + a patch > (http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/153552). > > As I update to 8.2-STABLE after v28 MFC, I have to write a new zfsboot to be > allowed to upgrade my pool. I get the "Read Error" after that. > > PS - same comfig, a netboot with windows7 on first partition - so I can't > switch to gpt. > > Henri >> >> On Wed, Jun 15, 2011 at 8:07 PM, Zhihao Yuan wrote: >>> >>> On Wed, Jun 15, 2011 at 7:58 PM, Xin LI wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/15/11 17:42, Zhihao Yuan wrote: > > Hi, > > I configured my disk layout according to > http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition > > But I swapped the order of the freebsd-zfs and freebsd-swap. The 4.0G > freebsd-swap partition appears first inside the slice. > After that, I write zfsboot on both ada0s2 and ada0s2b, but the boot0 > gives me a "Read error". Where did your second slice start? There can be a lot of reasons why it gives Read error. >>> >>> After an NTFS partition of 12GB. >>> This should be the problem with zfsboot, because if I use sysinstall >>> to install a bootmgr, the boot gives me a "not UFS" error, which means >>> the boot0 is done (am I right?). >>> I personally recommend using GPT scheme instead of MBR, as you have a dedicated partition for gptzfsboot, which is much cleaner than this approach. >>> >>> Yeah, yeah, I agree. I should not plan to play Windows games. >>> Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJN+VUrAAoJEATO+BI/yjfBpksH/2ZswQ+ogdDpYwvhRIjJaqLs NEl8FtC2Ua+c3F2sNwrLK5a/fn/LL+jPAXndvuQdxOaz41Iqtnt8w1i9Dz5ATkva T+i0fnRVwXFqjrlRTWK+ODtNtrhI2/7ECAIfOOLNhaiJnPRrJJgvxJ6V5W+/N+l7 Lt4yMp6hGbhO/9Yp2UoaQuUThOTz+dKNZGECd1nLT+ooHbTPhBvjii080hHowNl6 Ef+JBaEng2NbRJPxYWrRwz6R7A44RDXvrKzn5w/TuUa+4fYrS25EZxygzIh3xjFX 2ILP25yabJ+Vw5o8bFCsJ3ExbEfq0PnfROHanRSdTjMDra27dGY9JZKyytE+Ykc= =D5+X -END PGP SIGNATURE- ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org" >>> >>> >>> >>> -- >>> Zhihao Yuan, nickname lichray >>> The best way to predict the future is to invent it. >>> ___ >>> 4BSD -- http://4bsd.biz/ >>> >> >> >> > > ___ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org" > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On 06/16/2011 07:32, Zhihao Yuan wrote: I just redo everything, and changed the order of freebsd-zfs and freebsd-swap. The "Read error" still happens! Just a me too. Everything was working great with zfsboot from 8.2-RELEASE + a patch (http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/153552). As I update to 8.2-STABLE after v28 MFC, I have to write a new zfsboot to be allowed to upgrade my pool. I get the "Read Error" after that. PS - same comfig, a netboot with windows7 on first partition - so I can't switch to gpt. Henri On Wed, Jun 15, 2011 at 8:07 PM, Zhihao Yuan wrote: On Wed, Jun 15, 2011 at 7:58 PM, Xin LI wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/15/11 17:42, Zhihao Yuan wrote: Hi, I configured my disk layout according to http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition But I swapped the order of the freebsd-zfs and freebsd-swap. The 4.0G freebsd-swap partition appears first inside the slice. After that, I write zfsboot on both ada0s2 and ada0s2b, but the boot0 gives me a "Read error". Where did your second slice start? There can be a lot of reasons why it gives Read error. After an NTFS partition of 12GB. This should be the problem with zfsboot, because if I use sysinstall to install a bootmgr, the boot gives me a "not UFS" error, which means the boot0 is done (am I right?). I personally recommend using GPT scheme instead of MBR, as you have a dedicated partition for gptzfsboot, which is much cleaner than this approach. Yeah, yeah, I agree. I should not plan to play Windows games. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJN+VUrAAoJEATO+BI/yjfBpksH/2ZswQ+ogdDpYwvhRIjJaqLs NEl8FtC2Ua+c3F2sNwrLK5a/fn/LL+jPAXndvuQdxOaz41Iqtnt8w1i9Dz5ATkva T+i0fnRVwXFqjrlRTWK+ODtNtrhI2/7ECAIfOOLNhaiJnPRrJJgvxJ6V5W+/N+l7 Lt4yMp6hGbhO/9Yp2UoaQuUThOTz+dKNZGECd1nLT+ooHbTPhBvjii080hHowNl6 Ef+JBaEng2NbRJPxYWrRwz6R7A44RDXvrKzn5w/TuUa+4fYrS25EZxygzIh3xjFX 2ILP25yabJ+Vw5o8bFCsJ3ExbEfq0PnfROHanRSdTjMDra27dGY9JZKyytE+Ykc= =D5+X -END PGP SIGNATURE- ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org" -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
I just redo everything, and changed the order of freebsd-zfs and freebsd-swap. The "Read error" still happens! On Wed, Jun 15, 2011 at 8:07 PM, Zhihao Yuan wrote: > On Wed, Jun 15, 2011 at 7:58 PM, Xin LI wrote: >> -BEGIN PGP SIGNED MESSAGE- >> Hash: SHA256 >> >> On 06/15/11 17:42, Zhihao Yuan wrote: >>> Hi, >>> >>> I configured my disk layout according to >>> http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition >>> >>> But I swapped the order of the freebsd-zfs and freebsd-swap. The 4.0G >>> freebsd-swap partition appears first inside the slice. >>> After that, I write zfsboot on both ada0s2 and ada0s2b, but the boot0 >>> gives me a "Read error". >> >> Where did your second slice start? There can be a lot of reasons why it >> gives Read error. > > After an NTFS partition of 12GB. > This should be the problem with zfsboot, because if I use sysinstall > to install a bootmgr, the boot gives me a "not UFS" error, which means > the boot0 is done (am I right?). > >> >> I personally recommend using GPT scheme instead of MBR, as you have a >> dedicated partition for gptzfsboot, which is much cleaner than this >> approach. >> > > Yeah, yeah, I agree. I should not plan to play Windows games. > >> Cheers, >> - -- >> Xin LI http://www.delphij.net/ >> FreeBSD - The Power to Serve! Live free or die >> -BEGIN PGP SIGNATURE- >> Version: GnuPG v2.0.17 (FreeBSD) >> >> iQEcBAEBCAAGBQJN+VUrAAoJEATO+BI/yjfBpksH/2ZswQ+ogdDpYwvhRIjJaqLs >> NEl8FtC2Ua+c3F2sNwrLK5a/fn/LL+jPAXndvuQdxOaz41Iqtnt8w1i9Dz5ATkva >> T+i0fnRVwXFqjrlRTWK+ODtNtrhI2/7ECAIfOOLNhaiJnPRrJJgvxJ6V5W+/N+l7 >> Lt4yMp6hGbhO/9Yp2UoaQuUThOTz+dKNZGECd1nLT+ooHbTPhBvjii080hHowNl6 >> Ef+JBaEng2NbRJPxYWrRwz6R7A44RDXvrKzn5w/TuUa+4fYrS25EZxygzIh3xjFX >> 2ILP25yabJ+Vw5o8bFCsJ3ExbEfq0PnfROHanRSdTjMDra27dGY9JZKyytE+Ykc= >> =D5+X >> -END PGP SIGNATURE- >> ___ >> freebsd-stable@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-stable >> To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org" >> > > > > -- > Zhihao Yuan, nickname lichray > The best way to predict the future is to invent it. > ___ > 4BSD -- http://4bsd.biz/ > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
On Wed, Jun 15, 2011 at 7:58 PM, Xin LI wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA256 > > On 06/15/11 17:42, Zhihao Yuan wrote: >> Hi, >> >> I configured my disk layout according to >> http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition >> >> But I swapped the order of the freebsd-zfs and freebsd-swap. The 4.0G >> freebsd-swap partition appears first inside the slice. >> After that, I write zfsboot on both ada0s2 and ada0s2b, but the boot0 >> gives me a "Read error". > > Where did your second slice start? There can be a lot of reasons why it > gives Read error. After an NTFS partition of 12GB. This should be the problem with zfsboot, because if I use sysinstall to install a bootmgr, the boot gives me a "not UFS" error, which means the boot0 is done (am I right?). > > I personally recommend using GPT scheme instead of MBR, as you have a > dedicated partition for gptzfsboot, which is much cleaner than this > approach. > Yeah, yeah, I agree. I should not plan to play Windows games. > Cheers, > - -- > Xin LI http://www.delphij.net/ > FreeBSD - The Power to Serve! Live free or die > -BEGIN PGP SIGNATURE- > Version: GnuPG v2.0.17 (FreeBSD) > > iQEcBAEBCAAGBQJN+VUrAAoJEATO+BI/yjfBpksH/2ZswQ+ogdDpYwvhRIjJaqLs > NEl8FtC2Ua+c3F2sNwrLK5a/fn/LL+jPAXndvuQdxOaz41Iqtnt8w1i9Dz5ATkva > T+i0fnRVwXFqjrlRTWK+ODtNtrhI2/7ECAIfOOLNhaiJnPRrJJgvxJ6V5W+/N+l7 > Lt4yMp6hGbhO/9Yp2UoaQuUThOTz+dKNZGECd1nLT+ooHbTPhBvjii080hHowNl6 > Ef+JBaEng2NbRJPxYWrRwz6R7A44RDXvrKzn5w/TuUa+4fYrS25EZxygzIh3xjFX > 2ILP25yabJ+Vw5o8bFCsJ3ExbEfq0PnfROHanRSdTjMDra27dGY9JZKyytE+Ykc= > =D5+X > -END PGP SIGNATURE- > ___ > freebsd-stable@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org" > -- Zhihao Yuan, nickname lichray The best way to predict the future is to invent it. ___ 4BSD -- http://4bsd.biz/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"
Re: ZFS boot inside on the second partition inside a slice
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 06/15/11 17:42, Zhihao Yuan wrote: > Hi, > > I configured my disk layout according to > http://wiki.freebsd.org/RootOnZFS/ZFSBootPartition > > But I swapped the order of the freebsd-zfs and freebsd-swap. The 4.0G > freebsd-swap partition appears first inside the slice. > After that, I write zfsboot on both ada0s2 and ada0s2b, but the boot0 > gives me a "Read error". Where did your second slice start? There can be a lot of reasons why it gives Read error. I personally recommend using GPT scheme instead of MBR, as you have a dedicated partition for gptzfsboot, which is much cleaner than this approach. Cheers, - -- Xin LI http://www.delphij.net/ FreeBSD - The Power to Serve! Live free or die -BEGIN PGP SIGNATURE- Version: GnuPG v2.0.17 (FreeBSD) iQEcBAEBCAAGBQJN+VUrAAoJEATO+BI/yjfBpksH/2ZswQ+ogdDpYwvhRIjJaqLs NEl8FtC2Ua+c3F2sNwrLK5a/fn/LL+jPAXndvuQdxOaz41Iqtnt8w1i9Dz5ATkva T+i0fnRVwXFqjrlRTWK+ODtNtrhI2/7ECAIfOOLNhaiJnPRrJJgvxJ6V5W+/N+l7 Lt4yMp6hGbhO/9Yp2UoaQuUThOTz+dKNZGECd1nLT+ooHbTPhBvjii080hHowNl6 Ef+JBaEng2NbRJPxYWrRwz6R7A44RDXvrKzn5w/TuUa+4fYrS25EZxygzIh3xjFX 2ILP25yabJ+Vw5o8bFCsJ3ExbEfq0PnfROHanRSdTjMDra27dGY9JZKyytE+Ykc= =D5+X -END PGP SIGNATURE- ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"