Author: arty
Date: Mon Apr 16 17:48:22 2007
New Revision: 26364
URL:
http://svn.reactos.org/svn/reactos?rev=26364&view=rev
Log:
Streamline freeldr now that we're in BE all the way.
Added:
branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/ofw_util.s
Removed:
branches/powerpc/reactos/boot/freeldr/bootsect/ofw_util.s
branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s
Modified:
branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s
branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/mach.c
branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild
branches/powerpc/reactos/tools/ofw_interface/calls.ofw
branches/powerpc/reactos/tools/ofw_interface/ofw_interface.cpp
branches/powerpc/reactos/tools/ofw_interface/ofw_interface.mak
branches/powerpc/reactos/tools/ppc.lost+found/link-freeldr
Removed: 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 (removed)
@@ -1,445 +1,0 @@
- .section .text
- .globl ofw_functions
- .globl ofw_call_addr
-call_ofw:
- /* R3 has the function offset to call (n * 4)
- * Other arg registers are unchanged. */
- subi %r1,%r1,0x100
- stw %r8,24(%r1)
- mflr %r8
- stw %r8,0(%r1)
- stw %r3,4(%r1)
- stw %r4,8(%r1)
- stw %r5,12(%r1)
- stw %r6,16(%r1)
- stw %r7,20(%r1)
- stw %r9,28(%r1)
- stw %r10,32(%r1)
- stw %r20,36(%r1)
-
- lis %r10,0xe00000@ha
- addi %r8,%r10,ofw_functions@l
- add %r8,%r3,%r8
- lwz %r9,0(%r8)
- mtctr %r9
-
- mr %r3,%r4
- mr %r4,%r5
- mr %r5,%r6
- mr %r6,%r7
- mr %r7,%r8
- mr %r8,%r9
-
- /* Call ofw proxy function */
- bctrl
-
- lwz %r8,0(%r1)
- mtlr %r8
- lwz %r4,8(%r1)
- lwz %r5,12(%r1)
- lwz %r6,16(%r1)
- lwz %r7,20(%r1)
- lwz %r8,24(%r1)
- lwz %r9,28(%r1)
- lwz %r10,32(%r1)
- lwz %r20,36(%r1)
- addi %r1,%r1,0x100
- blr
-
-prim_strlen:
- mr %r5,%r3
-prim_strlen_loop:
- lbz %r4,0(%r3)
- cmpi 0,0,%r4,0
- beq prim_strlen_done
- addi %r3,%r3,1
- b prim_strlen_loop
-
-prim_strlen_done:
- sub %r3,%r3,%r5
- blr
-
-copy_bits:
- cmp 0,0,%r3,%r4
- bgelr
-
- andi. %r6,%r3,0xfff
- beql ofw_dumpregs
- mtdec %r3
-
- lwz %r6,0(%r3)
- stw %r6,0(%r5)
- addi %r3,%r3,4
- addi %r5,%r5,4
- b copy_bits
-
-ofw_print_string:
- /* Reserve some stack space */
- subi %r1,%r1,32
-
- /* Save args */
- stw %r3,0(%r1)
-
- /* Save the lr, a scratch register */
- stw %r8,8(%r1)
- mflr %r8
- stw %r8,12(%r1)
-
- /* Load the package name */
- lis %r3,0xe00000@ha
- addi %r3,%r3,ofw_chosen_name - _start
-
- /* Fire */
- bl ofw_finddevice
-
- /* Load up for getprop */
- stw %r3,16(%r1)
-
- lis %r4,0xe00000@ha
- addi %r4,%r4,ofw_stdout_name - _start
-
- addi %r5,%r1,20
-
- li %r6,4
-
- bl ofw_getprop
-
- /* Measure the string and remember the length */
- lwz %r3,0(%r1)
- bl prim_strlen
- mr %r5,%r3
-
- lwz %r3,20(%r1)
- lwz %r4,0(%r1)
-
- /* Write the string */
- bl ofw_write
-
- /* Return */
- lwz %r8,12(%r1)
- mtlr %r8
- lwz %r8,8(%r1)
-
- addi %r1,%r1,32
- blr
-
- /* Print 8 hex digits representing a number in r3 */
-ofw_print_number:
- subi %r1,%r1,32
- stw %r8,0(%r1)
- mflr %r8
- stw %r8,4(%r1)
- stw %r9,8(%r1)
-
- xor %r9,%r9,%r9
- stw %r9,12(%r1)
-
- /* Set up and, devide, shift */
- mr %r8,%r3
- lis %r6,0xf0000000@ha
- lis %r7,0x10000000@ha
- li %r9,8
-
-ofw_number_loop:
- nop
- cmpi 0,0,%r9,0
- beq ofw_number_return
- subi %r9,%r9,1
-
- /* Body: isolate digit, divide, print */
- and %r5,%r6,%r8
- divwu %r4,%r5,%r7
- srwi %r6,%r6,4
- srwi %r7,%r7,4
-
- nop
-
- cmpi 0,0,%r4,10
- bge ofw_number_letter
- addi %r4,%r4,'0'
- b ofw_number_digit_out
-
-ofw_number_letter:
- addi %r4,%r4,'A' - 10
-
-ofw_number_digit_out:
- stb %r4,12(%r1)
- addi %r3,%r1,12
-
- stw %r6,16(%r1)
- stw %r7,20(%r1)
- stw %r8,24(%r1)
- stw %r9,28(%r1)
-
- bl ofw_print_string
-
- lwz %r6,16(%r1)
- lwz %r7,20(%r1)
- lwz %r8,24(%r1)
- lwz %r9,28(%r1)
-
- b ofw_number_loop
-
-ofw_number_return:
- /* Return */
- lwz %r9,8(%r1)
- lwz %r8,4(%r1)
- mtlr %r8
- lwz %r8,0(%r1)
- addi %r1,%r1,32
- blr
-
-ofw_print_eol:
- subi %r1,%r1,16
- stw %r8,0(%r1)
- mflr %r8
- stw %r8,4(%r1)
- li %r4,0x0d0a
- sth %r4,8(%r1)
- xor %r4,%r4,%r4
- sth %r4,10(%r1)
- addi %r3,%r1,8
- bl ofw_print_string
- lwz %r8,4(%r1)
- mtlr %r8
- lwz %r8,0(%r1)
- addi %r1,%r1,16
- blr
-
-ofw_print_nothing:
- subi %r1,%r1,16
- stw %r8,0(%r1)
- mflr %r8
- stw %r8,4(%r1)
- li %r4,0
- sth %r4,8(%r1)
- xor %r4,%r4,%r4
- sth %r4,10(%r1)
- addi %r3,%r1,8
- bl ofw_print_string
- lwz %r8,4(%r1)
- mtlr %r8
- lwz %r8,0(%r1)
- addi %r1,%r1,16
- blr
-
-ofw_print_space:
- subi %r1,%r1,16
- stw %r8,0(%r1)
- mflr %r8
- stw %r8,4(%r1)
- li %r4,0x2000
- sth %r4,8(%r1)
- xor %r4,%r4,%r4
- sth %r4,10(%r1)
- addi %r3,%r1,8
- bl ofw_print_string
- lwz %r8,4(%r1)
- mtlr %r8
- lwz %r8,0(%r1)
- addi %r1,%r1,16
- blr
-
-ofw_dumpregs:
- /* Construct ofw exit call */
- subi %r1,%r1,0xa0
-
- stw %r0,0(%r1)
- stw %r1,4(%r1)
- stw %r2,8(%r1)
- stw %r3,12(%r1)
-
- stw %r4,16(%r1)
- stw %r5,20(%r1)
- stw %r6,24(%r1)
- stw %r7,28(%r1)
-
- stw %r8,32(%r1)
- stw %r9,36(%r1)
- stw %r10,40(%r1)
- stw %r11,44(%r1)
-
- stw %r12,48(%r1)
- stw %r13,52(%r1)
- stw %r14,56(%r1)
- stw %r15,60(%r1)
-
- stw %r16,64(%r1)
- stw %r17,68(%r1)
- stw %r18,72(%r1)
- stw %r19,76(%r1)
-
- stw %r20,80(%r1)
- stw %r21,84(%r1)
- stw %r22,88(%r1)
- stw %r23,92(%r1)
-
- stw %r24,96(%r1)
- stw %r25,100(%r1)
- stw %r26,104(%r1)
- stw %r27,108(%r1)
-
- stw %r28,112(%r1)
- stw %r29,116(%r1)
- stw %r30,120(%r1)
- stw %r31,124(%r1)
-
- mflr %r0
- stw %r0,128(%r1)
- mfcr %r0
- stw %r0,132(%r1)
- mfctr %r0
- stw %r0,136(%r1)
- mfmsr %r0
- stw %r0,140(%r1)
-
- /* Count at zero */
- xor %r0,%r0,%r0
- stw %r0,144(%r1)
- mr %r3,%r1
- stw %r3,148(%r1)
-
- /* Body, print the regname, then the register */
-ofw_register_loop:
- lwz %r3,144(%r1)
- cmpi 0,0,%r3,32
- beq ofw_register_special
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_init - _start
- bl ofw_print_string
- lwz %r3,144(%r1)
- bl ofw_print_number
- bl ofw_print_space
- lwz %r3,144(%r1)
- mulli %r3,%r3,4
- add %r3,%r1,%r3
- lwz %r3,0(%r3)
- stw %r3,152(%r1)
- bl ofw_print_number
- lwz %r3,144(%r1)
- addi %r3,%r3,1
- stw %r3,144(%r1)
-
- bl ofw_print_space
-
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_init - _start
- bl ofw_print_string
- lwz %r3,144(%r1)
- bl ofw_print_number
- bl ofw_print_space
- lwz %r3,144(%r1)
- mulli %r3,%r3,4
- add %r3,%r1,%r3
- lwz %r3,0(%r3)
- stw %r3,152(%r1)
- bl ofw_print_number
- lwz %r3,144(%r1)
- addi %r3,%r3,1
- stw %r3,144(%r1)
-
- b done_dump
-
-dump_optional:
- bl ofw_print_space
- bl ofw_print_space
- lwz %r3,152(%r1)
- lwz %r3,0(%r3)
- bl ofw_print_number
- bl ofw_print_space
- lwz %r3,152(%r1)
- lwz %r3,4(%r3)
- bl ofw_print_number
- bl ofw_print_space
- lwz %r3,152(%r1)
- lwz %r3,8(%r3)
- bl ofw_print_number
- bl ofw_print_space
- lwz %r3,152(%r1)
- lwz %r3,12(%r3)
- bl ofw_print_number
- bl ofw_print_space
-done_dump:
- bl ofw_print_eol
- b ofw_register_loop
-
-ofw_register_special:
- /* LR */
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_lr - _start
- bl ofw_print_string
- bl ofw_print_space
- lwz %r3,128(%r1)
- bl ofw_print_number
- bl ofw_print_eol
-
- /* CR */
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_cr - _start
- bl ofw_print_string
- bl ofw_print_space
- lwz %r3,132(%r1)
- bl ofw_print_number
- bl ofw_print_eol
-
- /* CTR */
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_ctr - _start
- bl ofw_print_string
- bl ofw_print_space
- lwz %r3,136(%r1)
- bl ofw_print_number
- bl ofw_print_eol
-
- /* MSR */
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_reg_msr - _start
- bl ofw_print_string
- bl ofw_print_space
- lwz %r3,140(%r1)
- bl ofw_print_number
- bl ofw_print_eol
-
- /* Return */
- lwz %r0,128(%r1)
- mtlr %r0
-
- lwz %r0,0(%r1)
- lwz %r2,8(%r1)
- lwz %r3,12(%r1)
-
- lwz %r4,16(%r1)
- lwz %r5,20(%r1)
- lwz %r6,24(%r1)
- lwz %r7,28(%r1)
-
- addi %r1,%r1,0xa0
-
- blr
-
-ofw_chosen_name:
- .ascii "/chosen\0"
-
-ofw_stdout_name:
- .ascii "stdout\0"
-
-ofw_memory_name:
- .ascii "/memory@0\0"
-
-ofw_reg_name:
- .ascii "reg\0"
-
-freeldr_reg_init:
- .ascii "r\0"
-
-freeldr_reg_lr:
- .ascii "lr \0"
-
-freeldr_reg_cr:
- .ascii "cr \0"
-
-freeldr_reg_ctr:
- .ascii "ctr\0"
-
-freeldr_reg_msr:
- .ascii "msr\0"
Removed: branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/bo…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s (original)
+++ branches/powerpc/reactos/boot/freeldr/bootsect/ofwboot.s (removed)
@@ -1,105 +1,0 @@
- .section .text
-
-_start:
- .long 0xe00000 + 12
- .long 0
- .long 0
-
- .globl _begin
- .globl call_ofw
- .globl ofw_functions
-_begin:
- sync
- isync
-
- lis %r1,stack@ha
- addi %r1,%r1,stack@l
- addi %r1,%r1,16384 - 0x10
-
- /* Store ofw call addr */
- mr %r21,%r5
- lis %r10,0xe00000@ha
- stw %r5,ofw_call_addr - _start@l(%r10)
-
- lis %r3,0xe00000@ha
- addi %r3,%r3,freeldr_banner - _start
-
- bl ofw_print_string
- bl ofw_print_eol
- bl zero_registers
-
- /* Zero CTR */
- mtcr %r31
-
- lis %r3,0xe17000@ha
- addi %r3,%r3,0xe17000@l
-
- mtlr %r3
- lis %r3,0xe00000@ha
- addi %r3,%r3,call_ofw - _start@l
-
- blr
-
-zero_registers:
- xor %r2,%r2,%r2
- mr %r0,%r2
- mr %r3,%r2
-
- mr %r4,%r2
- mr %r5,%r2
- mr %r6,%r2
- mr %r7,%r2
-
- mr %r8,%r2
- mr %r9,%r2
- mr %r10,%r2
- mr %r11,%r2
-
- mr %r12,%r2
- mr %r13,%r2
- mr %r14,%r2
- mr %r15,%r2
-
- mr %r12,%r2
- mr %r13,%r2
- mr %r14,%r2
- mr %r15,%r2
-
- mr %r16,%r2
- mr %r17,%r2
- mr %r18,%r2
- mr %r19,%r2
-
- mr %r20,%r2
- mr %r21,%r2
- mr %r22,%r2
- mr %r23,%r2
-
- mr %r24,%r2
- mr %r25,%r2
- mr %r26,%r2
- mr %r27,%r2
-
- mr %r28,%r2
- mr %r29,%r2
- mr %r30,%r2
- mr %r31,%r2
-
- blr
-
-freeldr_banner:
- .ascii "ReactOS OpenFirmware Boot Program\r\n\0"
-
-freeldr_halt:
- .ascii "ReactOS OpenFirmware Boot Program Halting\r\n\0"
-
-ofw_memory_size:
- .long 0
- .long 0
- .long 0
- .long 0
-
- .org 0x1000
-stack:
- .space 0x4000
-
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/boot.s Mon Apr 16 17:48:22
2007
@@ -1,6 +1,90 @@
+ .section ".text"
.extern PpcInit
+ .globl _start
+ .globl call_ofw
_start:
- b PpcInit
+ sync
+ isync
+
+ lis %r1,stack@ha
+ addi %r1,%r1,stack@l
+ addi %r1,%r1,16384 - 0x10
+
+ /* Store ofw call addr */
+ mr %r21,%r5
+ lis %r10,ofw_call_addr@ha
+ stw %r5,ofw_call_addr@l(%r10)
+
+ bl zero_registers
+
+ /* Zero CTR */
+ mtcr %r31
+
+ lis %r3,PpcInit@ha
+ addi %r3,%r3,PpcInit@l
+ mtlr %r3
+
+ lis %r3,call_ofw@ha
+ addi %r3,%r3,call_ofw@l
+
+ blr
+
+zero_registers:
+ xor %r2,%r2,%r2
+ mr %r0,%r2
+ mr %r3,%r2
+
+ mr %r4,%r2
+ mr %r5,%r2
+ mr %r6,%r2
+ mr %r7,%r2
+
+ mr %r8,%r2
+ mr %r9,%r2
+ mr %r10,%r2
+ mr %r11,%r2
+
+ mr %r12,%r2
+ mr %r13,%r2
+ mr %r14,%r2
+ mr %r15,%r2
+
+ mr %r12,%r2
+ mr %r13,%r2
+ mr %r14,%r2
+ mr %r15,%r2
+
+ mr %r16,%r2
+ mr %r17,%r2
+ mr %r18,%r2
+ mr %r19,%r2
+
+ mr %r20,%r2
+ mr %r21,%r2
+ mr %r22,%r2
+ mr %r23,%r2
+
+ mr %r24,%r2
+ mr %r25,%r2
+ mr %r26,%r2
+ mr %r27,%r2
+
+ mr %r28,%r2
+ mr %r29,%r2
+ mr %r30,%r2
+ mr %r31,%r2
+
+ blr
+
+ofw_memory_size:
+ .long 0
+ .long 0
+ .long 0
+ .long 0
+
+ .org 0x1000
+stack:
+ .space 0x4000
.globl _bss
.section ".bss"
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 Mon Apr 16 17:48:22
2007
@@ -28,7 +28,8 @@
extern ULONG CacheSizeLimit;
of_proxy ofproxy;
void *PageDirectoryStart, *PageDirectoryEnd;
-static int chosen_package, stdin_handle, part_handle = -1, kernel_mem = 0;
+static int chosen_package, stdin_handle, stdout_handle,
+ part_handle = -1, kernel_mem = 0;
int mmu_handle = 0, FixedMemory = 0;
BOOLEAN AcpiPresent = FALSE;
char BootPath[0x100] = { 0 }, BootPart[0x100] = { 0 }, CmdLine[0x100] = { 0 };
@@ -41,7 +42,7 @@
if( ch == 0x0a ) { buf[0] = 0x0d; buf[1] = 0x0a; }
else { buf[0] = ch; buf[1] = 0; }
buf[2] = 0;
- ofw_print_string( buf );
+ ofw_write(stdout_handle, buf, strlen(buf));
}
int PpcFindDevice( int depth, int parent, char *devname, int *nth ) {
@@ -93,7 +94,6 @@
}
void PpcVideoClearScreen( UCHAR Attr ) {
- ofw_print_string("ClearScreen\n");
}
VOID PpcVideoGetDisplaySize( PULONG Width, PULONG Height, PULONG Depth ) {
@@ -494,7 +494,7 @@
extern int _bss;
typedef unsigned int uint32_t;
void PpcInit( of_proxy the_ofproxy ) {
- int len, stdin_handle_chosen, mmu_handle_chosen;
+ int len;
ofproxy = the_ofproxy;
//SetPhys(0x900, (19 << 26) | (50 << 1));
@@ -502,16 +502,11 @@
chosen_package = ofw_finddevice( "/chosen" );
ofw_getprop( chosen_package, "stdin",
- (char *)&stdin_handle_chosen, sizeof(stdin_handle_chosen) );
+ (char *)&stdin_handle, sizeof(stdin_handle) );
+ ofw_getprop( chosen_package, "stdout",
+ (char *)&stdout_handle, sizeof(stdout_handle) );
ofw_getprop( chosen_package, "mmu",
- (char *)&mmu_handle_chosen, sizeof(mmu_handle_chosen) );
-
- ofw_print_string("Found stdin ");
- ofw_print_number(stdin_handle_chosen);
- ofw_print_string("\r\n");
-
- stdin_handle = stdin_handle_chosen;
- mmu_handle = mmu_handle_chosen;
+ (char *)&mmu_handle, sizeof(mmu_handle) );
MachVtbl.ConsPutChar = PpcPutChar;
MachVtbl.ConsKbHit = PpcConsKbHit;
Added: branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/ofw_util.s
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/ofw_util.s (added)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/arch/powerpc/ofw_util.s Mon Apr 16
17:48:22 2007
@@ -1,0 +1,49 @@
+ .section .text
+ .globl ofw_functions
+ .globl ofw_call_addr
+ .globl call_ofw
+call_ofw:
+ /* R3 has the function offset to call (n * 4)
+ * Other arg registers are unchanged. */
+ subi %r1,%r1,0x100
+ stw %r8,24(%r1)
+ mflr %r8
+ stw %r8,0(%r1)
+ stw %r3,4(%r1)
+ stw %r4,8(%r1)
+ stw %r5,12(%r1)
+ stw %r6,16(%r1)
+ stw %r7,20(%r1)
+ stw %r9,28(%r1)
+ stw %r10,32(%r1)
+ stw %r20,36(%r1)
+
+ lis %r10,ofw_functions@ha
+ addi %r8,%r10,ofw_functions@l
+ add %r8,%r3,%r8
+ lwz %r9,0(%r8)
+ mtctr %r9
+
+ mr %r3,%r4
+ mr %r4,%r5
+ mr %r5,%r6
+ mr %r6,%r7
+ mr %r7,%r8
+ mr %r8,%r9
+
+ /* Call ofw proxy function */
+ bctrl
+
+ lwz %r8,0(%r1)
+ mtlr %r8
+ lwz %r4,8(%r1)
+ lwz %r5,12(%r1)
+ lwz %r6,16(%r1)
+ lwz %r7,20(%r1)
+ lwz %r8,24(%r1)
+ lwz %r9,28(%r1)
+ lwz %r10,32(%r1)
+ lwz %r20,36(%r1)
+ addi %r1,%r1,0x100
+ blr
+
Modified: branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/boot/freeldr/fr…
==============================================================================
--- branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild (original)
+++ branches/powerpc/reactos/boot/freeldr/freeldr/freeldr_arch.rbuild Mon Apr 16 17:48:22
2007
@@ -66,6 +66,8 @@
<compilerflag>-mno-toc</compilerflag>
<compilerflag>-meabi</compilerflag>
<file>boot.s</file>
+ <file>ofw_calls.s</file>
+ <file>ofw_util.s</file>
<file>ofw.c</file>
<file>mmu.c</file>
<file>mach.c</file>
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 Mon Apr 16 17:48:22 2007
@@ -20,12 +20,6 @@
package-to-path 3 1 int char*:arg2 int int
# Declare the call-method BE function
+call-method 0 0
-# Convenience functions that interact closely with OFW (written in BE asm)
--dumpregs 0 0
--print_string 1 0 char*
--print_number 1 0 int
--print_eol 0 0
--print_space 0 0
# MMU Methods
@phys2virt!translate 4 1 int int int int&0 int
@virt2phys!translate 2 1 int int&1 int
Modified: branches/powerpc/reactos/tools/ofw_interface/ofw_interface.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ofw_inter…
==============================================================================
--- branches/powerpc/reactos/tools/ofw_interface/ofw_interface.cpp (original)
+++ branches/powerpc/reactos/tools/ofw_interface/ofw_interface.cpp Mon Apr 16 17:48:22
2007
@@ -131,7 +131,7 @@
local_offset = (3 + rets + args) * 4;
total_stack = round_up(12 + local_offset, 16);
- function << "ofw_" << name << ":\n"
+ function << "asm_ofw_" << name << ":\n"
<< "\t/* Reserve stack space */\n"
<< "\tsubi %r1,%r1," << total_stack << "\n"
<< "\t/* Store r8, r9, lr */\n"
@@ -140,8 +140,8 @@
<< "\tmflr %r8\n"
<< "\tstw %r8," << (local_offset + 8) <<
"(%r1)\n"
<< "\t/* Get read name */\n"
- << "\tlis %r8," << wrapper.base << "@ha\n"
- << "\taddi %r9,%r8," << name << "_ofw_name -
_start\n"
+ << "\tlis %r8," << name << "_ofw_name@ha\n"
+ << "\taddi %r9,%r8," << name <<
"_ofw_name@l\n"
<< "\tstw %r9,0(%r1)\n"
<< "\t/* " << args << " arguments and "
<< rets << " return */\n"
<< "\tli %r9," << args << "\n"
@@ -153,7 +153,8 @@
function << "\tstw %r" << (i+3) << "," << (4
* (i + 3)) << "(%r1)\n";
function << "\t/* Load up the call address */\n"
- << "\tlwz %r9,ofw_call_addr - _start(%r8)\n"
+ << "\tlis %r10,ofw_call_addr@ha\n"
+ << "\tlwz %r9,ofw_call_addr@l(%r10)\n"
<< "\tmtlr %r9\n"
<< "\t/* Set argument */\n"
<< "\tmr %r3,%r1\n"
@@ -228,7 +229,7 @@
}
if( !method_call ) {
wrapper.names += name + "_ofw_name:\n\t.asciz \"" + nametext +
"\"\n";
- wrapper.calltable += std::string("\t.long ofw_") + name + "\n";
+ wrapper.calltable += std::string("\t.long asm_ofw_") + name + "\n";
wrapper.ctindex++;
}
}
@@ -286,6 +287,7 @@
<< "\t.section .text\n"
<< "\t.align 4\n"
<< "\t.globl _start\n"
+ << "\t.globl ofw_functions\n"
<< "\t.globl ofw_call_addr\n"
<< "ofw_call_addr:\n"
<< "\t.long 0\n"
@@ -294,6 +296,7 @@
<< "\n/* Function Names */\n\n"
<< wrappers.names
<< "\n/* Function Call Table for Freeldr */\n\n"
+ << "\t.align 4\n"
<< "ofw_functions:\n"
<< wrappers.calltable
<< "\n/* End */\n";
Modified: branches/powerpc/reactos/tools/ofw_interface/ofw_interface.mak
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ofw_inter…
==============================================================================
--- branches/powerpc/reactos/tools/ofw_interface/ofw_interface.mak (original)
+++ branches/powerpc/reactos/tools/ofw_interface/ofw_interface.mak Mon Apr 16 17:48:22
2007
@@ -5,7 +5,7 @@
OFW_INTERFACE_OUT = $(OUTPUT_)$(OFW_INTERFACE_BASE)
OFW_INTERFACE_OUT_ = $(OFW_INTERFACE_OUT)$(SEP)
-OFW_INTERFACE_OUTPUT = boot/freeldr/bootsect/ofw.s
+OFW_INTERFACE_OUTPUT = boot/freeldr/freeldr/arch/powerpc/ofw_calls.s
OFW_INTERFACE_SOURCE = boot/freeldr/freeldr/arch/powerpc/ofw.c
OFW_INTERFACE_HEADER = boot/freeldr/freeldr/include/of_call.h
OFW_INTERFACE_INPUT = $(OFW_INTERFACE_BASE_)calls.ofw
Modified: branches/powerpc/reactos/tools/ppc.lost+found/link-freeldr
URL:
http://svn.reactos.org/svn/reactos/branches/powerpc/reactos/tools/ppc.lost%…
==============================================================================
--- branches/powerpc/reactos/tools/ppc.lost+found/link-freeldr (original)
+++ branches/powerpc/reactos/tools/ppc.lost+found/link-freeldr Mon Apr 16 17:48:22 2007
@@ -5,6 +5,8 @@
-g -nostartfiles -nostdlib -N -Ttext=0xe17000 \
-o freeldr.elf \
obj-ppc/boot/freeldr/freeldr/arch/powerpc/boot.o \
+ obj-ppc/boot/freeldr/freeldr/arch/powerpc/ofw_util.o \
+ obj-ppc/boot/freeldr/freeldr/arch/powerpc/ofw_calls.o \
obj-ppc/boot/freeldr/freeldr/cache/blocklist.o \
obj-ppc/boot/freeldr/freeldr/cache/cache.o \
obj-ppc/boot/freeldr/freeldr/comm/rs232.o \
@@ -63,9 +65,3 @@
obj-ppc/lib/string/string.a \
obj-ppc/lib/rtl/rtl.a \
/usr/local/pkg/reactos-powerpc/lib/libgcc.a
-powerpc-unknown-linux-gnu-objcopy -O binary freeldr.elf freeldr.tmp
-(dd if=/dev/zero bs=4k count=16 ; echo 'byebye') >> freeldr.tmp
-powerpc-unknown-linux-gnu-objcopy -I binary -B powerpc:common -O elf32-powerpc
freeldr.tmp ofwldr.payload
-reactos-powerpc-as -mbig -o ofwboot.o boot/freeldr/bootsect/ofwboot.s
boot/freeldr/bootsect/ofw_util.s boot/freeldr/bootsect/ofw.s
-powerpc-unknown-linux-gnu-ld -EB -Ttext 0xe00000 -Tdata 0xe17000 -e _begin -o ofwldr.x
ofwboot.o ofwldr.payload
-powerpc-unknown-linux-gnu-objcopy --only-section=.text --only-section=.data
--only-section=.bss ofwldr.x ofwldr