Skip to content

Commit f9d566f

Browse files
committed
[freeldr] Add PXE "filesystem"
svn path=/trunk/; revision=51517
1 parent d4e2921 commit f9d566f

File tree

12 files changed

+1112
-1
lines changed

12 files changed

+1112
-1
lines changed
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
/*
2+
* FreeLoader
3+
* Copyright (C) 2011 Hervé Poussineau
4+
*
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.
9+
*
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.
14+
*
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.
18+
*/
19+
20+
.text
21+
.code16
22+
23+
#define ASM
24+
25+
#include <arch.h>
26+
27+
/*
28+
* U16 PxeCallApi(U16 Segment, U16 Offset, U16 Service, VOID *Parameter);
29+
*
30+
* RETURNS:
31+
*/
32+
_pxe_function:
33+
.word 0
34+
_pxe_entry_point:
35+
.long 0
36+
_pxe_buffer_segment:
37+
.word0
38+
_pxe_buffer_offset:
39+
.word0
40+
_pxe_result:
41+
.word 0
42+
43+
EXTERN(_PxeCallApi)
44+
.code32
45+
pushl %ebp
46+
movl %esp,%ebp
47+
48+
pushal
49+
push %es
50+
51+
/* copy entry point */
52+
movl 0x08(%ebp),%eax
53+
shll $16,%eax
54+
movw 0x0C(%ebp),%ax
55+
movl %eax,_pxe_entry_point
56+
57+
/* copy function */
58+
movw 0x10(%ebp),%ax
59+
movw %ax,_pxe_function
60+
61+
/* convert pointer to data buffer to segment/offset */
62+
movl 0x14(%ebp),%eax
63+
shrl $4,%eax
64+
andl $0xf000,%eax
65+
movw %ax,_pxe_buffer_segment
66+
movl 0x14(%ebp),%eax
67+
andl $0xffff,%eax
68+
movw %ax,_pxe_buffer_offset
69+
70+
call switch_to_real
71+
.code16
72+
73+
movw _pxe_buffer_segment,%ax
74+
push %ax
75+
movw _pxe_buffer_offset,%ax
76+
push %ax
77+
movw _pxe_function,%ax
78+
push %ax
79+
lcall *_pxe_entry_point
80+
addw $6,%sp
81+
movw %ax,_pxe_result
82+
83+
call switch_to_prot
84+
.code32
85+
86+
pop %es
87+
popal
88+
89+
movl %ebp,%esp
90+
popl %ebp
91+
92+
movw _pxe_result,%ax
93+
94+
ret
95+
96+
/* EOF */
97+

reactos/boot/freeldr/freeldr/arch/i386/machpc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ PcMachInit(const char *CmdLine)
4343
MachVtbl.Beep = PcBeep;
4444
MachVtbl.PrepareForReactOS = PcPrepareForReactOS;
4545
MachVtbl.GetMemoryMap = PcMemGetMemoryMap;
46-
MachVtbl.DiskGetBootPath = DiskGetBootPath;
46+
MachVtbl.DiskGetBootPath = PcDiskGetBootPath;
4747
MachVtbl.DiskReadLogicalSectors = PcDiskReadLogicalSectors;
4848
MachVtbl.DiskGetDriveGeometry = PcDiskGetDriveGeometry;
4949
MachVtbl.DiskGetCacheableBlockCount = PcDiskGetCacheableBlockCount;

reactos/boot/freeldr/freeldr/arch/i386/pcdisk.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,4 +367,15 @@ PcDiskGetCacheableBlockCount(ULONG DriveNumber)
367367
}
368368
}
369369

370+
BOOLEAN
371+
PcDiskGetBootPath(char *BootPath, unsigned Size)
372+
{
373+
if (PxeInit())
374+
{
375+
strcpy(BootPath, "net(0)");
376+
return 0;
377+
}
378+
return DiskGetBootPath(BootPath, Size);
379+
}
380+
370381
/* EOF */

reactos/boot/freeldr/freeldr/freeldr_base.rbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<file>fs.c</file>
3434
<file>iso.c</file>
3535
<file>ntfs.c</file>
36+
<file>pxe.c</file>
3637
</directory>
3738
<directory name="inifile">
3839
<file>ini_init.c</file>

reactos/boot/freeldr/freeldr/freeldr_base64k.rbuild

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<file>i386cpu.S</file>
1313
<file>i386idt.S</file>
1414
<file>i386pnp.S</file>
15+
<file>i386pxe.S</file>
1516
<file>i386trap.S</file>
1617
<file>int386.S</file>
1718
<file>linux.S</file>

reactos/boot/freeldr/freeldr/fs/fs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@ LONG ArcOpen(CHAR* Path, OPENMODE OpenMode, ULONG* FileId)
338338
FileData[DeviceId].FileFuncTable = NtfsMount(DeviceId);
339339
if (!FileData[DeviceId].FileFuncTable)
340340
FileData[DeviceId].FileFuncTable = Ext2Mount(DeviceId);
341+
#endif
342+
#ifdef _M_IX86
343+
if (!FileData[DeviceId].FileFuncTable)
344+
FileData[DeviceId].FileFuncTable = PxeMount(DeviceId);
341345
#endif
342346
if (!FileData[DeviceId].FileFuncTable)
343347
{

0 commit comments

Comments
 (0)