1/*- 2 * Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com> 3 * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 9 unchanged lines hidden (view full) --- 18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 20 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 22 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 23 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/powerpc/booke/locore.S 279750 2015-03-07 20:14:46Z nwhitehorn $ |
27 */ 28 29#include "assym.s" 30 31#include <machine/asm.h> 32#include <machine/hid.h> 33#include <machine/param.h> 34#include <machine/spr.h> --- 165 unchanged lines hidden (view full) --- 200 mr %r3, %r28 201 bl tlb1_inval_entry 202 203done_mapping: 204 205/* 206 * Setup a temporary stack 207 */ |
208 bl 1f 209 .long tmpstack-. 2101: mflr %r1 211 lwz %r2,0(%r1) 212 add %r1,%r1,%r2 |
213 addi %r1, %r1, (TMPSTACKSZ - 16) 214 215/* |
216 * Relocate kernel 217 */ 218 bl 1f 219 .long _DYNAMIC-. 220 .long _GLOBAL_OFFSET_TABLE_-. 2211: mflr %r5 222 lwz %r3,0(%r5) /* _DYNAMIC in %r3 */ 223 add %r3,%r3,%r5 224 lwz %r4,4(%r5) /* GOT pointer */ 225 add %r4,%r4,%r5 226 lwz %r4,4(%r4) /* got[0] is _DYNAMIC link addr */ 227 subf %r4,%r4,%r3 /* subtract to calculate relocbase */ 228 bl elf_reloc_self 229 230/* |
231 * Initialise exception vector offsets 232 */ 233 bl ivor_setup 234 235/* 236 * Set up arguments and jump to system initialization code 237 */ 238 mr %r3, %r30 --- 112 unchanged lines hidden (view full) --- 351 isync 352 msync 353 addi %r5, %r5, 12 354 addi %r4, %r4, 1 355 cmpw %r4, %r6 356 blt 4b 357 358 /* Switch to the final mapping */ |
359 bl 5f |
360 .long __boot_page-. 3615: mflr %r5 362 lwz %r3,0(%r3) 363 add %r5,%r5,%r3 /* __boot_page in r5 */ 364 bl 6f 3656: mflr %r3 |
366 rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */ 367 add %r3, %r3, %r5 /* Make this virtual address */ 368 addi %r3, %r3, 32 369 li %r4, 0 /* Note AS=0 */ 370 mtspr SPR_SRR0, %r3 371 mtspr SPR_SRR1, %r4 372 rfi 373 --- 7 unchanged lines hidden (view full) --- 381 * Invalidate temp mapping 382 */ 383 mr %r3, %r28 384 bl tlb1_inval_entry 385 386/* 387 * Setup a temporary stack 388 */ |
389 bl 1f 390 .long tmpstack-. 3911: mflr %r1 392 lwz %r2,0(%r1) 393 add %r1,%r1,%r2 |
394 addi %r1, %r1, (TMPSTACKSZ - 16) 395 396/* 397 * Initialise exception vector offsets 398 */ 399 bl ivor_setup 400 401 /* 402 * Assign our pcpu instance 403 */ |
404 bl 1f 405 .long ap_pcpu-. 4061: mflr %r4 407 lwz %r3, 0(%r4) 408 add %r3, %r3, %r4 |
409 lwz %r3, 0(%r3) 410 mtsprg0 %r3 411 412 bl pmap_bootstrap_ap 413 414 bl cpudep_ap_bootstrap 415 /* Switch to the idle thread's kstack */ 416 mr %r1, %r3 --- 148 unchanged lines hidden (view full) --- 565 566/* 567 * void tid_flush(tlbtid_t tid); 568 * 569 * Invalidate all TLB0 entries which match the given TID. Note this is 570 * dedicated for cases when invalidation(s) should NOT be propagated to other 571 * CPUs. 572 * |
573 * void tid_flush(tlbtid_t tid, int tlb0_ways, int tlb0_entries_per_way); |
574 * |
575 * XXX: why isn't this in C? |
576 */ 577ENTRY(tid_flush) 578 cmpwi %r3, TID_KERNEL 579 beq tid_flush_end /* don't evict kernel translations */ 580 |
581 /* Disable interrupts */ 582 mfmsr %r10 583 wrteei 0 584 585 li %r6, 0 /* ways counter */ 586loop_ways: 587 li %r7, 0 /* entries [per way] counter */ 588loop_entries: --- 141 unchanged lines hidden (view full) --- 730 stmw %r10, 12(%r3) /* store CR, CTR, XER, [r13 .. r31] */ 731 li %r3, 0 /* return FALSE */ 732 blr 733 734/************************************************************************/ 735/* Data section */ 736/************************************************************************/ 737 .data |
738 .align 3 739GLOBAL(__startkernel) 740 .long begin 741GLOBAL(__endkernel) 742 .long end |
743 .align 4 744tmpstack: 745 .space TMPSTACKSZ 746tmpstackbound: 747 .space 10240 /* XXX: this really should not be necessary */ 748 749/* 750 * Compiled KERNBASE locations 751 */ 752 .globl kernbase 753 .set kernbase, KERNBASE 754 755#include <powerpc/booke/trap_subr.S> |