3 * Copyright (C) 1998-2002 Brian Palmer <brianp@sginet.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include <arch/pc/x86common.h>
25 EXTERN(DriveMapInt13HandlerStart)
36 /* Get callers flags from stack */
38 movw %ax,%cs:(CallersFlags - Int13Handler)
40 /* Save the drive number they passed in */
41 movb %dl,%cs:(PassedInDriveNumber - Int13Handler)
43 /* Now we need to perform the mapping */
45 movw $(Int13HandlerMapCount - Int13Handler),%si
46 /* Get the count of drives in the map list */
50 /* If the map list is empty then just call the old int 13h handler */
52 jz CallOldInt13Handler
54 GetMappedDriveNumberLoop:
56 /* Get the next drive number in the list */
58 /* Check to see if it's the one they are calling int 13h for */
60 /* If not get the next one */
61 jne GetMappedDriveNumberLoopNext
63 /* If we get here then we have found a mapped drive */
64 /* Send new drive number on to the old int 13h handler */
66 /* Call BIOS Int 13 Handler */
67 jmp CallOldInt13Handler
69 GetMappedDriveNumberLoopNext:
70 loop GetMappedDriveNumberLoop
73 /* Restore the registers we changed off the stack */
78 /* Put flags onto stack */
79 pushw %cs:(CallersFlags - Int13Handler)
81 /* Call old int 13h handler with new drive number */
82 .byte 0x9a /* lcall */
83 EXTERN(DriveMapOldInt13HandlerAddress)
87 /* Update the callers flags with the values the BIOS returned */
93 /* Restore the callers drive number */
94 movb %cs:(PassedInDriveNumber - Int13Handler),%dl
106 EXTERN(DriveMapInt13HandlerMapList)
107 Int13HandlerMapCount:
112 Int13HandlerDriveNew1:
117 Int13HandlerDriveNew2:
122 Int13HandlerDriveNew3:
127 Int13HandlerDriveNew4:
130 EXTERN(DriveMapInt13HandlerEnd)