[FREELDR]

Convert drvmap.S to intel syntax

svn path=/trunk/; revision=52308
This commit is contained in:
Timo Kreuzer 2011-06-17 12:04:25 +00:00
parent 08f9d937f5
commit 6efa9f00e1

View file

@ -17,83 +17,92 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/ */
.text
.code16
#include <asm.inc>
#include <arch/pc/x86common.h> #include <arch/pc/x86common.h>
EXTERN(_DriveMapInt13HandlerStart) .code16
PUBLIC _DriveMapInt13HandlerStart
_DriveMapInt13HandlerStart:
Int13Handler: Int13Handler:
pushw %bp push bp
movw %sp,%bp mov bp, sp
pushw %ax push ax
pushw %cx push cx
pushw %si push si
cld cld
/* Get callers flags from stack */ /* Get callers flags from stack */
movw 0x06(%bp),%ax mov ax, [bp + 6]
movw %ax,%cs:(CallersFlags - Int13Handler) mov word ptr cs:[CallersFlags - Int13Handler], ax
/* Save the drive number they passed in */ /* Save the drive number they passed in */
movb %dl,%cs:(PassedInDriveNumber - Int13Handler) mov cs:[PassedInDriveNumber - Int13Handler], dl
/* Now we need to perform the mapping */ /* Now we need to perform the mapping */
xorw %cx,%cx xor cx, cx
movw $(Int13HandlerMapCount - Int13Handler),%si mov si, offset Int13HandlerMapCount - Int13Handler
/* Get the count of drives in the map list */ /* Get the count of drives in the map list */
movb %cs:(%si),%cl mov cl, cs:[si]
incw %si inc si
/* If the map list is empty then just call the old int 13h handler */ /* If the map list is empty then just call the old int 13h handler */
cmpb $0,%cl cmp cl, 0
jz CallOldInt13Handler jz CallOldInt13Handler
GetMappedDriveNumberLoop: GetMappedDriveNumberLoop:
/* Get the next drive number in the list */ /* Get the next drive number in the list */
lodsw %cs:(%si),%ax lods ax, cs:[si]
/* Check to see if it's the one they are calling int 13h for */ /* Check to see if it's the one they are calling int 13h for */
cmpb %al,%dl cmp dl, al
/* If not get the next one */ /* If not get the next one */
jne GetMappedDriveNumberLoopNext jne GetMappedDriveNumberLoopNext
/* If we get here then we have found a mapped drive */ /* If we get here then we have found a mapped drive */
/* Send new drive number on to the old int 13h handler */ /* Send new drive number on to the old int 13h handler */
movb %ah,%dl mov dl, ah
/* Call BIOS Int 13 Handler */ /* Call BIOS Int 13 Handler */
jmp CallOldInt13Handler jmp CallOldInt13Handler
GetMappedDriveNumberLoopNext: GetMappedDriveNumberLoopNext:
loop GetMappedDriveNumberLoop loop GetMappedDriveNumberLoop
CallOldInt13Handler: CallOldInt13Handler:
/* Restore the registers we changed off the stack */ /* Restore the registers we changed off the stack */
popw %si pop si
popw %cx pop cx
popw %ax pop ax
/* Put flags onto stack */ /* Put flags onto stack */
pushw %cs:(CallersFlags - Int13Handler) push word ptr cs:[CallersFlags - Int13Handler]
/* Call old int 13h handler with new drive number */ /* Call old int 13h handler with new drive number */
.byte 0x9a /* lcall */ .byte HEX(9a) /* lcall */
EXTERN(_DriveMapOldInt13HandlerAddress) PUBLIC _DriveMapOldInt13HandlerAddress
_DriveMapOldInt13HandlerAddress:
.word 0 .word 0
.word 0 .word 0
/* Update the callers flags with the values the BIOS returned */ /* Update the callers flags with the values the BIOS returned */
pushw %ax push ax
pushf pushf
popw %ax pop ax
movw %ax,0x06(%bp) mov [bp + 6], ax
popw %ax pop ax
/* Restore the callers drive number */
movb %cs:(PassedInDriveNumber - Int13Handler),%dl
popw %bp /* Restore the callers drive number */
mov dl, cs:[PassedInDriveNumber - Int13Handler]
pop bp
iret iret
@ -103,7 +112,8 @@ CallersFlags:
PassedInDriveNumber: PassedInDriveNumber:
.byte 0 .byte 0
EXTERN(_DriveMapInt13HandlerMapList) PUBLIC _DriveMapInt13HandlerMapList
_DriveMapInt13HandlerMapList:
Int13HandlerMapCount: Int13HandlerMapCount:
.byte 0 .byte 0
@ -127,4 +137,6 @@ Int13HandlerDrive4:
Int13HandlerDriveNew4: Int13HandlerDriveNew4:
.byte 0 .byte 0
EXTERN(_DriveMapInt13HandlerEnd) PUBLIC _DriveMapInt13HandlerEnd
_DriveMapInt13HandlerEnd:
.byte 0