EXTERN _InitIdt:PROC
EXTERN _i386Idt:DWORD
//EXTERN _i386idtptr:FWORD
+EXTERN cmdline:DWORD
+
+#ifdef _USE_ML
+EXTERN __bss_start__:DWORD
+EXTERN __bss_end__:DWORD
+#endif
.code32
_FrldrStartup:
+ASSUME /*CS:_TEXT,*/ DS:_DATA, ES:_DATA, FS:_DATA, GS:_DATA, SS:_DATA
+
/* Store BootDrive and BootPartition */
mov byte ptr ds:[_FrldrBootDrive], dl
xor eax, eax
mov eax, dword ptr ds:[BSS_RealModeEntry]
mov dword ptr ds:[SwitchToReal16Address], eax
- /* Initialize the idt */
- call _InitIdt
-
-#ifndef _USE_ML
- /* Clean out bss */
+ /* Clean out BSS */
xor eax, eax
mov edi, offset __bss_start__
mov ecx, offset __bss_end__ + 3
shr ecx, 2
rep stosd
+ /* Initialize the idt */
+ call _InitIdt
+
/* Pass the command line to BootMain */
mov eax, offset cmdline
-#else
- xor eax, eax
-#endif
/* GO! */
push eax
/* We should never get here */
stop:
- jmp stop
+ jmp short stop
nop
nop
mov ss, ax
/* Save 32-bit stack pointer */
- mov dword ptr [stack32], esp
+ mov dword ptr ds:[stack32], esp
/* jmp to 16-bit segment to set the limit correctly */
.byte HEX(0ea) // jmp far RMODE_CS:switch_to_real16
.word HEX(27) /* Limit */
.long gdt /* Base Address */
-/* Real-mode IDT pointer */
-rmode_idtptr:
- .word HEX(3ff) /* Limit */
- .long 0 /* Base Address */
-
+// See _i386IdtDescriptor
PUBLIC i386idtptr
i386idtptr:
.word 255 /* Limit */