Browse Source

+ zero fill the bss section on startup in the msdos loader

git-svn-id: trunk@24339 -
nickysn 12 years ago
parent
commit
11a915e682
1 changed files with 13 additions and 3 deletions
  1. 13 3
      rtl/msdos/prt0.asm

+ 13 - 3
rtl/msdos/prt0.asm

@@ -18,15 +18,25 @@
 
 ..start:
         ; init the stack
-        mov ax, dgroup
-        mov ss, ax
+        mov bx, dgroup
+        mov ss, bx
         mov sp, stacktop
 
+        ; zero fill the BSS section
+        mov es, bx
+        mov di, _edata wrt dgroup
+        mov cx, _end wrt dgroup
+        sub cx, di
+        jz no_bss
+        xor al, al
+        rep stosb
+no_bss:
+
         ; save the Program Segment Prefix
         push ds
 
         ; init DS
-        mov ds, ax
+        mov ds, bx
 
         ; pop the PSP from stack and store it in the pascal variable dos_psp
         pop ax