|
@@ -296,11 +296,9 @@ copy_bytes:
|
296
|
296
|
* Zero bytes
|
297
|
297
|
*
|
298
|
298
|
* Parameters:
|
299
|
|
- * %ds:esi : source address
|
300
|
299
|
* %es:edi : destination address
|
301
|
300
|
* %ecx : length
|
302
|
301
|
* Returns:
|
303
|
|
- * %ds:esi : next source address
|
304
|
302
|
* %es:edi : next destination address
|
305
|
303
|
* Corrupts:
|
306
|
304
|
* None
|
|
@@ -678,12 +676,21 @@ install:
|
678
|
676
|
.globl install_prealloc
|
679
|
677
|
install_prealloc:
|
680
|
678
|
progress "install_prealloc:\n"
|
681
|
|
- /* Save registers */
|
|
679
|
+ /* Save registers on external stack */
|
682
|
680
|
pushal
|
683
|
681
|
pushw %ds
|
684
|
682
|
pushw %es
|
685
|
683
|
cld /* Sanity: clear the direction flag asap */
|
686
|
684
|
|
|
685
|
+ /* Switch to temporary stack in .bss16 */
|
|
686
|
+ pushw %ss
|
|
687
|
+ popw %ds
|
|
688
|
+ movl %esp, %ecx
|
|
689
|
+ movw %bx, %ss
|
|
690
|
+ movl $_data16_memsz, %esp
|
|
691
|
+ pushw %ds
|
|
692
|
+ pushl %ecx
|
|
693
|
+
|
687
|
694
|
/* Set up %ds for (read-only) access to .prefix */
|
688
|
695
|
pushw %cs
|
689
|
696
|
popw %ds
|
|
@@ -710,6 +717,7 @@ install_prealloc:
|
710
|
717
|
popl %esi
|
711
|
718
|
|
712
|
719
|
#ifndef KEEP_IT_REAL
|
|
720
|
+
|
713
|
721
|
/* Access high memory by enabling the A20 gate. (We will
|
714
|
722
|
* already have 4GB segment limits as a result of calling
|
715
|
723
|
* install_block.)
|
|
@@ -778,7 +786,7 @@ payload_death_message:
|
778
|
786
|
movzwl %bx, %edi
|
779
|
787
|
shll $4, %edi
|
780
|
788
|
movl $_data16_filesz, %ecx
|
781
|
|
- movl $_data16_memsz, %edx
|
|
789
|
+ movl $_data16_filesz, %edx /* do not zero our temporary stack */
|
782
|
790
|
call install_block /* .data16 */
|
783
|
791
|
|
784
|
792
|
/* Set up %ds for access to .data16 */
|
|
@@ -787,11 +795,8 @@ payload_death_message:
|
787
|
795
|
/* Restore decompression temporary area physical address */
|
788
|
796
|
popl %edi
|
789
|
797
|
|
790
|
|
-#ifdef KEEP_IT_REAL
|
791
|
|
- /* Initialise libkir */
|
792
|
|
- movw %ax, (init_libkir_vector+2)
|
793
|
|
- lcall *init_libkir_vector
|
794
|
|
-#else
|
|
798
|
+#ifndef KEEP_IT_REAL
|
|
799
|
+
|
795
|
800
|
/* Find a suitable decompression temporary area, if none specified */
|
796
|
801
|
pushl %eax
|
797
|
802
|
testl %edi, %edi
|
|
@@ -823,6 +828,22 @@ payload_death_message:
|
823
|
828
|
call install_block
|
824
|
829
|
popl %edi
|
825
|
830
|
|
|
831
|
+#endif /* KEEP_IT_REAL */
|
|
832
|
+
|
|
833
|
+ /* Switch back to original stack and zero .bss16 */
|
|
834
|
+ lss %ss:(%esp), %esp
|
|
835
|
+ pushl %edi
|
|
836
|
+ pushw %es
|
|
837
|
+ movw %bx, %es
|
|
838
|
+ movl $_data16_filesz, %edi
|
|
839
|
+ movl $_data16_memsz, %ecx
|
|
840
|
+ subl %edi, %ecx
|
|
841
|
+ call zero_bytes
|
|
842
|
+ popw %es
|
|
843
|
+ popl %edi
|
|
844
|
+
|
|
845
|
+#ifndef KEEP_IT_REAL
|
|
846
|
+
|
826
|
847
|
/* Initialise librm at current location */
|
827
|
848
|
progress " init_librm\n"
|
828
|
849
|
movw %ax, (init_librm_vector+2)
|
|
@@ -834,7 +855,6 @@ payload_death_message:
|
834
|
855
|
incb memmap_post
|
835
|
856
|
decl %ebp
|
836
|
857
|
1:
|
837
|
|
-
|
838
|
858
|
/* Call relocate() to determine target address for relocation.
|
839
|
859
|
* relocate() will return with %esi, %edi and %ecx set up
|
840
|
860
|
* ready for the copy to the new location.
|
|
@@ -857,7 +877,14 @@ payload_death_message:
|
857
|
877
|
/* Initialise librm at new location */
|
858
|
878
|
progress " init_librm\n"
|
859
|
879
|
lcall *init_librm_vector
|
860
|
|
-#endif
|
|
880
|
+
|
|
881
|
+#else /* KEEP_IT_REAL */
|
|
882
|
+
|
|
883
|
+ /* Initialise libkir */
|
|
884
|
+ movw %ax, (init_libkir_vector+2)
|
|
885
|
+ lcall *init_libkir_vector
|
|
886
|
+
|
|
887
|
+#endif /* KEEP_IT_REAL */
|
861
|
888
|
|
862
|
889
|
/* Close access to payload */
|
863
|
890
|
progress " close_payload\n"
|