RFT: Eliminate Apple specific code from boot/i386/pc/boot.S
PATCH 1/2 RFT: Eliminate Apple specific code from boot/i386/pc/boot.S
ChangeLog:
* boot/i386/pc/boot.S: Remove all code dependent on APPLE_CC. Use local labels starting with "L_" so that Apple assembler would know they are local.
--- boot/i386/pc/boot.S | 110 +++++++++++++++------------------------------------ 1 files changed, 32 insertions(+), 78 deletions(-)
boot/i386/pc/boot.S +32 -78
@@ -30,11 +30,7 @@ #define ABS(x) (x-_start+0x7c00) /* Print message string */ -#ifdef APPLE_CC -#define MSG(x) x ## _abs = ABS(x); movw $x ## _abs, %si; call message -#else -#define MSG(x) movw $ABS(x), %si; call message -#endif +#define MSG(x) movw $ABS(x), %si; call L_message .file "boot.S"
@@ -56,7 +52,7 @@ start: * parameter block. */ - jmp after_BPB + jmp L_after_BPB nop /* do I care about this ??? */ /*
@@ -104,7 +100,7 @@ boot_drive: .byte 0xff /* the disk to load kernel from */ /* 0xff means use the boot drive */ -after_BPB: +L_after_BPB: /* general setup */ cli /* we're not safe here! */
@@ -129,12 +125,7 @@ boot_drive_check: * ljmp to the next instruction because some bogus BIOSes * jump to 07C0:0000 instead of 0000:7C00. */ -#ifdef APPLE_CC - real_start_abs = ABS(real_start) - ljmp $0, $(real_start_abs) -#else ljmp $0, $ABS(real_start) -#endif real_start:
@@ -151,12 +142,7 @@ real_start: /* * Check if we have a forced disk reference here */ -#ifdef APPLE_CC - boot_drive_abs = ABS (boot_drive) - movb boot_drive_abs, %al -#else movb ABS(boot_drive), %al -#endif cmpb $0xff, %al je 1f movb %al, %dl
@@ -168,16 +154,11 @@ real_start: MSG(notification_string) /* set %si to the disk address packet */ -#ifdef APPLE_CC - disk_address_packet_abs = ABS (disk_address_packet) - movw $disk_address_packet_abs, %si -#else movw $ABS(disk_address_packet), %si -#endif /* do not probe LBA if the drive is a floppy */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl - jz chs_mode + jz L_chs_mode /* check if LBA is supported */ movb $0x41, %ah
@@ -192,12 +173,12 @@ real_start: pushw %dx /* use CHS if fails */ - jc chs_mode + jc L_chs_mode cmpw $0xaa55, %bx - jne chs_mode + jne L_chs_mode andw $1, %cx - jz chs_mode + jz L_chs_mode lba_mode: xorw %ax, %ax
@@ -214,18 +195,10 @@ lba_mode: movw $0x0010, (%si) /* the absolute address */ -#ifdef APPLE_CC - kernel_sector_abs = ABS (kernel_sector) - movl (kernel_sector_abs), %ebx - movl %ebx, 8(%si) - movl (kernel_sector_abs + 4), %ebx - movl %ebx, 12(%si) -#else movl ABS(kernel_sector), %ebx movl %ebx, 8(%si) movl ABS(kernel_sector + 4), %ebx movl %ebx, 12(%si) -#endif /* the segment of buffer address */ movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si)
@@ -243,30 +216,30 @@ lba_mode: int $0x13 /* LBA read is not supported, so fallback to CHS. */ - jc chs_mode + jc L_chs_mode movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx - jmp copy_buffer + jmp L_copy_buffer -chs_mode: +L_chs_mode: /* * Determine the hard disk geometry from the BIOS! * We do this first, so that LS-120 IDE floppies work correctly. */ movb $8, %ah int $0x13 - jnc final_init + jnc L_final_init /* * The call failed, so maybe use the floppy probe instead. */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl - jz floppy_probe + jz L_floppy_probe /* Nope, we definitely have a hard disk, and we're screwed. */ - jmp hd_probe_error + jmp L_hd_probe_error -final_init: +L_final_init: /* set the mode to zero */ movzbl %dh, %eax movb %ah, -1(%si)
@@ -292,22 +265,13 @@ final_init: setup_sectors: /* load logical sector start (top half) */ -#ifdef APPLE_CC - kernel_sector_abs = ABS (kernel_sector) - movl (kernel_sector_abs + 4), %eax -#else movl ABS(kernel_sector + 4), %eax -#endif orl %eax, %eax - jnz geometry_error + jnz L_geometry_error /* load logical sector start (bottom half) */ -#ifdef APPLE_CC - movl (kernel_sector_abs), %eax -#else movl ABS(kernel_sector), %eax -#endif /* zero %edx */ xorl %edx, %edx
@@ -323,7 +287,7 @@ setup_sectors: /* do we need too many cylinders? */ cmpw 8(%si), %ax - jge geometry_error + jge L_geometry_error /* normalize sector start (1-based) */ incb %cl
@@ -365,11 +329,11 @@ setup_sectors: movw $0x0201, %ax /* function 2 */ int $0x13 - jc read_error + jc L_read_error movw %es, %bx -copy_buffer: +L_copy_buffer: /* * We need to save %cx and %si because the startup code in * kernel uses them without initializing them.
@@ -392,42 +356,37 @@ copy_buffer: popa /* boot kernel */ -#ifdef APPLE_CC - kernel_address_abs = ABS (kernel_address) - jmp *(kernel_address_abs) -#else jmp *(kernel_address) -#endif /* END OF MAIN LOOP */ /* * BIOS Geometry translation error (past the end of the disk geometry!). */ -geometry_error: +L_geometry_error: MSG(geometry_error_string) - jmp general_error + jmp L_general_error /* * Disk probe failure. */ -hd_probe_error: +L_hd_probe_error: MSG(hd_probe_error_string) - jmp general_error + jmp L_general_error /* * Read error on the disk. */ -read_error: +L_read_error: MSG(read_error_string) -general_error: +L_general_error: MSG(general_error_string) /* go here when you need to stop the machine hard after an error condition */ /* tell the BIOS a boot failure, which may result in no effect */ int $0x18 -stop: jmp stop +L_stop: jmp L_stop notification_string: .asciz "GRUB " geometry_error_string: .asciz "Geom"
@@ -450,7 +409,7 @@ general_error_string: .asciz " Error\r\n" movw $0x0001, %bx movb $0xe, %ah int $0x10 /* display a byte */ -message: +L_message: lodsb cmpb $0, %al jne 1b /* if not end of string, jmp to display */
@@ -478,19 +437,14 @@ part_start: probe_values: .byte 36, 18, 15, 9, 0 -floppy_probe: +L_floppy_probe: /* * Perform floppy probe. */ -#ifdef APPLE_CC - probe_values_abs = ABS (probe_values) - movw $(probe_values_abs-1), %si -#else movw $ABS(probe_values-1), %si -#endif -probe_loop: +L_probe_loop: /* reset floppy controller INT 13h AH=0 */ xorw %ax, %ax int $0x13
@@ -506,7 +460,7 @@ probe_loop: * Floppy disk probe failure. */ MSG(fd_probe_error_string) - jmp general_error + jmp L_general_error /* "Floppy" */ fd_probe_error_string: .asciz "Floppy"
@@ -519,14 +473,14 @@ fd_probe_error_string: .asciz "Floppy" movb $0, %dh int $0x13 - /* if error, jump to "probe_loop" */ - jc probe_loop + /* if error, jump to "L_probe_loop" */ + jc L_probe_loop /* %cl is already the correct value! */ movb $1, %dh movb $79, %ch - jmp final_init + jmp L_final_init . = _start + GRUB_BOOT_MACHINE_PART_END
PATCH 2/2 RFT: Remove ABS macro from boot/i386/pc/boot.S
ChangeLog:
* boot/i386/pc/boot.S: Remove ABS macro, it's useless now.
--- boot/i386/pc/boot.S | 23 +++++++++-------------- 1 files changed, 9 insertions(+), 14 deletions(-)
boot/i386/pc/boot.S +9 -14
@@ -24,13 +24,8 @@ * defines for the code go here */ - /* Absolute addresses - This makes the assembler generate the address without support - from the linker. (ELF can't relocate 16-bit addresses!) */ -#define ABS(x) (x-_start+0x7c00) - /* Print message string */ -#define MSG(x) movw $ABS(x), %si; call L_message +#define MSG(x) movw $x, %si; call L_message .file "boot.S"
@@ -125,7 +120,7 @@ boot_drive_check: * ljmp to the next instruction because some bogus BIOSes * jump to 07C0:0000 instead of 0000:7C00. */ - ljmp $0, $ABS(real_start) + ljmp $0, $real_start real_start:
@@ -142,7 +137,7 @@ real_start: /* * Check if we have a forced disk reference here */ - movb ABS(boot_drive), %al + movb boot_drive, %al cmpb $0xff, %al je 1f movb %al, %dl
@@ -154,7 +149,7 @@ real_start: MSG(notification_string) /* set %si to the disk address packet */ - movw $ABS(disk_address_packet), %si + movw $disk_address_packet, %si /* do not probe LBA if the drive is a floppy */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
@@ -195,9 +190,9 @@ lba_mode: movw $0x0010, (%si) /* the absolute address */ - movl ABS(kernel_sector), %ebx + movl kernel_sector, %ebx movl %ebx, 8(%si) - movl ABS(kernel_sector + 4), %ebx + movl kernel_sector + 4, %ebx movl %ebx, 12(%si) /* the segment of buffer address */
@@ -265,13 +260,13 @@ L_final_init: setup_sectors: /* load logical sector start (top half) */ - movl ABS(kernel_sector + 4), %eax + movl kernel_sector + 4, %eax orl %eax, %eax jnz L_geometry_error /* load logical sector start (bottom half) */ - movl ABS(kernel_sector), %eax + movl kernel_sector, %eax /* zero %edx */ xorl %edx, %edx
@@ -442,7 +437,7 @@ L_floppy_probe: * Perform floppy probe. */ - movw $ABS(probe_values-1), %si + movw $probe_values - 1, %si L_probe_loop: /* reset floppy controller INT 13h AH=0 */
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 3 lines · Pavel Roskin
ChangeLog:
*
boot/i386/pc/boot.S: Remove ABS macro, it's useless now.
Could you wait before committing this patch? I'm currently making grub2 compiling with gcc 2.95 supplied as a possibility (another one is gcc 4.x) with haiku. The fixes are mostly also fixes for bad style. Once I've finished I'll test this patch with gcc 2.95 to see if it generates any problem with old systems
Quoted 94 lines
---
boot/i386/pc/boot.S | 23 +++++++++--------------1 files changed, 9 insertions(+), 14 deletions(-)boot/i386/pc/boot.S +1
-6@@ -24,13 +24,8 @@ * defines for the code go here */ - /* Absolute addresses - This makes the assembler generate the address without support - from the linker. (ELF can't relocate 16-bit addresses!) */ -#define ABS(x) (x-_start+0x7c00) - /* Print message string */ -#define MSG(x) movw $ABS(x), %si; call L_message +#define MSG(x) movw $x, %si; call L_message.file "
boot.S"boot/i386/pc/boot.S +1
-1@@ -125,7 +120,7 @@ boot_drive_check: * ljmp to the next instruction because some bogus BIOSes * jump to 07C0:0000 instead of 0000:7C00. */ - ljmp $0, $ABS(real_start) + ljmp $0, $real_startreal_start:
boot/i386/pc/boot.S +1
-1@@ -142,7 +137,7 @@ real_start: /* * Check if we have a forced disk reference here */ - movb ABS(boot_drive), %al + movb boot_drive, %alcmpb $0xff, %al
je 1f
movb %al, %dlboot/i386/pc/boot.S +1
-1@@ -154,7 +149,7 @@ real_start: MSG(notification_string) /* set %si to the disk address packet */ - movw $ABS(disk_address_packet), %si + movw $disk_address_packet, %si /* do not probe LBA if the drive is a floppy */testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
boot/i386/pc/boot.S +2
-2@@ -195,9 +190,9 @@ lba_mode: movw $0x0010, (%si) /* the absolute address */ - movl ABS(kernel_sector), %ebx + movl kernel_sector, %ebx movl %ebx, 8(%si) - movl ABS(kernel_sector + 4), %ebx + movl kernel_sector + 4, %ebx movl %ebx, 12(%si) /* the segment of buffer address */@@ -265,13 +260,13 @@ L_final_init:setup_sectors:
/* load logical sector start (top half) */
- movl ABS(kernel_sector + 4), %eax
+ movl kernel_sector + 4, %eaxorl %eax, %eax
jnzL_geometry_error/* load logical sector start (bottom half) */
- movl ABS(kernel_sector), %eax
+ movl kernel_sector, %eax/* zero %edx */
xorl %edx, %edxboot/i386/pc/boot.S +1
-1@@ -442,7 +437,7 @@ L_floppy_probe: * Perform floppy probe. */ - movw $ABS(probe_values-1), %si + movw $probe_values - 1, %siL_probe_loop:
/* reset floppy controller INT 13h AH=0 */_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
Quoted 3 lines · Pavel Roskin
ChangeLog:
*
boot/i386/pc/boot.S: Remove ABS macro, it's useless now.Could you wait before committing this patch? I'm currently making grub2 compiling with gcc 2.95 supplied as a possibility (another one is gcc 4.x) with haiku. The fixes are mostly also fixes for bad style. Once I've finished I'll test this patch with gcc 2.95 to see if it generates any problem with old systems
What kind of changes does this require? gcc 2.95 is ten years old. I don't see a problem with supporting it if it comes really cheap, but I wouldn't like having to live with a set of kludges if it's only for the sake of keeping an old gcc around.
Aside from this, maybe someone should tell the Haiku folks that it won't cost them a dime in license fees to upgrade their gcc sometime :-)
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 11 lines · Robert Millan
Quoted 9 lines · Vladimir 'phcoder' Serbinenko
Quoted 3 lines · Pavel Roskin
ChangeLog:
*
boot/i386/pc/boot.S: Remove ABS macro, it's useless now.Could you wait before committing this patch? I'm currently making grub2 compiling with gcc 2.95 supplied as a possibility (another one is gcc 4.x) with haiku. The fixes are mostly also fixes for bad style. Once I've finished I'll test this patch with gcc 2.95 to see if it generates any problem with old systems
Quoted 4 lines
What kind of changes does this require? gcc 2.95 is ten years old. I don't see a problem with supporting it if it comes really cheap, but I wouldn't like having to live with a set of kludges if it's only for the sake of keeping an old gcc around.
I'm compiling now the code on qemu and if I succeed I push it to my git and break into patches. The most of changes are added checks for compiler features to avoid passing incompatible options and avoid mixing declarations with code and putting double semicolons.
Quoted 4 lines
Aside from this, maybe someone should tell the Haiku folks that it won't cost them a dime in license fees to upgrade their gcc sometime :-)
Haiku can be compiled and can use either gcc 4.x or gcc2.95. The main reason for them to keep gcc 2.95 possibility is the binary compatibility with BeOS. As François Revol explained me on IRC C++ ABI changed from gcc2 to gcc3 and as BeOS and Haiku heavily rely on C++ it's impossible to launch BeOS apps under Haiku if it was compiled with gcc4. Now there is also a possibility to compile haiku with gcc4 and some libraries compile additionally with gcc2 but currently it's not a default. Anyway gcc4 is available on haiku and if it reveals that supporing gcc2 is too expensive it's not really a problem
Quoted 13 lines
--
Robert MillanThe DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 6 lines · Vladimir 'phcoder' Serbinenko
Haiku can be compiled and can use either gcc 4.x or gcc2.95. The main reason for them to keep gcc 2.95 possibility is the binary compatibility with BeOS. As François Revol explained me on IRC C++ ABI changed from gcc2 to gcc3 and as BeOS and Haiku heavily rely on C++ it's impossible to launch BeOS apps under Haiku if it was compiled with gcc4.
Ok, but this doesn't seem to be related to GRUB, since we don't need to link its utils with any proprietary code. Can't they compile runtime libraries intended for BeOS compatibility using gcc2 and use gcc4 for GRUB (and, well, just about everything else)?
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 8 lines · Robert Millan
Quoted 6 lines · Vladimir 'phcoder' Serbinenko
Haiku can be compiled and can use either gcc 4.x or gcc2.95. The main reason for them to keep gcc 2.95 possibility is the binary compatibility with BeOS. As François Revol explained me on IRC C++ ABI changed from gcc2 to gcc3 and as BeOS and Haiku heavily rely on C++ it's impossible to launch BeOS apps under Haiku if it was compiled with gcc4.
Quoted 5 lines
Ok, but this doesn't seem to be related to GRUB, since we don't need to link its utils with any proprietary code. Can't they compile runtime libraries intended for BeOS compatibility using gcc2 and use gcc4 for GRUB (and, well, just about everything else)?
gcc2 even the one updated by haiku has bugs. I don't think we should go long way just to support it. Hence I withdraw my request for holding this patch back because of it
Quoted 13 lines
--
Robert MillanThe DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Re: [PATCH 2/2] RFT: Remove ABS macro from boot/i386/pc/boot.S
Quoted 3 lines · Vladimir 'phcoder' Serbinenko
gcc2 even the one updated by haiku has bugs. I don't think we should go long way just to support it. Hence I withdraw my request for holding this patch back because of it
Both patches have been committed.
Mirroring to git://repo.or.cz/grub2.git is currently not working. Apparently they have run out of space:
error: file write error (No space left on device)
fatal: unable to write sha1 file
error: unpack failed: unpacker exited with error code
To git+ssh://repo.or.cz/srv/git/grub2.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'git+ssh://repo.or.cz/srv/git/grub2.git'
Signature · 2 lines
Regards, Pavel Roskin
Quoted 5 lines · Pavel Roskin
ChangeLog:
*
boot/i386/pc/boot.S: Remove all code dependent onAPPLE_CC. Use local labels starting with "L_" so that Apple assembler would know they are local.
You have really a lot of patches. It's undoubtly a good thing but since I was on vacation I lost a track a bit. For casual viewers I suppose it's even worse. Perhaps you could create a git repository which would hold all patches you haven't committed yet, one per branch? It will make a much better overview. Bean created a mirror on github. Perhaps we can use it as a tool to have an easily-viewable list of all unmerged patches and prevent patches from get lost. I know it's really unfortunate that I come up with a proposition of using such system for a relatively small project like grub. Alternatively we may want to formulate rules which would prevent future developpement deadlocks.
Quoted 318 lines
---
boot/i386/pc/boot.S | 110 +++++++++++++++------------------------------------1 files changed, 32 insertions(+), 78 deletions(-)boot/i386/pc/boot.S +1
-5@@ -30,11 +30,7 @@ #define ABS(x) (x-_start+0x7c00) /* Print message string */ -#ifdef APPLE_CC -#define MSG(x) x ## _abs = ABS(x); movw $x ## _abs, %si; call message -#else -#define MSG(x) movw $ABS(x), %si; call message -#endif +#define MSG(x) movw $ABS(x), %si; call L_message.file "
boot.S"boot/i386/pc/boot.S +1
-1@@ -56,7 +52,7 @@ start: * parameter block. */ - jmp after_BPB + jmp L_after_BPBnop /* do I care about this ??? */
/*
boot/i386/pc/boot.S +0
-0@@ -104,7 +100,7 @@ boot_drive:.byte
0xff/* the disk to load kernel from */ /*0xffmeans use the boot drive */boot/i386/pc/boot.S +1
-1-after_BPB: +L_after_BPB:/* general setup */
cli /* we're not safe here! */boot/i386/pc/boot.S +0
-5@@ -129,12 +125,7 @@ boot_drive_check: * ljmp to the next instruction because some bogus BIOSes * jump to 07C0:0000 instead of 0000:7C00. */ -#ifdef APPLE_CC - real_start_abs = ABS(real_start) - ljmp $0, $(real_start_abs) -#else ljmp $0, $ABS(real_start) -#endifreal_start:
boot/i386/pc/boot.S +0
-4@@ -151,12 +142,7 @@ real_start: /* * Check if we have a forced disk reference here */ -#ifdef APPLE_CC - boot_drive_abs = ABS (boot_drive) - movb boot_drive_abs, %al -#elsemovb
ABS(boot_drive), %al
-#endif
cmpb $0xff, %al
je 1f
movb %al, %dlboot/i386/pc/boot.S +0
-4@@ -168,16 +154,11 @@ real_start: MSG(notification_string) /* set %si to the disk address packet */ -#ifdef APPLE_CC - disk_address_packet_abs = ABS (disk_address_packet) - movw $disk_address_packet_abs, %si -#elsemovw $ABS(disk_address_packet), %si
-#endif/* do not probe LBA if the drive is a floppy */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
- jz chs_mode
+ jz L_chs_mode/* check if LBA is supported */
movb $0x41, %ahboot/i386/pc/boot.S +0
-0@@ -192,12 +173,12 @@ real_start:pushw %dx
/* use CHS if fails */
- jc chs_mode
+ jc L_chs_mode
cmpw $0xaa55, %bx
- jnechs_mode
+ jneL_chs_modeandw $1, %cx
- jz chs_mode
+ jz L_chs_modelba_mode:
xorw %ax, %axboot/i386/pc/boot.S +0
-7@@ -214,18 +195,10 @@ lba_mode: movw $0x0010, (%si) /* the absolute address */ -#ifdef APPLE_CC - kernel_sector_abs = ABS (kernel_sector) - movl (kernel_sector_abs), %ebx - movl %ebx, 8(%si) - movl (kernel_sector_abs + 4), %ebx - movl %ebx, 12(%si) -#elsemovl ABS(kernel_sector), %ebx
movl %ebx, 8(%si)
movl ABS(kernel_sector + 4), %ebx
movl %ebx, 12(%si)
-#endif/* the segment of buffer address */ movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si)
boot/i386/pc/boot.S +0
-0@@ -243,30 +216,30 @@ lba_mode:int $0x13
/* LBA read is not supported, so fallback to CHS. */
- jc chs_mode
+ jc L_chs_modemovw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
- jmpcopy_buffer
+ jmpL_copy_bufferboot/i386/pc/boot.S +1
-1-chs_mode: +L_chs_mode:/*
* Determine the hard disk geometry from the BIOS!
* We do this first, so that LS-120 IDE floppies work correctly. */
movb $8, %ah
int $0x13
- jncfinal_init
+ jncL_final_init/*
* The call failed, so maybe use the floppy probe instead. */
testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl
- jz floppy_probe
+ jz L_floppy_probe/* Nope, we definitely have a hard disk, and we're screwed. */
- jmphd_probe_error
+ jmpL_hd_probe_errorboot/i386/pc/boot.S +1
-1-final_init: +L_final_init:/* set the mode to zero */
movzbl %dh, %eax
movb %ah, -1(%si)boot/i386/pc/boot.S +0
-0@@ -292,22 +265,13 @@ final_init:setup_sectors:
/* load logical sector start (top half) */boot/i386/pc/boot.S +0
-4-#ifdef APPLE_CC - kernel_sector_abs = ABS (kernel_sector) - movl (kernel_sector_abs + 4), %eax -#elsemovl ABS(kernel_sector + 4), %eax
-#endiforl %eax, %eax
- jnzgeometry_error
+ jnzL_geometry_error/* load logical sector start (bottom half) */
boot/i386/pc/boot.S +0
-3-#ifdef APPLE_CC - movl (kernel_sector_abs), %eax -#elsemovl ABS(kernel_sector), %eax
-#endif/* zero %edx */
xorl %edx, %edxboot/i386/pc/boot.S +0
-0@@ -323,7 +287,7 @@ setup_sectors: /* do we need too many cylinders? */cmpw 8(%si), %ax
- jgegeometry_error
+ jgeL_geometry_error/* normalize sector start (1-based) */
incb %clboot/i386/pc/boot.S +0
-0@@ -365,11 +329,11 @@ setup_sectors:movw $0x0201, %ax /* function 2 */
int $0x13- jc read_error
+ jc L_read_errormovw %es, %bx
boot/i386/pc/boot.S +1
-1-copy_buffer: +L_copy_buffer:/*
* We need to save %cx and %si because the startup code in
* kernel uses them without initializing them.boot/i386/pc/boot.S +0
-0@@ -392,42 +356,37 @@ copy_buffer:popa
/* boot kernel */
boot/i386/pc/boot.S +0
-4-#ifdef APPLE_CC - kernel_address_abs = ABS (kernel_address) - jmp *(kernel_address_abs) -#elsejmp *(kernel_address)
-#endif/* END OF MAIN LOOP */
/*
* BIOS Geometry translation error (past the end of the disk geometry!). */boot/i386/pc/boot.S +1
-1-geometry_error: +L_geometry_error:MSG(geometry_error_string)
- jmpgeneral_error
+ jmpL_general_error/*
* Disk probe failure.
*/boot/i386/pc/boot.S +1
-1-hd_probe_error: +L_hd_probe_error:MSG(hd_probe_error_string)
- jmpgeneral_error
+ jmpL_general_error/*
* Read error on the disk.
*/boot/i386/pc/boot.S +1
-1-read_error: +L_read_error:MSG(read_error_string)
boot/i386/pc/boot.S +1
-1-general_error: +L_general_error:MSG(general_error_string)
/* go here when you need to stop the machine hard after an error condition */ /* tell the BIOS a boot failure, which may result in no effect */ int $0x18
boot/i386/pc/boot.S +1
-1-stop: jmp stop +L_stop: jmp L_stopnotification_string: .asciz "GRUB "
geometry_error_string: .asciz "Geom"boot/i386/pc/boot.S +0
-0@@ -450,7 +409,7 @@ general_error_string: .asciz " Error\r\n"movw $0x0001, %bx
movb $0xe, %ah
int $0x10 /* display a byte */boot/i386/pc/boot.S +1
-1-message: +L_message:lodsb
cmpb $0, %al
jne 1b /* if not end of string, jmp to display */boot/i386/pc/boot.S +0
-0@@ -478,19 +437,14 @@ part_start:probe_values:
.byte 36, 18, 15, 9, 0boot/i386/pc/boot.S +1
-1-floppy_probe: +L_floppy_probe:/*
* Perform floppy probe.
*/boot/i386/pc/boot.S +0
-4-#ifdef APPLE_CC - probe_values_abs = ABS (probe_values) - movw $(probe_values_abs-1), %si -#elsemovw $ABS(probe_values-1), %si
boot/i386/pc/boot.S +1
-2-#endif -probe_loop: +L_probe_loop:/* reset floppy controller INT 13h AH=0 */
xorw %ax, %ax
int $0x13boot/i386/pc/boot.S +1
-1@@ -506,7 +460,7 @@ probe_loop: * Floppy disk probe failure. */ MSG(fd_probe_error_string) - jmp general_error + jmp L_general_error /* "Floppy" */fd_probe_error_string: .asciz "Floppy"
boot/i386/pc/boot.S +0
-0@@ -519,14 +473,14 @@ fd_probe_error_string: .asciz "Floppy"movb $0, %dh
int $0x13- /* if error, jump to "
probe_loop" */
- jc probe_loop
+ /* if error, jump to "L_probe_loop" */
+ jc L_probe_loop/* %cl is already the correct value! */
movb $1, %dh
movb $79, %ch- jmp
final_init
+ jmpL_final_init. =
_start+GRUB_BOOT_MACHINE_PART_END_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Quoted 7 lines · Vladimir 'phcoder' Serbinenko
Quoted 5 lines · Pavel Roskin
ChangeLog:
*
boot/i386/pc/boot.S: Remove all code dependent onAPPLE_CC. Use local labels starting with "L_" so that Apple assembler would know they are local.You have really a lot of patches.
I don't think so.
Quoted 5 lines
It's undoubtly a good thing but
since I was on vacation I lost a track a bit. For casual viewers I suppose it's even worse. Perhaps you could create a git repository which would hold all patches you haven't committed yet, one per branch?
I'm sorry, I don't have time to create any private repositories. I wish I could do it, but I couldn't find time from that for almost a month, so chances are it won't happen any time soon.
Quoted 7 lines
It will make a much better overview. Bean created a mirror on github. Perhaps we can use it as a tool to have an easily-viewable list of all unmerged patches and prevent patches from get lost. I know it's really unfortunate that I come up with a proposition of using such system for a relatively small project like grub. Alternatively we may want to formulate rules which would prevent future developpement deadlocks.
There are ways to apply patches from e-mail. STGit can do it.
My concern is that we would make the submitters responsible for something other than the quality of the patch if we require them to create private repositories. Normally, a patch is good as long as it applies. With a private repository, it will need to be kept up-to-date with the master repository, otherwise testing might find already fixed problems.
As for the deadlocks, I don't think it's a technical issue.
In any case, I find myself submitting too many patches, I'm ready to reconsider, but right now I cannot create any private repositories.
Signature · 2 lines
Regards, Pavel Roskin
PATCH 1/1 RFT: Rename local labels with a macro from boot/i386/pc/boot.S
In reply to Pavel RoskinHere a patch to be apply after the 2 pavel's patch (Eliminate Apple specific code and Remove ABS macro). This patch create a new macro LOCAL to define local labels and rename all labels starting with "L_" with the new macro.
I have compil boot.img under OSX and boot with the new generated file without a problem.
Yves Blusseau
ChangeLog:
* include/grub/symbol.h: add the LOCAL macro.
* boot/i386/pc/boot.S: Rename all local labels starting with "L_" with the new macro: LOCAL.
---
boot/i386/pc/boot.S | 66 +++++++++++++++++++++++++------------------------include/grub/symbol.h | 2 +
2 files changed, 36 insertions(+), 32 deletions(-)
boot/i386/pc/boot.S +34 -32
@@ -17,6 +17,7 @@ * along with GRUB. If not, see <http://www.gnu.org/licenses/>. */ +#include <grub/symbol.h> #include <grub/boot.h> #include <grub/machine/boot.h>
@@ -25,7 +26,7 @@ */ /* Print message string */ -#define MSG(x) movw $x, %si; call L_message +#define MSG(x) movw $x, %si; call LOCAL(message) .file "boot.S"
@@ -47,7 +48,7 @@ start: * parameter block. */ - jmp L_after_BPB + jmp LOCAL(after_BPB) nop /* do I care about this ??? */ /*
@@ -95,7 +96,7 @@ boot_drive: .byte 0xff /* the disk to load kernel from */ /* 0xff means use the boot drive */ -L_after_BPB: +LOCAL(after_BPB): /* general setup */ cli /* we're not safe here! */
@@ -153,7 +154,7 @@ real_start: /* do not probe LBA if the drive is a floppy */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl - jz L_chs_mode + jz LOCAL(chs_mode) /* check if LBA is supported */ movb $0x41, %ah
@@ -168,12 +169,12 @@ real_start: pushw %dx /* use CHS if fails */ - jc L_chs_mode + jc LOCAL(chs_mode) cmpw $0xaa55, %bx - jne L_chs_mode + jne LOCAL(chs_mode) andw $1, %cx - jz L_chs_mode + jz LOCAL(chs_mode) lba_mode: xorw %ax, %ax
@@ -211,30 +212,30 @@ lba_mode: int $0x13 /* LBA read is not supported, so fallback to CHS. */ - jc L_chs_mode + jc LOCAL(chs_mode) movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx - jmp L_copy_buffer + jmp LOCAL(copy_buffer) -L_chs_mode: +LOCAL(chs_mode): /* * Determine the hard disk geometry from the BIOS! * We do this first, so that LS-120 IDE floppies work correctly. */ movb $8, %ah int $0x13 - jnc L_final_init + jnc LOCAL(final_init) /* * The call failed, so maybe use the floppy probe instead. */ testb $GRUB_BOOT_MACHINE_BIOS_HD_FLAG, %dl - jz L_floppy_probe + jz LOCAL(floppy_probe) /* Nope, we definitely have a hard disk, and we're screwed. */ - jmp L_hd_probe_error + jmp LOCAL(hd_probe_error) -L_final_init: +LOCAL(final_init): /* set the mode to zero */ movzbl %dh, %eax movb %ah, -1(%si)
@@ -263,7 +264,7 @@ setup_sectors: movl kernel_sector + 4, %eax orl %eax, %eax - jnz L_geometry_error + jnz LOCAL(geometry_error) /* load logical sector start (bottom half) */ movl kernel_sector, %eax
@@ -282,7 +283,7 @@ setup_sectors: /* do we need too many cylinders? */ cmpw 8(%si), %ax - jge L_geometry_error + jge LOCAL(geometry_error) /* normalize sector start (1-based) */ incb %cl
@@ -324,11 +325,11 @@ setup_sectors: movw $0x0201, %ax /* function 2 */ int $0x13 - jc L_read_error + jc LOCAL(read_error) movw %es, %bx -L_copy_buffer: +LOCAL(copy_buffer): /* * We need to save %cx and %si because the startup code in * kernel uses them without initializing them.
@@ -358,30 +359,31 @@ L_copy_buffer: /* * BIOS Geometry translation error (past the end of the disk geometry!). */ -L_geometry_error: +LOCAL(geometry_error): MSG(geometry_error_string) - jmp L_general_error + jmp LOCAL(general_error) /* * Disk probe failure. */ -L_hd_probe_error: +LOCAL(hd_probe_error): MSG(hd_probe_error_string) - jmp L_general_error + jmp LOCAL(general_error) /* * Read error on the disk. */ -L_read_error: +LOCAL(read_error): MSG(read_error_string) -L_general_error: +LOCAL(general_error): MSG(general_error_string) /* go here when you need to stop the machine hard after an error condition */ /* tell the BIOS a boot failure, which may result in no effect */ int $0x18 -L_stop: jmp L_stop +LOCAL(stop): + jmp LOCAL(stop) notification_string: .asciz "GRUB " geometry_error_string: .asciz "Geom"
@@ -404,7 +406,7 @@ general_error_string: .asciz " Error\r\n" movw $0x0001, %bx movb $0xe, %ah int $0x10 /* display a byte */ -L_message: +LOCAL(message): lodsb cmpb $0, %al jne 1b /* if not end of string, jmp to display */
@@ -432,14 +434,14 @@ part_start: probe_values: .byte 36, 18, 15, 9, 0 -L_floppy_probe: +LOCAL(floppy_probe): /* * Perform floppy probe. */ movw $probe_values - 1, %si -L_probe_loop: +LOCAL(probe_loop): /* reset floppy controller INT 13h AH=0 */ xorw %ax, %ax int $0x13
@@ -455,7 +457,7 @@ L_probe_loop: * Floppy disk probe failure. */ MSG(fd_probe_error_string) - jmp L_general_error + jmp LOCAL(general_error) /* "Floppy" */ fd_probe_error_string: .asciz "Floppy"
@@ -468,14 +470,14 @@ fd_probe_error_string: .asciz "Floppy" movb $0, %dh int $0x13 - /* if error, jump to "L_probe_loop" */ - jc L_probe_loop + /* if error, jump to "LOCAL(probe_loop)" */ + jc LOCAL(probe_loop) /* %cl is already the correct value! */ movb $1, %dh movb $79, %ch - jmp L_final_init + jmp LOCAL(final_init) . = _start + GRUB_BOOT_MACHINE_PART_END
include/grub/symbol.h +2 -0
@@ -21,6 +21,8 @@#include <config.h> +#define LOCAL (X ) L_##X +/* Add an underscore to a C symbol in assembler code if needed. */ #ifdef HAVE_ASM_USCORE # define EXT_C (sym) _ ## sym
Re: [PATCH] RFT: Rename local labels with a macro from boot/i386/pc/boot.S
Quoted 4 lines · Yves Blusseau
Here a patch to be apply after the 2 pavel's patch (Eliminate Apple specific code and Remove ABS macro). This patch create a new macro LOCAL to define local labels and rename all labels starting with "L_" with the new macro.
Nice. I will submit later the patch to eliminate a lot of APPLE_CC using LOCAL() macro. Could you test it on cygwin, linux and FreeBSD and confirm that three patches together don't break anything?
Quoted 24 lines
I have compil boot.img under OSX and boot with the new generated file without a problem.
Yves Blusseau
ChangeLog:
*
include/grub/symbol.h: add the LOCAL macro.
*boot/i386/pc/boot.S: Rename all local labels starting with "L_" with the new macro: LOCAL.
---
boot/i386/pc/boot.S| 66
+++++++++++++++++++++++++------------------------include/grub/symbol.h| 2 +2 files changed, 36 insertions(+), 32 deletions(-)_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel
Signature · 4 lines
Regards Vladimir 'phcoder' Serbinenko Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
Re: [PATCH] RFT: Rename local labels with a macro from boot/i386/pc/boot.S
Quoted 8 lines · Vladimir 'phcoder' Serbinenko
Quoted 4 lines · Yves Blusseau
Here a patch to be apply after the 2 pavel's patch (Eliminate Apple specific code and Remove ABS macro). This patch create a new macro LOCAL to define local labels and rename all labels starting with "L_" with the new macro.
Nice. I will submit later the patch to eliminate a lot of
APPLE_CCusingLOCAL()macro. Could you test it on cygwin, linux and FreeBSD and confirm that three patches together don't break anything?
I have compil and test on OSX and Linux: "boot.img" load perfectly. Need someonelse to test on cygwin and FreeBSD because i don't have this "OS".
Yves Blusseau
Re: [PATCH] RFT: Rename local labels with a macro from boot/i386/pc/boot.S
In reply to Yves Blusseauinclude/grub/symbol.h line 28
Quoted 13 lines · Yves Blusseau
include/grub/symbol.h +2
-0@@ -21,6 +21,8 @@#include <config.h> +#define LOCAL (X ) L_##X +/* Add an underscore to a C symbol in assembler code if needed. */ #ifdef HAVE_ASM_USCORE # define EXT_C (sym) _ ## sym
Assuming Pavel is OK with it, I have no objection.
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Re: [PATCH] RFT: Rename local labels with a macro from boot/i386/pc/boot.S
Quoted 7 lines · Robert Millan
Quoted 6 lines · Yves Blusseau
include/grub/symbol.h +0
-0@@ -21,6 +21,8 @@
Quoted 7 lines
include/grub/symbol.h line 28
Quoted 7 lines
include/grub/symbol.h +2
-0#include <config.h> +#define LOCAL (X ) L_##X +/* Add an underscore to a C symbol in assembler code if needed. */ #ifdef HAVE_ASM_USCORE # define EXT_C (sym) _ ## sym
I changed LOCAL to be more similar to EXT_C (macro arguments don't normally use capital letters). I also added a comment, as there is no other way to know why we are adding "L_" to the labels.
Quoted 1 line
Assuming Pavel is OK with it, I have no objection.
Committed. Thank you!
Signature · 2 lines
Regards, Pavel Roskin