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.
21 #include <arch/pc/x86common.h>
25 PUBLIC _DriveMapInt13HandlerStart
26 _DriveMapInt13HandlerStart:
37 /* Get callers flags from stack */
39 mov word ptr cs:[CallersFlags - Int13Handler], ax
41 /* Save the drive number they passed in */
42 mov byte ptr cs:[PassedInDriveNumber - Int13Handler], dl
44 /* Now we need to perform the mapping */
46 mov si, offset Int13HandlerMapCount - Int13Handler
48 /* Get the count of drives in the map list */
49 mov cl, byte ptr cs:[si]
52 /* If the map list is empty then just call the old int 13h handler */
54 jz CallOldInt13Handler
56 GetMappedDriveNumberLoop:
58 /* Get the next drive number in the list (store it in AX) */
61 /* Check to see if it's the one they are calling int 13h for */
64 /* If not get the next one */
65 jne GetMappedDriveNumberLoopNext
67 /* If we get here then we have found a mapped drive */
68 /* Send new drive number on to the old int 13h handler */
71 /* Call BIOS Int 13 Handler */
72 jmp CallOldInt13Handler
74 GetMappedDriveNumberLoopNext:
75 loop GetMappedDriveNumberLoop
78 /* Restore the registers we changed off the stack */
83 /* Put flags onto stack */
84 push word ptr cs:[CallersFlags - Int13Handler]
86 /* Call old int 13h handler with new drive number */
87 .byte HEX(9a) /* lcall */
88 PUBLIC _DriveMapOldInt13HandlerAddress
89 _DriveMapOldInt13HandlerAddress:
93 /* Update the callers flags with the values the BIOS returned */
100 /* Restore the callers drive number */
101 mov dl, byte ptr cs:[PassedInDriveNumber - Int13Handler]
113 /* See the DRIVE_MAP_LIST structure in include/arch/i386/drivemap.h */
114 PUBLIC _DriveMapInt13HandlerMapList
115 _DriveMapInt13HandlerMapList:
116 Int13HandlerMapCount:
121 Int13HandlerDriveNew1:
126 Int13HandlerDriveNew2:
131 Int13HandlerDriveNew3:
136 Int13HandlerDriveNew4:
139 PUBLIC _DriveMapInt13HandlerEnd
140 _DriveMapInt13HandlerEnd: