summaryrefslogtreecommitdiffstats
path: root/results/classifier/zero-shot/118/kernel/1733720
blob: 24227987bac2af1565941e13b2695d1399e0058d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
mistranslation: 0.985
architecture: 0.972
kernel: 0.959
device: 0.937
performance: 0.931
arm: 0.929
graphic: 0.903
peripherals: 0.879
user-level: 0.844
semantic: 0.835
debug: 0.814
ppc: 0.809
assembly: 0.805
socket: 0.769
boot: 0.755
files: 0.709
vnc: 0.708
register: 0.576
permissions: 0.568
network: 0.539
KVM: 0.500
VMM: 0.469
risc-v: 0.467
x86: 0.461
PID: 0.458
virtual: 0.415
TCG: 0.381
hypervisor: 0.315
i386: 0.233

raspi2 with multiple CPU's #1

Greetings,

I am running a small program for raspi2 (from http://wiki.osdev.org/ARM_RaspberryPi_Tutorial_C).

This code writes "Hello World", but the output ir repeated 4 times.

My thought was that this is emulating a 4 cpu core system.

However, when I check the MPIDR registed for CPU number, it always returns 1.

I git cloned github.com/qemu/qemu.git, made & installed on Acer ARM CB5-311 under Crouton/ubuntu.


./qemu.sh 
1111

Linux:armv7l: ~/Downloads/RaspiTest/BareBones >>> uname -a
Linux localhost 3.10.18 #1 SMP Mon Nov 13 16:34:10 PST 2017 armv7l armv7l armv7l GNU/Linux

Linux:armv7l: ~/Downloads/RaspiTest/BareBones >>> qemu-system-arm --version
QEMU emulator version 2.10.91 (v2.11.0-rc1-dirty)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers

=====
static inline uint32_t read_mpdir(void)
{
  uint32_t id;
  
  asm volatile("mrc p15, 0, %[id], c0, c0, 0 @ read MIDR\n\t"
	       : [id] "=r" (id));
  return id;
}
======
void kernel_main(uint32_t r0, uint32_t r1, uint32_t atags)
{
	// Declare as unused
	(void) r0;
	(void) r1;
	(void) atags;

	uint32_t cpu_id;

	cpu_id = read_mpdir() & 0x03;

	uart_putc( "01234"[cpu_id] ); /* output is "1111" */

	if (cpu_id == 0) { /* code never executes 8^( */ }

====== qemu.sh
qemu-system-arm -m 256 -M raspi2 -no-reboot -serial stdio  -kernel myos.elf

Thanks much,
-KenD

NOT A BUG

Reviewed the code and found the problem.

asm volatile("mrc p15, 0, %[id], c0, c0, 0 @ read MIDR\n\t" ...

I miscopied the code above; MIDR should have been MIPDR ( 5 )

I now get:

Linux:armv7l: ~/Downloads/RaspiTest/BareBones >>> ./qemu.sh 
0H312ello, kernel World!

Sorry about the bogus report!
-KenD

Sorry again, "MPIDR" 

Gotta learn to type!