1/* $Id: map.S,v 1.1.1.1 2008/10/15 03:26:19 james26_jang Exp $ 2 * map.S: Tricky coding required to fixup the kernel OBP maps 3 * properly. 4 * 5 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 6 */ 7 8 .text 9 .align 8192 10 .globl prom_boot_page 11prom_boot_page: 12call_method: 13 .asciz "call-method" 14 .align 8 15map: 16 .asciz "map" 17 .align 8 18 19 /* When we are invoked, our caller has remapped us to 20 * page zero, therefore we must use PC relative addressing 21 * for everything after we begin performing the unmap/map 22 * calls. 23 */ 24 .globl prom_remap 25prom_remap: /* %o0 = physpage, %o1 = virtpage, %o2 = mmu_ihandle */ 26 rd %pc, %g1 27 srl %o2, 0, %o2 ! kill sign extension 28 sethi %hi(p1275buf), %g2 29 or %g2, %lo(p1275buf), %g2 30 ldx [%g2 + 0x10], %g3 ! prom_cif_stack 31 save %g3, -(192 + 128), %sp 32 ldx [%g2 + 0x08], %l0 ! prom_cif_handler 33 mov %g6, %i3 34 mov %g4, %i4 35 flushw 36 37 sethi %hi(prom_remap - call_method), %g7 38 or %g7, %lo(prom_remap - call_method), %g7 39 sub %g1, %g7, %l2 ! call-method string 40 sethi %hi(prom_remap - map), %g7 41 or %g7, %lo(prom_remap - map), %g7 42 sub %g1, %g7, %l4 ! map string 43 44 /* OK, map the 4MB region we really live at. */ 45 stx %l2, [%sp + 2047 + 128 + 0x00] ! call-method 46 mov 7, %l5 47 stx %l5, [%sp + 2047 + 128 + 0x08] ! num_args 48 mov 1, %l5 49 stx %l5, [%sp + 2047 + 128 + 0x10] ! num_rets 50 stx %l4, [%sp + 2047 + 128 + 0x18] ! map 51 stx %i2, [%sp + 2047 + 128 + 0x20] ! mmu_ihandle 52 mov -1, %l5 53 stx %l5, [%sp + 2047 + 128 + 0x28] ! mode == default 54 sethi %hi(4 * 1024 * 1024), %l5 55 stx %l5, [%sp + 2047 + 128 + 0x30] ! size 56 stx %i1, [%sp + 2047 + 128 + 0x38] ! vaddr 57 stx %g0, [%sp + 2047 + 128 + 0x40] ! filler 58 stx %i0, [%sp + 2047 + 128 + 0x48] ! paddr 59 call %l0 60 add %sp, (2047 + 128), %o0 ! argument array 61 62 /* Restore hard-coded globals. */ 63 mov %i3, %g6 64 mov %i4, %g4 65 66 /* Wheee.... we are done. */ 67 ret 68 restore 69 70 .align 8192 71