[BACK]Return to machdep.c CVS log [TXT][DIR] Up to [local] / sys / arch / hp300 / stand / common

Annotation of sys/arch/hp300/stand/common/machdep.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: machdep.c,v 1.7 2006/08/17 06:31:10 miod Exp $        */
                      2: /*     $NetBSD: machdep.c,v 1.4 1997/06/28 07:20:25 thorpej Exp $      */
                      3:
                      4: /*
                      5:  * Copyright (c) 1988 University of Utah.
                      6:  * Copyright (c) 1982, 1986, 1990, 1993
                      7:  *     The Regents of the University of California.  All rights reserved.
                      8:  *
                      9:  * This code is derived from software contributed to Berkeley by
                     10:  * the Systems Programming Group of the University of Utah Computer
                     11:  * Science Department.
                     12:  *
                     13:  * Redistribution and use in source and binary forms, with or without
                     14:  * modification, are permitted provided that the following conditions
                     15:  * are met:
                     16:  * 1. Redistributions of source code must retain the above copyright
                     17:  *    notice, this list of conditions and the following disclaimer.
                     18:  * 2. Redistributions in binary form must reproduce the above copyright
                     19:  *    notice, this list of conditions and the following disclaimer in the
                     20:  *    documentation and/or other materials provided with the distribution.
                     21:  * 3. Neither the name of the University nor the names of its contributors
                     22:  *    may be used to endorse or promote products derived from this software
                     23:  *    without specific prior written permission.
                     24:  *
                     25:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     26:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     27:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     28:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     29:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     30:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     31:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     32:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     33:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     34:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     35:  * SUCH DAMAGE.
                     36:  *
                     37:  * from: Utah $Hdr: machdep.c 1.10 92/06/18
                     38:  *
                     39:  *     @(#)machdep.c   8.1 (Berkeley) 6/10/93
                     40:  */
                     41:
                     42: #include <sys/param.h>
                     43:
                     44: #include <lib/libsa/stand.h>
                     45:
                     46: #include "samachdep.h"
                     47:
                     48: char *
                     49: getmachineid()
                     50: {
                     51:        extern int machineid, mmuid;
                     52:        char *cp;
                     53:
                     54:        switch (machineid) {
                     55:        case HP_320:
                     56:                cp = "320"; break;
                     57:        case HP_330:
                     58:                cp = "318/319/330"; break;
                     59:        case HP_340:
                     60:                cp = "340"; break;
                     61:        case HP_345:
                     62:                cp = "345"; break;
                     63:        case HP_350:
                     64:                cp = "350"; break;
                     65:        case HP_360:
                     66:                cp = "360"; break;
                     67: #if 0  /* bootblocks do not tell 360 apart from 362 at the moment */
                     68:        case HP_362:
                     69:                cp = "362"; break;
                     70: #endif
                     71:        case HP_370:
                     72:                cp = "370"; break;
                     73:        case HP_375:
                     74:                cp = "375"; break;
                     75:        case HP_380:
                     76:                cp = "380"; break;
                     77:        case HP_382:
                     78:                cp = "382"; break;
                     79:        case HP_385:
                     80:                cp = "385"; break;
                     81:        case HP_400:
                     82:                cp = "400"; break;
                     83:        case HP_425:
                     84:                switch (mmuid) {
                     85:                case MMUID_425_T:
                     86:                        cp = "425t"; break;
                     87:                case MMUID_425_S:
                     88:                        cp = "425s"; break;
                     89:                case MMUID_425_E:
                     90:                        cp = "425e"; break;
                     91:                default:
                     92:                        cp = "425"; break;
                     93:                }
                     94:                break;
                     95:        case HP_433:
                     96:                switch (mmuid) {
                     97:                case MMUID_433_T:
                     98:                        cp = "433t"; break;
                     99:                case MMUID_433_S:
                    100:                        cp = "433s"; break;
                    101:                default:
                    102:                        cp = "433"; break;
                    103:                }
                    104:                break;
                    105:        default:
                    106:                cp = "???"; break;
                    107:        }
                    108:        return(cp);
                    109: }
                    110:
                    111: int userom;
                    112:
                    113: struct trapframe {
                    114:        int dregs[8];
                    115:        int aregs[8];
                    116:        int whoknows;
                    117:        short sr;
                    118:        int pc;
                    119:        short frame;
                    120: };
                    121:
                    122: int    trap(struct trapframe *);
                    123:
                    124: int
                    125: trap(fp)
                    126:        struct trapframe *fp;
                    127: {
                    128:        static int intrap = 0;
                    129:
                    130:        if (intrap)
                    131:                return(0);
                    132:        intrap = 1;
                    133:
                    134: #if 0
                    135:        userom = 1;
                    136: #endif
                    137:
                    138:        printf("Got unexpected trap: format=%x vector=%x ps=%x pc=%x\n",
                    139:                  (fp->frame>>12)&0xF, fp->frame&0xFFF, fp->sr, fp->pc);
                    140:        printf("dregs: %x %x %x %x %x %x %x %x\n",
                    141:               fp->dregs[0], fp->dregs[1], fp->dregs[2], fp->dregs[3],
                    142:               fp->dregs[4], fp->dregs[5], fp->dregs[6], fp->dregs[7]);
                    143:        printf("aregs: %x %x %x %x %x %x %x %x\n",
                    144:               fp->aregs[0], fp->aregs[1], fp->aregs[2], fp->aregs[3],
                    145:               fp->aregs[4], fp->aregs[5], fp->aregs[6], fp->aregs[7]);
                    146:        printf("bytes at pc: %x %x %x %x %x %x\n",
                    147:            ((char *)fp->pc)[0], ((char *)fp->pc)[1], ((char *)fp->pc)[2],
                    148:            ((char *)fp->pc)[3], ((char *)fp->pc)[4], ((char *)fp->pc)[5]);
                    149:
                    150: #if 0
                    151:        userom = 0;
                    152: #endif
                    153:
                    154:        intrap = 0;
                    155:
                    156:        return(0);
                    157: }
                    158:
                    159: #define ROWS   24
                    160: #define COLS   80
                    161:
                    162: void
                    163: romputchar(int c)
                    164: {
                    165:        static char buf[COLS];
                    166:        static int col = 0, row = 0;
                    167:        int i;
                    168:
                    169:        switch (c) {
                    170:        case '\0':
                    171:                break;
                    172:        case '\r':
                    173:                break;  /* ignore */
                    174:        case '\n':
                    175:                for (i = col; i < COLS-1; i++)
                    176:                        buf[i] = ' ';
                    177:                buf[i] = '\0';
                    178:                romout(row, buf);
                    179:                col = 0;
                    180:                if (++row == ROWS)
                    181:                        row = 0;
                    182:                break;
                    183:
                    184:        case '\t':
                    185:                do {
                    186:                        romputchar(' ');
                    187:                } while (col & 7);
                    188:                break;
                    189:
                    190:        default:
                    191:                buf[col] = c;
                    192:                if (++col == COLS-1)
                    193:                        romputchar('\n');
                    194:                break;
                    195:        }
                    196: }
                    197:
                    198: void
                    199: machdep_start(char *entry, int howto, char *loadaddr, char *ssym, char *esym)
                    200: {
                    201:        /* Fix what we were passed in from exec() */
                    202:        entry = loadaddr;
                    203: #define        round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1))
                    204:        esym = (char *)round_to_size(esym - (char *)loadaddr);
                    205: #undef round_to_size
                    206:
                    207:        __asm __volatile ("movl %0,d7" : : "m" (howto));
                    208:        __asm __volatile ("movl %0,d6" : : "m" (opendev));
                    209:        __asm __volatile ("movl %0,a5" : : "a" (loadaddr));
                    210:        __asm __volatile ("movl %0,a4" : : "a" (esym));
                    211:        (*((int (*)(void))entry))();
                    212: }

CVSweb