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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
diff -r 173753022721 src/console.cbc
--- a/src/console.cbc Thu Feb 06 20:31:43 2020 +0900
+++ b/src/console.cbc Thu Feb 06 21:00:58 2020 +0900
@@ -11,7 +11,7 @@
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
-
+//data_gear "ConsoleArg.h"
#define __ncode __code
@@ -20,7 +20,6 @@
static void consputc (int);
-int panicked = 0;
struct {
struct spinlock lock;
@@ -133,7 +132,8 @@
cprintf("cpu%d: panic: ", cpu->id);
show_callstk(s);
- panicked = 1; // freeze other CPU
+
+ Gearef(&proc->cbc_context,ConsoleArg)->panicked = 1; // freeze other CPU
while (1)
;
@@ -148,7 +148,7 @@
cprintf("cpu%d: panic: ", cpu->id);
show_callstk(s);
- panicked = 1; // freeze other CPU
+ Gearef(&proc->cbc_context,ConsoleArg)->panicked = 1; // freeze other CPU
while (1)
;
@@ -160,7 +160,7 @@
void consputc (int c)
{
- if (panicked) {
+ if (Gearef(&proc->cbc_context, ConsoleArg)->panicked) {
cli();
while (1)
;
diff -r 173753022721 src/impl/KernelError.cbc
--- a/src/impl/KernelError.cbc Thu Feb 06 20:31:43 2020 +0900
+++ b/src/impl/KernelError.cbc Thu Feb 06 21:00:58 2020 +0900
@@ -28,10 +28,9 @@
goto next(...);
}
-__code panicKernelError(struct KernelError* err, char* msg) {
+__code panicKernelError(struct KernelError* err, char* msg, struct ConsoleArg* ca) {
extern struct cpu* cpu;
extern struct { struct spinlock lock; int locking; } cons;
- extern int panicked;
cli();
cons.locking = 0;
@@ -39,7 +38,7 @@
cprintf("cpu%d: panic: ", cpu->id);
show_callstk(msg);
- panicked = 1; // freeze other CPU
+ ca->panicked = 1; // freeze other CPU
goto infinity_loopKernelError(err, err->inifinity_loop);
}
diff -r 173753022721 src/interface/Err.h
--- a/src/interface/Err.h Thu Feb 06 20:31:43 2020 +0900
+++ b/src/interface/Err.h Thu Feb 06 21:00:58 2020 +0900
@@ -1,5 +1,5 @@
typedef struct Err <Type, Impl> {
__code error(Impl* err, int err_code, __code next(...));
- __code panic(Impl* err, char* msg);
+ __code panic(Impl* err, char* msg, struct ConsoleArg* ca);
__code next(...);
} Err;
diff -r 173753022721 src/proc.cbc
--- a/src/proc.cbc Thu Feb 06 20:31:43 2020 +0900
+++ b/src/proc.cbc Thu Feb 06 21:00:58 2020 +0900
@@ -7,6 +7,7 @@
#include "proc.h"
#include "spinlock.h"
#interface "vm.h"
+#interface "ConsoleArg.h"
#define __ncode __code
@@ -138,6 +139,11 @@
goto meta(cbc_context, vm->init_inituvm);
}
+void create_console_arg(struct Context* cbc_context) {
+ struct ConsoleArg* ca = new ConsoleArg();
+ ca->panicked = 0;
+}
+
void userinit(void)
{
struct proc* p;
@@ -145,6 +151,7 @@
p = allocproc();
initContext(&p->cbc_context);
+ create_console_arg(&p->cbc_context);
initproc = p;
@@ -228,6 +235,7 @@
return -1;
}
initContext(&np->cbc_context);
+ create_console_arg(&np->cbc_context);
// Copy process state from p.
if((np->pgdir = copyuvm(proc->pgdir, proc->sz)) == 0){
|