1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 21da177e4SLinus Torvalds#include <linux/linkage.h> 316752e2eSGeert Uytterhoeven#include <linux/init.h> 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds#include <asm/entry.h> 61da177e4SLinus Torvalds#include <asm/page.h> 71da177e4SLinus Torvalds#include <asm/contregs.h> 81da177e4SLinus Torvalds#include <asm/sun3-head.h> 91da177e4SLinus Torvalds 101da177e4SLinus TorvaldsPSL_HIGHIPL = 0x2700 111da177e4SLinus TorvaldsNBSG = 0x20000 121da177e4SLinus TorvaldsICACHE_ONLY = 0x00000009 131da177e4SLinus TorvaldsCACHES_OFF = 0x00000008 | actually a clear and disable --m 141da177e4SLinus Torvalds#define MAS_STACK INT_STACK 151da177e4SLinus TorvaldsROOT_TABLE_SIZE = 128 161da177e4SLinus TorvaldsPAGESIZE = 8192 171da177e4SLinus TorvaldsSUN3_INVALID_PMEG = 255 181da177e4SLinus Torvalds.globl bootup_user_stack 191da177e4SLinus Torvalds.globl bootup_kernel_stack 201da177e4SLinus Torvalds.globl pg0 211da177e4SLinus Torvalds.globl swapper_pg_dir 221da177e4SLinus Torvalds.globl kernel_pmd_table 231da177e4SLinus Torvalds.globl availmem 241da177e4SLinus Torvalds.global m68k_pgtable_cachemode 251da177e4SLinus Torvalds.global kpt 261da177e4SLinus Torvalds| todo: all these should be in bss! 271da177e4SLinus Torvaldsswapper_pg_dir: .skip 0x2000 281da177e4SLinus Torvaldspg0: .skip 0x2000 291da177e4SLinus Torvaldskernel_pmd_table: .skip 0x2000 301da177e4SLinus Torvalds 311da177e4SLinus Torvalds.globl kernel_pg_dir 321da177e4SLinus Torvalds.equ kernel_pg_dir,kernel_pmd_table 331da177e4SLinus Torvalds 346f335cabSTim Abbott __HEAD 351da177e4SLinus TorvaldsENTRY(_stext) 361da177e4SLinus TorvaldsENTRY(_start) 371da177e4SLinus Torvalds 381da177e4SLinus Torvalds/* Firstly, disable interrupts and set up function codes. */ 391da177e4SLinus Torvalds movew #PSL_HIGHIPL, %sr 401da177e4SLinus Torvalds moveq #FC_CONTROL, %d0 411da177e4SLinus Torvalds movec %d0, %sfc 421da177e4SLinus Torvalds movec %d0, %dfc 431da177e4SLinus Torvalds 441da177e4SLinus Torvalds/* Make sure we're in context zero. */ 451da177e4SLinus Torvalds moveq #0, %d0 461da177e4SLinus Torvalds movsb %d0, AC_CONTEXT 471da177e4SLinus Torvalds 481da177e4SLinus Torvalds/* map everything the bootloader left us into high memory, clean up the 491da177e4SLinus Torvalds excess later */ 501da177e4SLinus Torvalds lea (AC_SEGMAP+0),%a0 511da177e4SLinus Torvalds lea (AC_SEGMAP+KERNBASE),%a1 521da177e4SLinus Torvalds1: 531da177e4SLinus Torvalds movsb %a0@, %d1 541da177e4SLinus Torvalds movsb %d1, %a1@ 551da177e4SLinus Torvalds cmpib #SUN3_INVALID_PMEG, %d1 561da177e4SLinus Torvalds beq 2f 571da177e4SLinus Torvalds addl #NBSG,%a0 581da177e4SLinus Torvalds addl #NBSG,%a1 591da177e4SLinus Torvalds jmp 1b 601da177e4SLinus Torvalds 611da177e4SLinus Torvalds2: 621da177e4SLinus Torvalds 631da177e4SLinus Torvalds/* Disable caches and jump to high code. */ 641da177e4SLinus Torvalds moveq #ICACHE_ONLY,%d0 | Cache disabled until we're ready to enable it 651da177e4SLinus Torvalds movc %d0, %cacr | is this the right value? (yes --m) 661da177e4SLinus Torvalds jmp 1f:l 671da177e4SLinus Torvalds 681da177e4SLinus Torvalds/* Following code executes at high addresses (0xE000xxx). */ 691da177e4SLinus Torvalds1: lea init_task,%curptr | get initial thread... 701da177e4SLinus Torvalds lea init_thread_union+THREAD_SIZE,%sp | ...and its stack. 711da177e4SLinus Torvalds 721da177e4SLinus Torvalds/* Point MSP at an invalid page to trap if it's used. --m */ 731da177e4SLinus Torvalds movl #(PAGESIZE),%d0 741da177e4SLinus Torvalds movc %d0,%msp 751da177e4SLinus Torvalds moveq #-1,%d0 761da177e4SLinus Torvalds movsb %d0,(AC_SEGMAP+0x0) 771da177e4SLinus Torvalds 781da177e4SLinus Torvalds jbsr sun3_init 791da177e4SLinus Torvalds 801da177e4SLinus Torvalds jbsr base_trap_init 811da177e4SLinus Torvalds 821da177e4SLinus Torvalds jbsr start_kernel 831da177e4SLinus Torvalds trap #15 841da177e4SLinus Torvalds 851da177e4SLinus Torvalds .data 861da177e4SLinus Torvalds .even 871da177e4SLinus Torvaldskpt: 881da177e4SLinus Torvalds .long 0 891da177e4SLinus Torvaldsavailmem: 901da177e4SLinus Torvalds .long 0 91