PageRenderTime 47ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/src/netbsd/src/sys/arch/newsmips/newsmips/locore_machdep.S

https://bitbucket.org/killerpenguinassassins/open_distrib_devel
Assembly | 165 lines | 147 code | 18 blank | 0 comment | 4 complexity | 08d55fde33e1e5f5fe9bb46c3be2ea31 MD5 | raw file
Possible License(s): CC0-1.0, MIT, LGPL-2.0, LGPL-3.0, WTFPL, GPL-2.0, BSD-2-Clause, AGPL-3.0, CC-BY-SA-3.0, MPL-2.0, JSON, BSD-3-Clause-No-Nuclear-License-2014, LGPL-2.1, CPL-1.0, AGPL-1.0, 0BSD, ISC, Apache-2.0, GPL-3.0, IPL-1.0, MPL-2.0-no-copyleft-exception, BSD-3-Clause
  1. /* $NetBSD: locore_machdep.S,v 1.16 2011/02/20 07:56:31 matt Exp $ */
  2. /*
  3. * Copyright (c) 1992, 1993
  4. * The Regents of the University of California. All rights reserved.
  5. *
  6. * This code is derived from software contributed to Berkeley by
  7. * Digital Equipment Corporation, Ralph Campbell, Sony Corp and
  8. * Kazumasa Utashiro of Software Research Associates, Inc.
  9. *
  10. * Redistribution and use in source and binary forms, with or without
  11. * modification, are permitted provided that the following conditions
  12. * are met:
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in the
  17. * documentation and/or other materials provided with the distribution.
  18. * 3. Neither the name of the University nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software
  20. * without specific prior written permission.
  21. *
  22. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  23. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  24. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  25. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  26. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  27. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  28. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  29. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  31. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  32. * SUCH DAMAGE.
  33. *
  34. * Copyright (C) 1989 Digital Equipment Corporation.
  35. * Permission to use, copy, modify, and distribute this software and
  36. * its documentation for any purpose and without fee is hereby granted,
  37. * provided that the above copyright notice appears in all copies.
  38. * Digital Equipment Corporation makes no representations about the
  39. * suitability of this software for any purpose. It is provided "as is"
  40. * without express or implied warranty.
  41. *
  42. * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/loMem.s,
  43. * v 1.1 89/07/11 17:55:04 nelson Exp SPRITE (DECWRL)
  44. * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAsm.s,
  45. * v 9.2 90/01/29 18:00:39 shirriff Exp SPRITE (DECWRL)
  46. * from: Header: /sprite/src/kernel/vm/ds3100.md/vmPmaxAsm.s,
  47. * v 1.1 89/07/10 14:27:41 nelson Exp SPRITE (DECWRL)
  48. *
  49. * @(#)locore.s 8.5 (Berkeley) 1/4/94
  50. */
  51. /*
  52. * NEWS-specific mips locore code.
  53. */
  54. #include <mips/asm.h>
  55. #include <mips/cpuregs.h>
  56. #include <machine/machConst.h>
  57. #include <machine/param.h>
  58. #include "assym.h"
  59. .set noreorder
  60. LEAF(to_monitor)
  61. li v0, MIPS_SR_BEV # no interrupt and
  62. mtc0 v0, MIPS_COP_0_STATUS # boot strap exception vector
  63. nop
  64. nop
  65. nop
  66. nop
  67. li a1, MACH_MONARG_ADDR|MIPS_KSEG1_START
  68. sw a0, (a1) # pass argument(howto)
  69. move a0, zero # syscall(#0)
  70. syscall
  71. nop
  72. END(to_monitor)
  73. #ifdef MIPS3
  74. .set mips3
  75. .set noat
  76. .globl checkromwork
  77. checkromwork:
  78. dmfc0 k0, MIPS_COP_0_BAD_VADDR
  79. li k1, 0xfff00000 # NEWS5000 ROM Work: 0xFFF00000~0xFFFFFFFF (1Mbyte)
  80. sltu k1, k0, k1
  81. bne k1, zero, outofworld
  82. nop
  83. li k1, 0x000fe000 # XXX (depend on 4k page)
  84. and k1, k0, k1 # k1 = (VADDR - 0xFFF00000) & 0xffffe000
  85. la k0, _C_LABEL(physmem)
  86. lw k0, 0(k0) # k0 = page of physmem (tail of maxmemory - 0x00100000)
  87. sll k0, k0, PGSHIFT # k0 = memory tail
  88. add k0, k0, k1 # 0xfff00000+? -> memory tail + ?
  89. srl k0, k0, 6 # MIPS3_PG_SHIFT
  90. li k1, 0x02|0x18|0x01 # MIPS3_PG_V|MIPS3_PG_CACHED|MIPS3_PG_G
  91. or k0, k0, k1
  92. li k1, 64 # set ODD page
  93. add k1, k0, k1
  94. dsll k0, k0, 34 # get rid of "wired" bit
  95. dsrl k0, k0, 34
  96. dmtc0 k0, MIPS_COP_0_TLB_LO0 # load PTE entry
  97. dsll k1, k1, 34
  98. dsrl k1, k1, 34
  99. dmtc0 k1, MIPS_COP_0_TLB_LO1 # load PTE entry
  100. nop
  101. nop # required for QED5230
  102. tlbwr # write TLB
  103. nop
  104. nop
  105. nop
  106. nop
  107. nop
  108. eret
  109. outofworld:
  110. /* Ensure we have a valid sp so panic has a chance */
  111. move a1, sp
  112. la sp, start # set sp to a valid place
  113. PANIC("TLB out of universe: ksp was %p")
  114. .set at
  115. #endif /* MIPS3 */
  116. /*
  117. * Interrupt counters for vmstat.
  118. */
  119. .rdata
  120. .globl _C_LABEL(intrnames)
  121. .globl _C_LABEL(eintrnames)
  122. _C_LABEL(intrnames):
  123. .asciiz "serial0"
  124. .asciiz "serial1"
  125. .asciiz "serial2"
  126. .asciiz "ether"
  127. .asciiz "scsi"
  128. .asciiz "memory"
  129. .asciiz "clock"
  130. .asciiz "fpu"
  131. .asciiz "slot1"
  132. .asciiz "slot2"
  133. .asciiz "slot3"
  134. .asciiz "floppy"
  135. .asciiz "stray"
  136. .asciiz "nmi"
  137. .asciiz "lostclock"
  138. _C_LABEL(eintrnames):
  139. .data
  140. .globl _C_LABEL(intrcnt)
  141. .globl _C_LABEL(eintrcnt)
  142. .p2align 2
  143. _C_LABEL(intrcnt):
  144. .word 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0
  145. _C_LABEL(eintrcnt):
  146. .word 0 # This shouldn't be needed but with 4.4bsd's as, the eintrcnt
  147. # label ends end up in a different section otherwise.