Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Xing Lin
qemu
Commits
77f193da
Commit
77f193da
authored
May 12, 2008
by
blueswir1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Wrap long lines
git-svn-id:
svn://svn.savannah.nongnu.org/qemu/trunk@4440
c046a42c-6fe2-441c-8c8c-71466251a162
parent
8686c490
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
395 additions
and
200 deletions
+395
-200
hw/apb_pci.c
hw/apb_pci.c
+10
-5
hw/cs4231.c
hw/cs4231.c
+2
-1
hw/eccmemctl.c
hw/eccmemctl.c
+3
-2
hw/slavio_intctl.c
hw/slavio_intctl.c
+24
-10
hw/slavio_timer.c
hw/slavio_timer.c
+6
-3
hw/sun4c_intctl.c
hw/sun4c_intctl.c
+4
-2
hw/sun4m.c
hw/sun4m.c
+20
-10
hw/sun4u.c
hw/sun4u.c
+18
-9
hw/tcx.c
hw/tcx.c
+2
-1
target-sparc/cpu.h
target-sparc/cpu.h
+1
-1
target-sparc/helper.c
target-sparc/helper.c
+46
-26
target-sparc/op_helper.c
target-sparc/op_helper.c
+84
-44
target-sparc/translate.c
target-sparc/translate.c
+175
-86
No files found.
hw/apb_pci.c
View file @
77f193da
...
...
@@ -230,9 +230,12 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
pci_apb_iowrite
,
s
);
cpu_register_physical_memory
(
special_base
+
0x2000ULL
,
0x40
,
apb_config
);
cpu_register_physical_memory
(
special_base
+
0x1000000ULL
,
0x10
,
pci_mem_config
);
cpu_register_physical_memory
(
special_base
+
0x2000000ULL
,
0x10000
,
pci_ioport
);
cpu_register_physical_memory
(
mem_base
,
0x10000000
,
pci_mem_data
);
// XXX size should be 4G-prom
cpu_register_physical_memory
(
special_base
+
0x1000000ULL
,
0x10
,
pci_mem_config
);
cpu_register_physical_memory
(
special_base
+
0x2000000ULL
,
0x10000
,
pci_ioport
);
cpu_register_physical_memory
(
mem_base
,
0x10000000
,
pci_mem_data
);
// XXX size should be 4G-prom
d
=
pci_register_device
(
s
->
bus
,
"Advanced PCI Bus"
,
sizeof
(
PCIDevice
),
0
,
NULL
,
NULL
);
...
...
@@ -252,8 +255,10 @@ PCIBus *pci_apb_init(target_phys_addr_t special_base,
d
->
config
[
0x0E
]
=
0x00
;
// header_type
/* APB secondary busses */
secondary
=
pci_bridge_init
(
s
->
bus
,
8
,
0x108e5000
,
pci_apb_map_irq
,
"Advanced PCI Bus secondary bridge 1"
);
pci_bridge_init
(
s
->
bus
,
9
,
0x108e5000
,
pci_apb_map_irq
,
"Advanced PCI Bus secondary bridge 2"
);
secondary
=
pci_bridge_init
(
s
->
bus
,
8
,
0x108e5000
,
pci_apb_map_irq
,
"Advanced PCI Bus secondary bridge 1"
);
pci_bridge_init
(
s
->
bus
,
9
,
0x108e5000
,
pci_apb_map_irq
,
"Advanced PCI Bus secondary bridge 2"
);
return
secondary
;
}
...
...
hw/cs4231.c
View file @
77f193da
...
...
@@ -98,7 +98,8 @@ static void cs_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
DPRINTF
(
"write reg[%d]: 0x%8.8x -> 0x%8.8x
\n
"
,
saddr
,
s
->
regs
[
saddr
],
val
);
switch
(
saddr
)
{
case
1
:
DPRINTF
(
"write dreg[%d]: 0x%2.2x -> 0x%2.2x
\n
"
,
CS_RAP
(
s
),
s
->
dregs
[
CS_RAP
(
s
)],
val
);
DPRINTF
(
"write dreg[%d]: 0x%2.2x -> 0x%2.2x
\n
"
,
CS_RAP
(
s
),
s
->
dregs
[
CS_RAP
(
s
)],
val
);
switch
(
CS_RAP
(
s
))
{
case
11
:
case
25
:
// Read only
...
...
hw/eccmemctl.c
View file @
77f193da
...
...
@@ -53,7 +53,8 @@
/* ECC fault control register */
#define ECC_MER_EE 0x00000001
/* Enable ECC checking */
#define ECC_MER_EI 0x00000002
/* Enable Interrupts on correctable errors */
#define ECC_MER_EI 0x00000002
/* Enable Interrupts on
correctable errors */
#define ECC_MER_MRR0 0x00000004
/* SIMM 0 */
#define ECC_MER_MRR1 0x00000008
/* SIMM 1 */
#define ECC_MER_MRR2 0x00000010
/* SIMM 2 */
...
...
@@ -65,7 +66,7 @@
#define ECC_MER_REU 0x00000200
/* Memory Refresh Enable (600MP) */
#define ECC_MER_MRR 0x000003fc
/* MRR mask */
#define ECC_MEM_A 0x00000400
/* Memory controller addr map select */
#define ECC_MER_DCI 0x00000800
/* D
s
iables Coherent Invalidate ACK */
#define ECC_MER_DCI 0x00000800
/* Di
s
ables Coherent Invalidate ACK */
#define ECC_MER_VER 0x0f000000
/* Version */
#define ECC_MER_IMPL 0xf0000000
/* Implementation */
...
...
hw/slavio_intctl.c
View file @
77f193da
...
...
@@ -99,7 +99,8 @@ static uint32_t slavio_intctl_mem_readl(void *opaque, target_phys_addr_t addr)
return
ret
;
}
static
void
slavio_intctl_mem_writel
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
static
void
slavio_intctl_mem_writel
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
{
SLAVIO_INTCTLState
*
s
=
opaque
;
uint32_t
saddr
;
...
...
@@ -115,13 +116,15 @@ static void slavio_intctl_mem_writel(void *opaque, target_phys_addr_t addr, uint
val
&=
CPU_SOFTIRQ_MASK
;
s
->
intreg_pending
[
cpu
]
&=
~
val
;
slavio_check_interrupts
(
s
);
DPRINTF
(
"Cleared cpu %d irq mask %x, curmask %x
\n
"
,
cpu
,
val
,
s
->
intreg_pending
[
cpu
]);
DPRINTF
(
"Cleared cpu %d irq mask %x, curmask %x
\n
"
,
cpu
,
val
,
s
->
intreg_pending
[
cpu
]);
break
;
case
2
:
// set softint
val
&=
CPU_SOFTIRQ_MASK
;
s
->
intreg_pending
[
cpu
]
|=
val
;
slavio_check_interrupts
(
s
);
DPRINTF
(
"Set cpu %d irq mask %x, curmask %x
\n
"
,
cpu
,
val
,
s
->
intreg_pending
[
cpu
]);
DPRINTF
(
"Set cpu %d irq mask %x, curmask %x
\n
"
,
cpu
,
val
,
s
->
intreg_pending
[
cpu
]);
break
;
default:
break
;
...
...
@@ -166,7 +169,8 @@ static uint32_t slavio_intctlm_mem_readl(void *opaque, target_phys_addr_t addr)
return
ret
;
}
static
void
slavio_intctlm_mem_writel
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
static
void
slavio_intctlm_mem_writel
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
{
SLAVIO_INTCTLState
*
s
=
opaque
;
uint32_t
saddr
;
...
...
@@ -178,7 +182,8 @@ static void slavio_intctlm_mem_writel(void *opaque, target_phys_addr_t addr, uin
// Force clear unused bits
val
&=
MASTER_IRQ_MASK
;
s
->
intregm_disabled
&=
~
val
;
DPRINTF
(
"Enabled master irq mask %x, curmask %x
\n
"
,
val
,
s
->
intregm_disabled
);
DPRINTF
(
"Enabled master irq mask %x, curmask %x
\n
"
,
val
,
s
->
intregm_disabled
);
slavio_check_interrupts
(
s
);
break
;
case
3
:
// set (disable, clear pending)
...
...
@@ -187,7 +192,8 @@ static void slavio_intctlm_mem_writel(void *opaque, target_phys_addr_t addr, uin
s
->
intregm_disabled
|=
val
;
s
->
intregm_pending
&=
~
val
;
slavio_check_interrupts
(
s
);
DPRINTF
(
"Disabled master irq mask %x, curmask %x
\n
"
,
val
,
s
->
intregm_disabled
);
DPRINTF
(
"Disabled master irq mask %x, curmask %x
\n
"
,
val
,
s
->
intregm_disabled
);
break
;
case
4
:
s
->
target_cpu
=
val
&
(
MAX_CPUS
-
1
);
...
...
@@ -219,7 +225,8 @@ void slavio_pic_info(void *opaque)
for
(
i
=
0
;
i
<
MAX_CPUS
;
i
++
)
{
term_printf
(
"per-cpu %d: pending 0x%08x
\n
"
,
i
,
s
->
intreg_pending
[
i
]);
}
term_printf
(
"master: pending 0x%08x, disabled 0x%08x
\n
"
,
s
->
intregm_pending
,
s
->
intregm_disabled
);
term_printf
(
"master: pending 0x%08x, disabled 0x%08x
\n
"
,
s
->
intregm_pending
,
s
->
intregm_disabled
);
}
void
slavio_irq_info
(
void
*
opaque
)
...
...
@@ -376,16 +383,23 @@ void *slavio_intctl_init(target_phys_addr_t addr, target_phys_addr_t addrg,
s
->
intbit_to_level
=
intbit_to_level
;
for
(
i
=
0
;
i
<
MAX_CPUS
;
i
++
)
{
slavio_intctl_io_memory
=
cpu_register_io_memory
(
0
,
slavio_intctl_mem_read
,
slavio_intctl_mem_write
,
s
);
slavio_intctl_io_memory
=
cpu_register_io_memory
(
0
,
slavio_intctl_mem_read
,
slavio_intctl_mem_write
,
s
);
cpu_register_physical_memory
(
addr
+
i
*
TARGET_PAGE_SIZE
,
INTCTL_SIZE
,
slavio_intctl_io_memory
);
s
->
cpu_irqs
[
i
]
=
parent_irq
[
i
];
}
slavio_intctlm_io_memory
=
cpu_register_io_memory
(
0
,
slavio_intctlm_mem_read
,
slavio_intctlm_mem_write
,
s
);
slavio_intctlm_io_memory
=
cpu_register_io_memory
(
0
,
slavio_intctlm_mem_read
,
slavio_intctlm_mem_write
,
s
);
cpu_register_physical_memory
(
addrg
,
INTCTLM_SIZE
,
slavio_intctlm_io_memory
);
register_savevm
(
"slavio_intctl"
,
addr
,
1
,
slavio_intctl_save
,
slavio_intctl_load
,
s
);
register_savevm
(
"slavio_intctl"
,
addr
,
1
,
slavio_intctl_save
,
slavio_intctl_load
,
s
);
qemu_register_reset
(
slavio_intctl_reset
,
s
);
*
irq
=
qemu_allocate_irqs
(
slavio_set_irq
,
s
,
32
);
...
...
hw/slavio_timer.c
View file @
77f193da
...
...
@@ -206,7 +206,8 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
s
->
limit
=
val
&
TIMER_MAX_COUNT32
;
if
(
s
->
timer
)
{
if
(
s
->
limit
==
0
)
/* free-run */
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
TIMER_MAX_COUNT32
),
1
);
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
TIMER_MAX_COUNT32
),
1
);
else
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
s
->
limit
),
1
);
}
...
...
@@ -233,7 +234,8 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
s
->
limit
=
val
&
TIMER_MAX_COUNT32
;
if
(
s
->
timer
)
{
if
(
s
->
limit
==
0
)
/* free-run */
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
TIMER_MAX_COUNT32
),
0
);
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
TIMER_MAX_COUNT32
),
0
);
else
ptimer_set_limit
(
s
->
timer
,
LIMIT_TO_PERIODS
(
s
->
limit
),
0
);
}
...
...
@@ -271,7 +273,8 @@ static void slavio_timer_mem_writel(void *opaque, target_phys_addr_t addr,
// user timer limit is always the same
s
->
slave
[
i
]
->
limit
=
TIMER_MAX_COUNT64
;
ptimer_set_limit
(
s
->
slave
[
i
]
->
timer
,
LIMIT_TO_PERIODS
(
s
->
slave
[
i
]
->
limit
),
1
);
LIMIT_TO_PERIODS
(
s
->
slave
[
i
]
->
limit
),
1
);
// set this processors user timer bit in config
// register
s
->
slave_mode
|=
processor
;
...
...
hw/sun4c_intctl.c
View file @
77f193da
...
...
@@ -68,7 +68,8 @@ static uint32_t sun4c_intctl_mem_readb(void *opaque, target_phys_addr_t addr)
return
ret
;
}
static
void
sun4c_intctl_mem_writeb
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
static
void
sun4c_intctl_mem_writeb
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
{
Sun4c_INTCTLState
*
s
=
opaque
;
...
...
@@ -94,7 +95,8 @@ void sun4c_pic_info(void *opaque)
{
Sun4c_INTCTLState
*
s
=
opaque
;
term_printf
(
"master: pending 0x%2.2x, enabled 0x%2.2x
\n
"
,
s
->
pending
,
s
->
reg
);
term_printf
(
"master: pending 0x%2.2x, enabled 0x%2.2x
\n
"
,
s
->
pending
,
s
->
reg
);
}
void
sun4c_irq_info
(
void
*
opaque
)
...
...
hw/sun4m.c
View file @
77f193da
...
...
@@ -41,7 +41,8 @@
* Sun4m architecture was used in the following machines:
*
* SPARCserver 6xxMP/xx
* SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15), SPARCclassic X (4/10)
* SPARCclassic (SPARCclassic Server)(SPARCstation LC) (4/15),
* SPARCclassic X (4/10)
* SPARCstation LX/ZX (4/30)
* SPARCstation Voyager
* SPARCstation 10/xx, SPARCserver 10/xx
...
...
@@ -327,9 +328,11 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
kernel_size
=
load_elf
(
kernel_filename
,
-
0xf0000000ULL
,
NULL
,
NULL
,
NULL
);
if
(
kernel_size
<
0
)
kernel_size
=
load_aout
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
kernel_size
=
load_aout
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
if
(
kernel_size
<
0
)
kernel_size
=
load_image
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
kernel_size
=
load_image
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
if
(
kernel_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load kernel '%s'
\n
"
,
kernel_filename
);
...
...
@@ -339,7 +342,8 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
/* load initrd */
initrd_size
=
0
;
if
(
initrd_filename
)
{
initrd_size
=
load_image
(
initrd_filename
,
phys_ram_base
+
INITRD_LOAD_ADDR
);
initrd_size
=
load_image
(
initrd_filename
,
phys_ram_base
+
INITRD_LOAD_ADDR
);
if
(
initrd_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load initial ram disk '%s'
\n
"
,
initrd_filename
);
...
...
@@ -350,8 +354,10 @@ static unsigned long sun4m_load_kernel(const char *kernel_filename,
for
(
i
=
0
;
i
<
64
*
TARGET_PAGE_SIZE
;
i
+=
TARGET_PAGE_SIZE
)
{
if
(
ldl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
)
==
0x48647253
)
{
// HdrS
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
16
,
INITRD_LOAD_ADDR
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
20
,
initrd_size
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
16
,
INITRD_LOAD_ADDR
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
20
,
initrd_size
);
break
;
}
}
...
...
@@ -409,7 +415,8 @@ static void sun4m_hw_init(const struct hwdef *hwdef, ram_addr_t RAM_size,
/* allocate RAM */
if
((
uint64_t
)
RAM_size
>
hwdef
->
max_mem
)
{
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
(
unsigned
int
)(
RAM_size
/
(
1024
*
1024
)),
(
unsigned
int
)(
hwdef
->
max_mem
/
(
1024
*
1024
)));
exit
(
1
);
...
...
@@ -575,7 +582,8 @@ static void sun4c_hw_init(const struct hwdef *hwdef, ram_addr_t RAM_size,
/* allocate RAM */
if
((
uint64_t
)
RAM_size
>
hwdef
->
max_mem
)
{
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
(
unsigned
int
)(
RAM_size
/
(
1024
*
1024
)),
(
unsigned
int
)(
hwdef
->
max_mem
/
(
1024
*
1024
)));
exit
(
1
);
...
...
@@ -1127,7 +1135,8 @@ static void ss10_init(ram_addr_t RAM_size, int vga_ram_size,
/* SPARCserver 600MP hardware initialisation */
static
void
ss600mp_init
(
ram_addr_t
RAM_size
,
int
vga_ram_size
,
const
char
*
boot_device
,
DisplayState
*
ds
,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
const
char
*
initrd_filename
,
const
char
*
cpu_model
)
{
sun4m_hw_init
(
&
hwdefs
[
2
],
RAM_size
,
boot_device
,
ds
,
kernel_filename
,
...
...
@@ -1388,7 +1397,8 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
/* allocate RAM */
if
((
uint64_t
)
RAM_size
>
hwdef
->
max_mem
)
{
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
fprintf
(
stderr
,
"qemu: Too much memory for this machine: %d, maximum %d
\n
"
,
(
unsigned
int
)(
RAM_size
/
(
1024
*
1024
)),
(
unsigned
int
)(
hwdef
->
max_mem
/
(
1024
*
1024
)));
exit
(
1
);
...
...
hw/sun4u.c
View file @
77f193da
...
...
@@ -72,7 +72,8 @@ extern int nographic;
static
int
sun4u_NVRAM_set_params
(
m48t59_t
*
nvram
,
uint16_t
NVRAM_size
,
const
unsigned
char
*
arch
,
ram_addr_t
RAM_size
,
const
char
*
boot_devices
,
ram_addr_t
RAM_size
,
const
char
*
boot_devices
,
uint32_t
kernel_image
,
uint32_t
kernel_size
,
const
char
*
cmdline
,
uint32_t
initrd_image
,
uint32_t
initrd_size
,
...
...
@@ -268,7 +269,8 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
prom_offset
=
RAM_size
+
vga_ram_size
;
cpu_register_physical_memory
(
PROM_ADDR
,
(
PROM_SIZE_MAX
+
TARGET_PAGE_SIZE
)
&
TARGET_PAGE_MASK
,
(
PROM_SIZE_MAX
+
TARGET_PAGE_SIZE
)
&
TARGET_PAGE_MASK
,
prom_offset
|
IO_MEM_ROM
);
if
(
bios_name
==
NULL
)
...
...
@@ -287,9 +289,11 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
/* XXX: put correct offset */
kernel_size
=
load_elf
(
kernel_filename
,
0
,
NULL
,
NULL
,
NULL
);
if
(
kernel_size
<
0
)
kernel_size
=
load_aout
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
kernel_size
=
load_aout
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
if
(
kernel_size
<
0
)
kernel_size
=
load_image
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
kernel_size
=
load_image
(
kernel_filename
,
phys_ram_base
+
KERNEL_LOAD_ADDR
);
if
(
kernel_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load kernel '%s'
\n
"
,
kernel_filename
);
...
...
@@ -298,7 +302,8 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
/* load initrd */
if
(
initrd_filename
)
{
initrd_size
=
load_image
(
initrd_filename
,
phys_ram_base
+
INITRD_LOAD_ADDR
);
initrd_size
=
load_image
(
initrd_filename
,
phys_ram_base
+
INITRD_LOAD_ADDR
);
if
(
initrd_size
<
0
)
{
fprintf
(
stderr
,
"qemu: could not load initial ram disk '%s'
\n
"
,
initrd_filename
);
...
...
@@ -309,8 +314,10 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
for
(
i
=
0
;
i
<
64
*
TARGET_PAGE_SIZE
;
i
+=
TARGET_PAGE_SIZE
)
{
if
(
ldl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
)
==
0x48647253
)
{
// HdrS
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
16
,
INITRD_LOAD_ADDR
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
20
,
initrd_size
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
16
,
INITRD_LOAD_ADDR
);
stl_raw
(
phys_ram_base
+
KERNEL_LOAD_ADDR
+
i
+
20
,
initrd_size
);
break
;
}
}
...
...
@@ -318,7 +325,8 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
}
pci_bus
=
pci_apb_init
(
APB_SPECIAL_BASE
,
APB_MEM_BASE
,
NULL
);
isa_mem_base
=
VGA_BASE
;
pci_cirrus_vga_init
(
pci_bus
,
ds
,
phys_ram_base
+
RAM_size
,
RAM_size
,
vga_ram_size
);
pci_cirrus_vga_init
(
pci_bus
,
ds
,
phys_ram_base
+
RAM_size
,
RAM_size
,
vga_ram_size
);
for
(
i
=
0
;
i
<
MAX_SERIAL_PORTS
;
i
++
)
{
if
(
serial_hds
[
i
])
{
...
...
@@ -329,7 +337,8 @@ static void sun4u_init(ram_addr_t RAM_size, int vga_ram_size,
for
(
i
=
0
;
i
<
MAX_PARALLEL_PORTS
;
i
++
)
{
if
(
parallel_hds
[
i
])
{
parallel_init
(
parallel_io
[
i
],
NULL
/*parallel_irq[i]*/
,
parallel_hds
[
i
]);
parallel_init
(
parallel_io
[
i
],
NULL
/*parallel_irq[i]*/
,
parallel_hds
[
i
]);
}
}
...
...
hw/tcx.c
View file @
77f193da
...
...
@@ -516,7 +516,8 @@ void tcx_init(DisplayState *ds, target_phys_addr_t addr, uint8_t *vram_base,
vram_base
+=
size
;
io_memory
=
cpu_register_io_memory
(
0
,
tcx_dac_read
,
tcx_dac_write
,
s
);
cpu_register_physical_memory
(
addr
+
0x00200000ULL
,
TCX_DAC_NREGS
,
io_memory
);
cpu_register_physical_memory
(
addr
+
0x00200000ULL
,
TCX_DAC_NREGS
,
io_memory
);
dummy_memory
=
cpu_register_io_memory
(
0
,
tcx_dummy_read
,
tcx_dummy_write
,
s
);
...
...
target-sparc/cpu.h
View file @
77f193da
...
...
@@ -347,7 +347,7 @@ void cpu_set_cwp(CPUSPARCState *env1, int new_cwp);
#ifdef TARGET_SPARC64
#define GET_CCR(env) (((env->xcc >> 20) << 4) | ((env->psr & PSR_ICC) >> 20))
#define PUT_CCR(env, val) do { int _tmp = val; \
env->xcc = (_tmp >> 4) << 20;
\
env->xcc = (_tmp >> 4) << 20; \
env->psr = (_tmp & 0xf) << 20; \
} while (0)
#define GET_CWP64(env) (NWINDOWS - 1 - (env)->cwp)
...
...
target-sparc/helper.c
View file @
77f193da
...
...
@@ -193,7 +193,8 @@ static int get_physical_address(CPUState *env, target_phys_addr_t *physical,
return
(
3
<<
8
)
|
(
4
<<
2
);
case
2
:
/* L3 PTE */
virt_addr
=
address
&
TARGET_PAGE_MASK
;
page_offset
=
(
address
&
TARGET_PAGE_MASK
)
&
(
TARGET_PAGE_SIZE
-
1
);
page_offset
=
(
address
&
TARGET_PAGE_MASK
)
&
(
TARGET_PAGE_SIZE
-
1
);
}
break
;
case
2
:
/* L2 PTE */
...
...
@@ -243,7 +244,8 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
target_ulong
vaddr
;
int
error_code
=
0
,
prot
,
ret
=
0
,
access_index
;
error_code
=
get_physical_address
(
env
,
&
paddr
,
&
prot
,
&
access_index
,
address
,
rw
,
mmu_idx
);
error_code
=
get_physical_address
(
env
,
&
paddr
,
&
prot
,
&
access_index
,
address
,
rw
,
mmu_idx
);
if
(
error_code
==
0
)
{
vaddr
=
address
&
TARGET_PAGE_MASK
;
paddr
&=
TARGET_PAGE_MASK
;
...
...
@@ -387,7 +389,8 @@ void dump_mmu(CPUState *env)
/*
* UltraSparc IIi I/DMMUs
*/
static
int
get_physical_address_data
(
CPUState
*
env
,
target_phys_addr_t
*
physical
,
int
*
prot
,
static
int
get_physical_address_data
(
CPUState
*
env
,
target_phys_addr_t
*
physical
,
int
*
prot
,
target_ulong
address
,
int
rw
,
int
is_user
)
{
target_ulong
mask
;
...
...
@@ -423,7 +426,8 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
((
env
->
dtlb_tte
[
i
]
&
0x4
)
&&
is_user
)
||
(
!
(
env
->
dtlb_tte
[
i
]
&
0x2
)
&&
(
rw
==
1
)))
{
if
(
env
->
dmmuregs
[
3
])
/* Fault status register */
env
->
dmmuregs
[
3
]
=
2
;
/* overflow (not read before another fault) */
env
->
dmmuregs
[
3
]
=
2
;
/* overflow (not read before
another fault) */
env
->
dmmuregs
[
3
]
|=
(
is_user
<<
3
)
|
((
rw
==
1
)
<<
2
)
|
1
;
env
->
dmmuregs
[
4
]
=
address
;
/* Fault address register */
env
->
exception_index
=
TT_DFAULT
;
...
...
@@ -432,7 +436,8 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
#endif
return
1
;
}
*
physical
=
(
env
->
dtlb_tte
[
i
]
&
mask
&
0x1fffffff000ULL
)
+
(
address
&
~
mask
&
0x1fffffff000ULL
);
*
physical
=
(
env
->
dtlb_tte
[
i
]
&
mask
&
0x1fffffff000ULL
)
+
(
address
&
~
mask
&
0x1fffffff000ULL
);
*
prot
=
PAGE_READ
;
if
(
env
->
dtlb_tte
[
i
]
&
0x2
)
*
prot
|=
PAGE_WRITE
;
...
...
@@ -446,7 +451,8 @@ static int get_physical_address_data(CPUState *env, target_phys_addr_t *physical
return
1
;
}
static
int
get_physical_address_code
(
CPUState
*
env
,
target_phys_addr_t
*
physical
,
int
*
prot
,
static
int
get_physical_address_code
(
CPUState
*
env
,
target_phys_addr_t
*
physical
,
int
*
prot
,
target_ulong
address
,
int
is_user
)
{
target_ulong
mask
;
...
...
@@ -481,7 +487,8 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
if
((
env
->
itlb_tte
[
i
]
&
0x8000000000000000ULL
)
==
0
||
((
env
->
itlb_tte
[
i
]
&
0x4
)
&&
is_user
))
{
if
(
env
->
immuregs
[
3
])
/* Fault status register */
env
->
immuregs
[
3
]
=
2
;
/* overflow (not read before another fault) */
env
->
immuregs
[
3
]
=
2
;
/* overflow (not read before
another fault) */
env
->
immuregs
[
3
]
|=
(
is_user
<<
3
)
|
1
;
env
->
exception_index
=
TT_TFAULT
;
#ifdef DEBUG_MMU
...
...
@@ -489,7 +496,8 @@ static int get_physical_address_code(CPUState *env, target_phys_addr_t *physical
#endif
return
1
;
}
*
physical
=
(
env
->
itlb_tte
[
i
]
&
mask
&
0x1fffffff000ULL
)
+
(
address
&
~
mask
&
0x1fffffff000ULL
);
*
physical
=
(
env
->
itlb_tte
[
i
]
&
mask
&
0x1fffffff000ULL
)
+
(
address
&
~
mask
&
0x1fffffff000ULL
);
*
prot
=
PAGE_EXEC
;
return
0
;
}
...
...
@@ -523,12 +531,15 @@ int cpu_sparc_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
target_phys_addr_t
paddr
;
int
error_code
=
0
,
prot
,
ret
=
0
,
access_index
;
error_code
=
get_physical_address
(
env
,
&
paddr
,
&
prot
,
&
access_index
,
address
,
rw
,
mmu_idx
);
error_code
=
get_physical_address
(
env
,
&
paddr
,
&
prot
,
&
access_index
,
address
,
rw
,
mmu_idx
);
if
(
error_code
==
0
)
{
virt_addr
=
address
&
TARGET_PAGE_MASK
;
vaddr
=
virt_addr
+
((
address
&
TARGET_PAGE_MASK
)
&
(
TARGET_PAGE_SIZE
-
1
));
vaddr
=
virt_addr
+
((
address
&
TARGET_PAGE_MASK
)
&
(
TARGET_PAGE_SIZE
-
1
));
#ifdef DEBUG_MMU
printf
(
"Translate at 0x%"
PRIx64
" -> 0x%"
PRIx64
", vaddr 0x%"
PRIx64
"
\n
"
,
address
,
paddr
,
vaddr
);
printf
(
"Translate at 0x%"
PRIx64
" -> 0x%"
PRIx64
", vaddr 0x%"
PRIx64
"
\n
"
,
address
,
paddr
,
vaddr
);
#endif
ret
=
tlb_set_page_exec
(
env
,
vaddr
,
paddr
,
prot
,
mmu_idx
,
is_softmmu
);
return
ret
;
...
...
@@ -543,7 +554,8 @@ void dump_mmu(CPUState *env)
unsigned
int
i
;
const
char
*
mask
;
printf
(
"MMU contexts: Primary: %"
PRId64
", Secondary: %"
PRId64
"
\n
"
,
env
->
dmmuregs
[
1
],
env
->
dmmuregs
[
2
]);
printf
(
"MMU contexts: Primary: %"
PRId64
", Secondary: %"
PRId64
"
\n
"
,
env
->
dmmuregs
[
1
],
env
->
dmmuregs
[
2
]);
if
((
env
->
lsu
&
DMMU_E
)
==
0
)
{
printf
(
"DMMU disabled
\n
"
);
}
else
{
...
...
@@ -565,7 +577,8 @@ void dump_mmu(CPUState *env)
break
;
}
if
((
env
->
dtlb_tte
[
i
]
&
0x8000000000000000ULL
)
!=
0
)
{
printf
(
"VA: "
TARGET_FMT_lx
", PA: "
TARGET_FMT_lx
", %s, %s, %s, %s, ctx %"
PRId64
"
\n
"
,
printf
(
"VA: "
TARGET_FMT_lx
", PA: "
TARGET_FMT_lx
", %s, %s, %s, %s, ctx %"
PRId64
"
\n
"
,
env
->
dtlb_tag
[
i
]
&
~
0x1fffULL
,
env
->
dtlb_tte
[
i
]
&
0x1ffffffe000ULL
,
mask
,
...
...
@@ -597,7 +610,8 @@ void dump_mmu(CPUState *env)
break
;
}
if
((
env
->
itlb_tte
[
i
]
&
0x8000000000000000ULL
)
!=
0
)
{
printf
(
"VA: "
TARGET_FMT_lx
", PA: "
TARGET_FMT_lx
", %s, %s, %s, ctx %"
PRId64
"
\n
"
,
printf
(
"VA: "
TARGET_FMT_lx
", PA: "
TARGET_FMT_lx
", %s, %s, %s, ctx %"
PRId64
"
\n
"
,
env
->
itlb_tag
[
i
]
&
~
0x1fffULL
,
env
->
itlb_tte
[
i
]
&
0x1ffffffe000ULL
,
mask
,
...
...
@@ -1206,7 +1220,8 @@ static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model)
goto
error
;
}
}
else
{
fprintf
(
stderr
,
"feature string `%s' not in format (+feature|-feature|feature=xyz)
\n
"
,
featurestr
);
fprintf
(
stderr
,
"feature string `%s' not in format "
"(+feature|-feature|feature=xyz)
\n
"
,
featurestr
);
goto
error
;
}
featurestr
=
strtok
(
NULL
,
","
);
...
...
@@ -1224,7 +1239,7 @@ static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model)
return
-
1
;
}
void
sparc_cpu_list
(
FILE
*
f
,
int
(
*
cpu_fprintf
)(
FILE
*
f
,
const
char
*
fmt
,
...))
void
sparc_cpu_list
(
FILE
*
f
,
int
(
*
cpu_fprintf
)(
FILE
*
f
,
const
char
*
fmt
,
...))
{
unsigned
int
i
;
...
...
@@ -1234,14 +1249,17 @@ void sparc_cpu_list (FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
sparc_defs
[
i
].
iu_version
,
sparc_defs
[
i
].
fpu_version
,
sparc_defs
[
i
].
mmu_version
);
print_features
(
f
,
cpu_fprintf
,
CPU_DEFAULT_FEATURES
&
~
sparc_defs
[
i
].
features
,
"-"
);
print_features
(
f
,
cpu_fprintf
,
~
CPU_DEFAULT_FEATURES
&
sparc_defs
[
i
].
features
,
"+"
);
print_features
(
f
,
cpu_fprintf
,
CPU_DEFAULT_FEATURES
&
~
sparc_defs
[
i
].
features
,
"-"
);
print_features
(
f
,
cpu_fprintf
,
~
CPU_DEFAULT_FEATURES
&
sparc_defs
[
i
].
features
,
"+"
);
(
*
cpu_fprintf
)(
f
,
"
\n
"
);
}
(
*
cpu_fprintf
)(
f
,
"CPU feature flags (+/-): "
);
print_features
(
f
,
cpu_fprintf
,
-
1
,
NULL
);
(
*
cpu_fprintf
)(
f
,
"
\n
"
);
(
*
cpu_fprintf
)(
f
,
"Numerical features (=): iu_version fpu_version mmu_version
\n
"
);
(
*
cpu_fprintf
)(
f
,
"Numerical features (=): iu_version fpu_version "
"mmu_version
\n
"
);
}
#define GET_FLAG(a,b) ((env->psr & a)?b:'-')
...
...
@@ -1252,7 +1270,8 @@ void cpu_dump_state(CPUState *env, FILE *f,
{
int
i
,
x
;
cpu_fprintf
(
f
,
"pc: "
TARGET_FMT_lx
" npc: "
TARGET_FMT_lx
"
\n
"
,
env
->
pc
,
env
->
npc
);
cpu_fprintf
(
f
,
"pc: "
TARGET_FMT_lx
" npc: "
TARGET_FMT_lx
"
\n
"
,
env
->
pc
,
env
->
npc
);
cpu_fprintf
(
f
,
"General Registers:
\n
"
);
for
(
i
=
0
;
i
<
4
;
i
++
)
cpu_fprintf
(
f
,
"%%g%c: "
TARGET_FMT_lx
"
\t
"
,
i
+
'0'
,
env
->
gregs
[
i
]);
...
...
@@ -1283,15 +1302,16 @@ void cpu_dump_state(CPUState *env, FILE *f,
#ifdef TARGET_SPARC64
cpu_fprintf
(
f
,
"pstate: 0x%08x ccr: 0x%02x asi: 0x%02x tl: %d fprs: %d
\n
"
,
env
->
pstate
,
GET_CCR
(
env
),
env
->
asi
,
env
->
tl
,
env
->
fprs
);
cpu_fprintf
(
f
,
"cansave: %d canrestore: %d otherwin: %d wstate %d cleanwin %d cwp %d
\n
"
,
cpu_fprintf
(
f
,
"cansave: %d canrestore: %d otherwin: %d wstate %d "
"cleanwin %d cwp %d
\n
"
,
env
->
cansave
,
env
->
canrestore
,
env
->
otherwin
,
env
->
wstate
,
env
->
cleanwin
,
NWINDOWS
-
1
-
env
->
cwp
);
#else
cpu_fprintf
(
f
,
"psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x
\n
"
,
GET_PSR
(
env
),
GET_FLAG
(
PSR_ZERO
,
'Z'
),
GET_FLAG
(
PSR_OVF
,
'V'
),
GET_FLAG
(
PSR_NEG
,
'N'
),
GET_FLAG
(
PSR_CARRY
,
'C'
),
env
->
psrs
?
'S'
:
'-'
,
env
->
psrps
?
'P'
:
'-'
,
env
->
psret
?
'E'
:
'-'
,
env
->
wim
);
cpu_fprintf
(
f
,
"psr: 0x%08x -> %c%c%c%c %c%c%c wim: 0x%08x
\n
"
,
GET_PSR
(
env
),
GET_FLAG
(
PSR_ZERO
,
'Z'
),
GET_FLAG
(
PSR_OVF
,
'V'
),
GET_FLAG
(
PSR_NEG
,
'N'
),
GET_FLAG
(
PSR_CARRY
,
'C'
),
env
->
psrs
?
'S'
:
'-'
,
env
->
psrps
?
'P'
:
'-'
,
env
->
psret
?
'E'
:
'-'
,
env
->
wim
);
#endif
cpu_fprintf
(
f
,
"fsr: 0x%08x
\n
"
,
GET_FSR32
(
env
));
}
...
...
target-sparc/op_helper.c
View file @
77f193da
...
...
@@ -795,15 +795,19 @@ GEN_FCMP(fcmped_fcc3, float64, DT0, DT1, 26, 1);
GEN_FCMP
(
fcmpeq_fcc3
,
float128
,
QT0
,
QT1
,
26
,
1
);
#endif
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && defined(DEBUG_MXCC)
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) && \
defined(DEBUG_MXCC)
static
void
dump_mxcc
(
CPUState
*
env
)
{
printf
(
"mxccdata: %016llx %016llx %016llx %016llx
\n
"
,
env
->
mxccdata
[
0
],
env
->
mxccdata
[
1
],
env
->
mxccdata
[
2
],
env
->
mxccdata
[
3
]);
env
->
mxccdata
[
0
],
env
->
mxccdata
[
1
],
env
->
mxccdata
[
2
],
env
->
mxccdata
[
3
]);
printf
(
"mxccregs: %016llx %016llx %016llx %016llx
\n
"
" %016llx %016llx %016llx %016llx
\n
"
,
env
->
mxccregs
[
0
],
env
->
mxccregs
[
1
],
env
->
mxccregs
[
2
],
env
->
mxccregs
[
3
],
env
->
mxccregs
[
4
],
env
->
mxccregs
[
5
],
env
->
mxccregs
[
6
],
env
->
mxccregs
[
7
]);
env
->
mxccregs
[
0
],
env
->
mxccregs
[
1
],
env
->
mxccregs
[
2
],
env
->
mxccregs
[
3
],
env
->
mxccregs
[
4
],
env
->
mxccregs
[
5
],
env
->
mxccregs
[
6
],
env
->
mxccregs
[
7
]);
}
#endif
...
...
@@ -851,32 +855,38 @@ uint64_t helper_ld_asi(target_ulong addr, int asi, int size, int sign)
if
(
size
==
8
)
ret
=
env
->
mxccregs
[
3
];
else
DPRINTF_MXCC
(
"%08x: unimplemented access size: %d
\n
"
,
addr
,
size
);
DPRINTF_MXCC
(
"%08x: unimplemented access size: %d
\n
"
,
addr
,
size
);
break
;
case
0x01c00a04
:
/* MXCC control register */
if
(
size
==
4
)
ret
=
env
->
mxccregs
[
3
];
else