machine_luna88k.cc Source File

Back to the index.

machine_luna88k.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2018 Anders Gavare. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * 1. Redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution.
12  * 3. The name of the author may not be used to endorse or promote products
13  * derived from this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  *
28  * COMMENT: LUNA88K machine
29  *
30  * This is for experiments with OpenBSD/luna88k. See
31  * openbsd/sys/arch/luna88k/luna88k/locore0.S for more information about
32  * how OpenBSD starts up on this platform.
33  *
34  * RAMDISK kernel used for experiments:
35  *
36  * https://ftp.eu.openbsd.org/pub/OpenBSD/6.2/luna88k/bsd.rd
37  *
38  * Launch with gxemul -e luna-88k2 -Ttv bsd.rd
39  */
40 
41 #include <stdio.h>
42 #include <stdlib.h>
43 #include <string.h>
44 
45 #include "cpu.h"
46 #include "device.h"
47 #include "devices.h"
48 #include "machine.h"
49 #include "memory.h"
50 #include "misc.h"
51 
53 
54 
55 MACHINE_SETUP(luna88k)
56 {
57  const char* luna88k2_fuse_string = "MNAME=LUNA88K+";
58 
59  device_add(machine, "luna88k");
60 
61  switch (machine->machine_subtype) {
62 
63  case MACHINE_LUNA_88K:
64  machine->machine_name = strdup("LUNA 88K");
65  break;
66 
67  case MACHINE_LUNA_88K2:
68  machine->machine_name = strdup("LUNA 88K2");
69 
70  /* According to OpenBSD source code,
71  the string "MNAME=LUNA88K+" in FUSE_ROM_DATA
72  is used to determine that this is a 88K2, and
73  not an 88K.
74  fuse_rom_data[i] =
75  (char)((((p->h) >> 24) & 0x000000f0) |
76  (((p->l) >> 28) & 0x0000000f));
77  where h is first 32-bit word, l is second.
78  */
79 
80  for (int i = 0; i < strlen(luna88k2_fuse_string); ++i) {
81  uint32_t h = luna88k2_fuse_string[i] & 0xf0;
82  uint32_t l = luna88k2_fuse_string[i] & 0x0f;
83  store_32bit_word(cpu, FUSE_ROM_ADDR + i * 8 + 0, h << 24);
84  store_32bit_word(cpu, FUSE_ROM_ADDR + i * 8 + 4, l << 28);
85  }
86 
87  break;
88 
89  default:fatal("Unimplemented LUNA88K machine subtype %i\n",
91  exit(1);
92  }
93 
94  if (machine->ncpus > 4) {
95  fatal("More than 4 CPUs is not supported for LUNA 88K.\n");
96  exit(1);
97  }
98 
99  if (!machine->prom_emulation)
100  return;
101 
103 }
104 
105 
107 {
108  machine->cpu_name = strdup("88100");
109 }
110 
111 
113 {
114  // Two OpenBSD dmesgs found on the Internet for a LUNA-88K2 showed 112 MB of real mem.
116 }
117 
118 
120 {
121  MR_DEFAULT(luna88k, "LUNA88K", ARCH_M88K, MACHINE_LUNA88K);
122 
123  machine_entry_add_alias(me, "luna88k");
124 
126  "luna-88k", NULL);
127 
129  "luna-88k2", NULL);
130 
131  me->set_default_ram = machine_default_ram_luna88k;
132 }
133 
machine::machine_subtype
int machine_subtype
Definition: machine.h:112
MACHINE_SETUP
MACHINE_SETUP(luna88k)
Definition: machine_luna88k.cc:55
MACHINE_DEFAULT_CPU
MACHINE_DEFAULT_CPU(luna88k)
Definition: machine_luna88k.cc:106
machine::physical_ram_in_mb
int physical_ram_in_mb
Definition: machine.h:147
machine::prom_emulation
int prom_emulation
Definition: machine.h:149
device.h
ARCH_M88K
#define ARCH_M88K
Definition: machine.h:208
luna88k_board.h
strlen
void COMBINE() strlen(struct cpu *cpu, struct arm_instr_call *ic, int low_addr)
Definition: cpu_arm_instr.cc:2333
fatal
void fatal(const char *fmt,...)
Definition: main.cc:152
machine::cpu_name
char * cpu_name
Definition: machine.h:133
machine_entry_add_subtype
void machine_entry_add_subtype(struct machine_entry *me, const char *name, int oldstyle_subtype,...)
Definition: machine.cc:717
MACHINE_REGISTER
MACHINE_REGISTER(luna88k)
Definition: machine_luna88k.cc:119
misc.h
device_add
void * device_add(struct machine *machine, const char *name_and_params)
Definition: device.cc:252
machine.h
machine
Definition: machine.h:97
MR_DEFAULT
#define MR_DEFAULT(x, name, arch, type)
Definition: machine.h:370
MACHINE_DEFAULT_RAM
MACHINE_DEFAULT_RAM(luna88k)
Definition: machine_luna88k.cc:112
FUSE_ROM_ADDR
#define FUSE_ROM_ADDR
Definition: luna88k_board.h:60
cpu.h
MACHINE_LUNA_88K
#define MACHINE_LUNA_88K
Definition: machine.h:333
luna88kprom_init
void luna88kprom_init(struct machine *machine)
Definition: luna88kprom.cc:50
MACHINE_LUNA_88K2
#define MACHINE_LUNA_88K2
Definition: machine.h:334
MACHINE_LUNA88K
#define MACHINE_LUNA88K
Definition: machine.h:259
store_32bit_word
int store_32bit_word(struct cpu *cpu, uint64_t addr, uint64_t data32)
Definition: memory.cc:783
devices.h
machine::machine_name
const char * machine_name
Definition: machine.h:115
cpu
Definition: cpu.h:326
machine_entry_add_alias
void machine_entry_add_alias(struct machine_entry *me, const char *name)
Definition: machine.cc:697
memory.h
machine::ncpus
int ncpus
Definition: machine.h:139

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17