Author: arty
Date: Tue Aug 29 10:28:13 2006
New Revision: 23764
URL:
http://svn.reactos.org/svn/reactos?rev=23764&view=rev
Log:
Fixed support for disk and filesystem. We're reading files normally.
Now working on display modes and character input.
Modified:
branches/powerpc/reactos/boot/freeldr/bootsect/ofw_util.s
branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
branches/powerpc/reactos/boot/freeldr/freeldr/fs/fs.c
branches/powerpc/reactos/boot/freeldr/freeldr/include/arch.h
branches/powerpc/reactos/boot/freeldr/freeldr/include/of.h
branches/powerpc/reactos/tools/ofw_interface/calls.ofw
Modified: branches/powerpc/reactos/boot/freeldr/bootsect/ofw_util.s
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/bo…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/bootsect/ofw_util.s (original)
+++ branches/powerpc/reactos/boot/freeldr/bootsect/ofw_util.s Tue Aug 29 10:28:13 2006
@@ -50,7 +50,8 @@
mr %r5,%r6
mr %r6,%r7
mr %r7,%r8
-
+ mr %r8,%r9
+
/* Goto the swapped function */
bctrl
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c Tue Aug 29 10:28:13
2006
@@ -169,11 +169,16 @@
*/
ULONG PpcGetMemoryMap( PBIOS_MEMORY_MAP BiosMemoryMap,
ULONG MaxMemoryMapSize ) {
- int i, memhandle, returned, total = 0, num_mem = 0;
+ int i, memhandle, mmuhandle, returned, total = 0, num_mem = 0;
int memdata[256];
+
+ printf("PpcGetMemoryMap(%d)\n", MaxMemoryMapSize);
ofw_getprop(chosen_package, "memory",
(char *)&memhandle, sizeof(memhandle));
+ ofw_getprop(chosen_package, "mmu",
+ (char *)&mmuhandle, sizeof(mmuhandle));
+
returned = ofw_getprop(memhandle, "available",
(char *)memdata, sizeof(memdata));
@@ -188,6 +193,10 @@
BiosMemoryMap[num_mem].Length = TOTAL_HEAP_NEEDED;
ofw_claim(BiosMemoryMap[num_mem].BaseAddress,
BiosMemoryMap[num_mem].Length, 0x1000); /* claim it */
+ printf("virt2phys(%x)->%x\n",
+ BiosMemoryMap[num_mem].BaseAddress,
+ ofw_virt2phys
+ (mmuhandle, BiosMemoryMap[num_mem].BaseAddress));
total += BiosMemoryMap[0].Length;
num_mem++;
}
@@ -237,7 +246,7 @@
}
BOOLEAN PpcDiskReadLogicalSectors( ULONG DriveNumber, ULONGLONG SectorNumber,
- ULONG SectorCount, PVOID Buffer ) {
+ ULONG SectorCount, PVOID Buffer ) {
int rlen = 0;
if( part_handle == -1 ) {
@@ -254,11 +263,13 @@
return FALSE;
}
- if( ofw_seek( part_handle, SectorNumber * 512 ) ) {
- printf("Seek to %x failed\n", SectorNumber * 512);
+ if( ofw_seek( part_handle,
+ (ULONG)(SectorNumber >> 25),
+ (ULONG)((SectorNumber * 512) & 0xffffffff) ) ) {
+ printf("Seek to %x failed\n", (ULONG)(SectorNumber * 512));
return FALSE;
}
- rlen = ofw_read( part_handle, Buffer, SectorCount * 512 );
+ rlen = ofw_read( part_handle, Buffer, (ULONG)(SectorCount * 512) );
return rlen > 0;
}
@@ -293,15 +304,25 @@
typedef unsigned int uint32_t;
void PpcInit( of_proxy the_ofproxy ) {
- int len;
+ int len, stdin_handle_chosen;
ofproxy = the_ofproxy;
- ofw_print_string("Made it into freeldr LE code ... bootstrap complete\n");
+ ofw_print_string("Freeldr PowerPC Init\n");
chosen_package = ofw_finddevice( "/chosen" );
+ ofw_print_string("Freeldr: chosen_package is ");
+ ofw_print_number(chosen_package);
+ ofw_print_string("\n");
+
ofw_getprop( chosen_package, "stdin",
- (char *)&stdin_handle, sizeof(stdin_handle) );
+ (char *)&stdin_handle_chosen, sizeof(stdin_handle_chosen) );
+
+ ofw_print_string("Freeldr: stdin_handle is ");
+ ofw_print_number(stdin_handle_chosen);
+ ofw_print_string("\n");
+
+ stdin_handle = stdin_handle_chosen;
/* stdin_handle = REV(stdin_handle); */
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/fs/fs.c
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/fs/fs.c (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/fs/fs.c Tue Aug 29 10:28:13 2006
@@ -27,6 +27,7 @@
/////////////////////////////////////////////////////////////////////////////////////////////
ULONG FsType = 0; // Type of filesystem on boot device, set by FsOpenVolume()
+PVOID FsStaticBufferDisk = 0, FsStaticBufferData = 0;
/////////////////////////////////////////////////////////////////////////////////////////////
// FUNCTIONS
@@ -51,8 +52,20 @@
{
CHAR ErrorText[80];
+ printf("FsOpenVolume: (disk=%d,start=%d,count=%d,type=%d)\n",
+ DriveNumber, StartSector, SectorCount, Type);
+
FsType = Type;
+ if( !FsStaticBufferDisk )
+ FsStaticBufferDisk = MmAllocateMemory( 0x20000 );
+ if( !FsStaticBufferDisk )
+ {
+ FileSystemError("could not allocate filesystem static buffer");
+ return FALSE;
+ }
+ FsStaticBufferData = ((PCHAR)FsStaticBufferDisk) + 0x10000;
+
switch (FsType)
{
case FS_FAT:
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/include/arch.h
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/include/arch.h (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/include/arch.h Tue Aug 29 10:28:13 2006
@@ -34,11 +34,17 @@
#define STACK16ADDR 0x7000 /* The 16-bit stack top will be at 0000:7000 */
#define STACK32ADDR 0x78000 /* The 32-bit stack top will be at 7000:8000, or 0x78000 */
+#ifdef _M_IX86
#define BIOSCALLBUFFER 0x78000 /* Buffer to store temporary data for any Int386() call
*/
#define BIOSCALLBUFSEGMENT 0x7800 /* Buffer to store temporary data for any Int386() call
*/
#define BIOSCALLBUFOFFSET 0x0000 /* Buffer to store temporary data for any Int386() call
*/
#define FILESYSBUFFER 0x80000 /* Buffer to store file system data (e.g. cluster buffer
for FAT) */
#define DISKREADBUFFER 0x90000 /* Buffer to store data read in from the disk via the
BIOS */
+#elif defined(_M_PPC)
+extern PVOID FsStaticBufferDisk, FsStaticBufferData;
+#define DISKREADBUFFER FsStaticBufferDisk
+#define FILESYSBUFFER FsStaticBufferData
+#endif
/* Makes "x" a global variable or label */
#define EXTERN(x) .global x; x:
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/include/of.h
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/include/of.h (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/include/of.h Tue Aug 29 10:28:13 2006
@@ -10,7 +10,7 @@
#include <string.h>
typedef int (*of_proxy)
- ( int table_off, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5 );
+ ( int table_off, void *arg1, void *arg2, void *arg3, void *arg4, void *arg5, void
*arg6 );
typedef long jmp_buf[100];
extern of_proxy ofproxy;
extern void le_swap( void *begin, void *end, void *dest );
Modified: branches/powerpc/reactos/tools/ofw_interface/calls.ofw
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ofw_inter…
==============================================================================
--- branches/powerpc/reactos/tools/ofw_interface/calls.ofw (original)
+++ branches/powerpc/reactos/tools/ofw_interface/calls.ofw Tue Aug 29 10:28:13 2006
@@ -8,7 +8,7 @@
exit 0 0
child 1 1 int int
peer 1 1 int int
-seek 2 1 int int int
+seek 3 1 int int int int
# MMU methods
# claim (virt size align -- base)
claim 3 1 int int int int