/* Register store for realmode_call and realmode_interrupt */
__registers = RELOCATED(.)
- .long 0 /* 0x00 - EAX */
- .long 0 /* 0x04 - EBX */
- .long 0 /* 0x08 - ECX */
- .long 0 /* 0x0c - EDX */
- .long 0 /* 0x10 - EDI */
- .long 0 /* 0x14 - ESI */
+ .long 0 /* 0 - EAX */
+ .long 0 /* 4 - EBX */
+ .long 0 /* 8 - ECX */
+ .long 0 /* 12 - EDX */
+ .long 0 /* 16 - ESI */
+ .long 0 /* 20 - EDI */
+
+/* 256 byte buffer, used by int10 */
+ .globl __buffer
+__buffer = RELOCATED(.)
+ .skip 256
.code32
.globl __realmode_call
/* entry point */
movl 36(%ebp), %eax
- movw %ax, __lcall_instr + 1
+ mov %ax, __lcall_instr + 1
andl $0xffff0000, %eax
shrl $4, %eax
- movw %ax, __lcall_instr + 3
+ mov %ax, __lcall_instr + 3
/* initial register values */
movl 40(%ebp), %eax
- movl %eax, __registers + 0x00 /* eax */
+ movl %eax, __registers + 0 /* eax */
movl 44(%ebp), %eax
- movl %eax, __registers + 0x04 /* ebx */
+ movl %eax, __registers + 4 /* ebx */
movl 48(%ebp), %eax
- movl %eax, __registers + 0x08 /* ecx */
+ movl %eax, __registers + 8 /* ecx */
movl 52(%ebp), %eax
- movl %eax, __registers + 0x0c /* edx */
+ movl %eax, __registers + 12 /* edx */
movl 56(%ebp), %eax
- movl %eax, __registers + 0x10 /* esi */
+ movl %eax, __registers + 16 /* esi */
movl 60(%ebp), %eax
- movl %eax, __registers + 0x14 /* esi */
+ movl %eax, __registers + 20 /* edi */
/* Activate the right segment descriptor real mode. */
ljmp $0x28, $RELOCATED(1f)
mov %ax, %ds
lidt __realmode_idt
- /* Set all segments to 0x0000, ds to 0x0040 */
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- mov $0x40, %ax
- mov %ax, %ds
-
/* initialize registers for option rom lcall */
movl __registers + 0, %eax
movl __registers + 4, %ebx
movl __registers + 16, %esi
movl __registers + 20, %edi
+ /* Set all segments to 0x0000, ds to 0x0040 */
+ push %ax
+ xor %ax, %ax
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ mov $0x40, %ax
+ mov %ax, %ds
+ pop %ax
+
/* ************************************ */
__lcall_instr = RELOCATED(.)
.byte 0x9a
.word 0x0000, 0x0000
/* ************************************ */
- /* If we got here, just about done.
- * Need to get back to protected mode
+ /* If we got here, we are just about done.
+ * Need to get back to protected mode.
*/
movl %cr0, %eax
orl $PE, %eax
data32 ljmp $0x10, $RELOCATED(1f)
1:
.code32
- movw $0x18, %ax
+ mov $0x18, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
/* initial register values */
movl 40(%ebp), %eax
- movl %eax, __registers + 0x00 /* eax */
+ movl %eax, __registers + 0 /* eax */
movl 44(%ebp), %eax
- movl %eax, __registers + 0x04 /* ebx */
+ movl %eax, __registers + 4 /* ebx */
movl 48(%ebp), %eax
- movl %eax, __registers + 0x08 /* ecx */
+ movl %eax, __registers + 8 /* ecx */
movl 52(%ebp), %eax
- movl %eax, __registers + 0x0c /* edx */
+ movl %eax, __registers + 12 /* edx */
movl 56(%ebp), %eax
- movl %eax, __registers + 0x10 /* esi */
+ movl %eax, __registers + 16 /* esi */
movl 60(%ebp), %eax
- movl %eax, __registers + 0x14 /* esi */
+ movl %eax, __registers + 20 /* edi */
/* This configures CS properly for real mode. */
ljmp $0x28, $RELOCATED(1f)
data32 ljmp $0, $RELOCATED(1f)
1:
- /* put the stack at the end of page zero. That way we can easily
+ /* put the stack at the end of page zero. That way we can easily
* share it between real mode and protected mode, because %esp and
* %ss:%sp point to the same memory.
*/
mov %ax, %ds
lidt __realmode_idt
- /* Set all segments to 0x0000 */
- mov %ax, %ds
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
-
/* initialize registers for intXX call */
movl __registers + 0, %eax
movl __registers + 4, %ebx
movl __registers + 16, %esi
movl __registers + 20, %edi
+ /* Set all segments to 0x0000 */
+ push %ax
+ xor %ax, %ax
+ mov %ax, %ds
+ mov %ax, %es
+ mov %ax, %fs
+ mov %ax, %gs
+ pop %ax
+
__intXX_instr = RELOCATED(.)
.byte 0xcd, 0x00 /* This becomes intXX */
data32 ljmp $0x10, $RELOCATED(1f)
1:
.code32
- movw $0x18, %ax
+ mov $0x18, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
data32 ljmp $0x10, $RELOCATED(1f)
1:
.code32
- movw $0x18, %ax
+ mov $0x18, %ax
mov %ax, %ds
mov %ax, %es
mov %ax, %fs
mov %ax, %ds
lidt __realmode_idt
- /* Set up segment registers to segment 0x0000 */
- mov %ax, %es
- mov %ax, %fs
- mov %ax, %gs
- mov $0x40, %ax
- mov %ax, %ds
-
/* Restore all registers, including those
* manipulated by the C handler
*/