Ver código fonte

Windows Server 2003 sulks if we feed it an empty region in base memory

as a result of our memory map editing, so strip out any empty regions.
tags/v0.9.3
Michael Brown 18 anos atrás
pai
commit
476d02051f
1 arquivos alterados com 42 adições e 4 exclusões
  1. 42
    4
      src/arch/i386/firmware/pcbios/e820mangler.S

+ 42
- 4
src/arch/i386/firmware/pcbios/e820mangler.S Ver arquivo

@@ -296,11 +296,19 @@ patch_e820:
296 296
 	.size patch_e820, . - patch_e820
297 297
 
298 298
 /****************************************************************************
299
- * INT 15,e820 handler
299
+ * Split E820 memory map entry if necessary
300
+ *
301
+ * Parameters:
302
+ *   As for INT 15,e820
303
+ * Returns:
304
+ *   As for INT 15,e820
305
+ *
306
+ * Calls the underlying INT 15,e820 and returns a modified memory map.
307
+ * Regions will be split around any hidden regions.
300 308
  ****************************************************************************
301 309
  */
302 310
 	.section ".text16"
303
-int15_e820:
311
+split_e820:
304 312
 	pushw	%si
305 313
 	pushw	%bp
306 314
 	/* Caller's %bx => %si, real %ebx to %ebx, call previous handler */
@@ -334,13 +342,43 @@ int15_e820:
334 342
 	popfw
335 343
 	popw	%bp
336 344
 	popw	%si
337
-	lret	$2
338
-	.size int15_e820, . - int15_e820
345
+	ret
346
+	.size split_e820, . - split_e820
339 347
 
340 348
 	.section ".text16.data"
341 349
 real_ebx:
342 350
 	.long 0
343 351
 	.size real_ebx, . - real_ebx
352
+
353
+/****************************************************************************
354
+ * INT 15,e820 handler
355
+ ****************************************************************************
356
+ */
357
+	.section ".text16"
358
+int15_e820:
359
+	pushl	%eax
360
+	pushl	%ecx
361
+	pushl	%edx	
362
+	call	split_e820
363
+	pushfw
364
+	jc	1f
365
+	/* Check for an empty region */
366
+	pushl	%eax
367
+	movl	%es:8(%di), %eax
368
+	orl	%es:12(%di), %eax
369
+	popl	%eax
370
+	jnz	1f
371
+	/* Strip empty regions out of the returned map */
372
+	popfw
373
+	popl	%edx
374
+	popl	%ecx
375
+	popl	%eax
376
+	jmp	int15_e820
377
+	/* Restore flags from original INT 15,e820 call and return */
378
+1:	popfw
379
+	leal	12(%esp), %esp /* avoid changing flags */
380
+	lret	$2
381
+	.size int15_e820, . - int15_e820
344 382
 	
345 383
 /****************************************************************************
346 384
  * INT 15,e801 handler

Carregando…
Cancelar
Salvar