From owner-p4-projects@FreeBSD.ORG Fri May 2 15:45:54 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 466FA37B405; Fri, 2 May 2003 15:45:54 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DB7CF37B401 for ; Fri, 2 May 2003 15:45:53 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3486543F85 for ; Fri, 2 May 2003 15:45:53 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id h42Mjq0U051508 for ; Fri, 2 May 2003 15:45:52 -0700 (PDT) (envelope-from jmallett@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id h42MjqLV051505 for perforce@freebsd.org; Fri, 2 May 2003 15:45:52 -0700 (PDT) Date: Fri, 2 May 2003 15:45:52 -0700 (PDT) Message-Id: <200305022245.h42MjqLV051505@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jmallett@freebsd.org using -f From: Juli Mallett To: Perforce Change Reviews Subject: PERFORCE change 30419 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 May 2003 22:45:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=30419 Change 30419 by jmallett@jmallett_dalek on 2003/05/02 15:45:26 Voodoo-free locore.S. Affected files ... .. //depot/projects/mips/sys/mips/mips/locore.S#5 edit Differences ... ==== //depot/projects/mips/sys/mips/mips/locore.S#5 (text+ko) ==== @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2002 Juli Mallett + * Copyright (c) 2003 Juli Mallett * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -28,12 +28,17 @@ #include #include +#incldue + +#include "assym.s" .data /* * Dummy interrupt table to keep sysctl happy until * it's worked out what to do with naming */ +GLOBAL(stackspace) + .space 16384 GLOBAL(intrnames) .asciz "dummy" GLOBAL(eintrnames) @@ -45,49 +50,41 @@ .set noreorder .text - .globl start -start: - # Just keep the boot exception vector and soft reset bits around, - # disable interrupts. - mfc0 t0, MIPS_COP_0_STATUS - and t0, MIPS_SR_BEV | MIPS3_SR_SR - mtc0 t0, MIPS_COP_0_STATUS +ENTRY(btext) +ENTRY(start) + # t0: Bits to preserve if set: + # Soft reset + # Boot exception vectors (firmware-provided) + li t0, MIPS_SR_BEV | MIPS3_SR_SR + # t1: Bits to set explicitly: + # Kernel mode is 64-bit + # Enable FPU + li t1, MIPS3_SR_KX | MIPS_SR_COP_1_BIT + + # Read coprocessor 0 status register, clear bits not + # preserved (namely, clearing interrupt bits), and set + # bits we want to explicitly set. + mfc0 t2, MIPS_COP_0_STATUS + and t2, t0 + or t2, t1 + mtc0 t2, MIPS_COP_0_STATUS COP0_SYNC + # Extra nops for the FPU to spin up. - # Zero the Cause register in case any software interrupt bits are set. + # Clear cause register. mtc0 zero, MIPS_COP_0_CAUSE COP0_SYNC - # If the stack pointer is above this function's address, or more than - # 4K below it, then we should set it to the address of this function - # minus the amount of stack needed to call a function in C, otherwise - # just use it. - la t1, start - bgt sp, t1, 1f - addu t2, t1, -CALLFRAME_SIZ - subu t0, t1, sp - bgt t0, 4096, 1f - nop - move t2, sp -1: move sp, t2 - - # Turn on the FPU. - mfc0 t0, MIPS_COP_0_STATUS - or t0, MIPS_SR_COP_1_BIT - mtc0 t0, MIPS_COP_0_STATUS - nop - nop - nop - nop - COP0_SYNC - - # Get the processor ID from coprocessor 0, and the FPU ID from - # coprocessor 1. + # Read and store the PrID FPU ID for CPU identification. mfc0 t0, MIPS_COP_0_PRID cfc1 t1, MIPS_FPU_ID sw t0, cpu_id sw t1, fpu_id + # Set up our temporary stack. + la sp, stackspace + addu sp, 16384 + # Call the platform-specific startup code. jal platform_start nop @@ -97,3 +94,4 @@ nop # NOTREACHED +END(start)