/* ------------------- End of setup header --------------------------- */
/*
- * Canonicalize CS to match the other segments; also, the C
- * code uses 32-bit registers to make sure the high part of
- * %esp is zero.
+ * Canonicalize CS to match the other segments
*/
start:
- .byte 0x66,0x0f,0xb7,0xe4 # movzwl %sp,%esp
pushw %ds
- pushw $main
+ pushw $start2
lret
-main:
- sti
+start2:
+/*
+ * Set up the operating environment expected by the C code.
+ * The C code uses 32-bit registers to make sure the high part of
+ * %esp is zero.
+ *
+ * The C code expects %cs == %ds == %es, and %fs == 0.
+ */
+ .byte 0x66,0x0f,0xb7,0xe4 # movzwl %sp,%esp
+ pushw %ds
+ popw %es
+ xorw %ax,%ax
+ movw %ax,%fs
+ sti # We may want to kill this?
calll setup # Call the C code
# The setup function returns the drive number,
# which should be returned in %dl
for(;;);
- /* Point %fs to the zero page */
- asm volatile("movw %0,%%fs" :: "r" (0));
-
geometry = get_disk_image_geometry(shdr->ramdisk_image, shdr->ramdisk_size);
get_mem();