]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Don't clear BSS if we don't need to.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 5 Sep 2008 21:50:16 +0000 (17:50 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 5 Sep 2008 21:50:16 +0000 (17:50 -0400)
aseg/Makefile
aseg/aseg.asm
aseg/counter.c

index 5bef71f801b5aff0b92f294a65004b985a7f8898..20e5ae9f6f663a3527609213b0b89b470cd50031 100644 (file)
@@ -6,5 +6,5 @@ aseg.bin: aseg.asm
 aseg.o: aseg.bin
        objcopy -I binary -B i386 -O elf32-i386 aseg.bin aseg.o
 
-aseg.elf: aseg.bin aseg.lds counter.o
+aseg.elf: aseg.o aseg.lds counter.o
        ld -o aseg.elf -T aseg.lds counter.o
index ee83272652e66bf3595dd8129eecc6c857b2efb3..244cafc359f3ae87669952727d914f2d43b9f0ed 100644 (file)
@@ -74,29 +74,34 @@ continue:
        mov al, [esp-6]
        out dx, al
 
-       mov al, 0
-       mov edi, [dataptr+4]            ; clear BSS
-       mov ecx, [dataptr+8]
-       rep stosb
-
        mov dx, 0xCFC                   ; restore smramc
        mov al, [esp-5]
        out dx, al
-       
-       mov eax, [dataptr+12]
-       call eax
 
-       mov dx, 0xCF8                   ; restore the old config value
+       mov dx, 0xCF8                   ; restore the old PCI config value
        mov eax, [esp-4]
        out dx, eax
 
+       mov al, [needclear]
+       cmp al, 0
+       jz noclear
+       mov al, 0                       ; clear BSS
+       mov edi, [dataptr+4]
+       mov ecx, [dataptr+8]
+       rep stosb
+       mov [needclear], al
+       
+noclear:
+       mov eax, [dataptr+12]           ; jump into C
+       call eax
+
        mov al, 0x40                    ; ack the periodic IRQ
        mov dx, 0x834
        out dx, al
        
-       mov dx, 0x830
+       mov dx, 0x830                   ; now ack the SMI itself
        in al, dx
-       or al, 0x02                     ; now ack the SMI itself
+       or al, 0x02
        and al, 0xBF
        out dx, al
        or al, 0x40
@@ -104,6 +109,9 @@ continue:
 
        rsm                             ; and leave SMM
 
+needclear:
+       db 0x01
+
        align 0x4
 gdtr:
        db 0x27, 0x00
index 891c07587645a030341d06f01bc49432707414a1..edad0217a4a258607d1b55b992ba64c697a176ca 100644 (file)
@@ -3,7 +3,8 @@ char counter = 0;
 #define outb(port, val) \
 ({ asm volatile("outb %0, %%dx" : : "a" ((unsigned char)(val)) , "d" ((unsigned short)(port))); })
 
-void __start (void) {
+void __start (void)
+{
        counter++;
        outb (0x80, counter);
 }
This page took 0.032828 seconds and 4 git commands to generate.