File tree 2 files changed +25
-19
lines changed 2 files changed +25
-19
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ struct KmemT {
32
32
33
33
34
34
static mut kmem : KmemT = KmemT { lock : DUMMY_LOCK , use_lock : 0 } ;
35
+ static mut end : Address = 0 ;
35
36
36
37
pub fn kinit1 ( vstart : Address , vend : Address ) {
37
38
unsafe {
@@ -50,6 +51,10 @@ fn free_range(vstart: Address, vend: Address) {
50
51
// asm!("mov $0 , %rbx" : /* no outputs */ : "r"(address) : "eax");
51
52
//}
52
53
54
+ unsafe {
55
+ end = vstart;
56
+ }
57
+
53
58
loop {
54
59
kfree ( address) ;
55
60
address = address + PG_SIZE ;
@@ -59,25 +64,25 @@ fn free_range(vstart: Address, vend: Address) {
59
64
}
60
65
}
61
66
62
- fn kfree ( a : Address ) {
63
- /*
64
- struct run *r;
65
-
66
- if((uintp)v % PGSIZE || v < end || v2p(v) >= PHYSTOP)
67
- panic("kfree");
68
-
69
- // Fill with junk to catch dangling refs.
70
- memset(v, 1, PGSIZE);
71
-
72
- if(kmem.use_lock)
73
- acquire(&kmem.lock);
74
- r = (struct run*)v;
75
- r->next = kmem.freelist;
76
- kmem.freelist = r;
77
- if(kmem.use_lock)
78
- release(&kmem.lock);
67
+ fn kfree ( v : Address ) {
79
68
69
+ //struct run *r;
80
70
81
-
82
- */
71
+ // if(v % PG_SIZE || v < end || v2p(v) >= PHYSTOP)
72
+ // panic("kfree");
73
+ //
74
+ // // Fill with junk to catch dangling refs.
75
+ // memset(v, 1, PGSIZE);
76
+ //
77
+ // if(kmem.use_lock)
78
+ // acquire(&kmem.lock);
79
+ // r = (struct run*)v;
80
+ // r->next = kmem.freelist;
81
+ // kmem.freelist = r;
82
+ // if(kmem.use_lock)
83
+ // release(&kmem.lock);
84
+ //
85
+ //
86
+ //
87
+ // */
83
88
}
Original file line number Diff line number Diff line change 23
23
use super :: mmu:: Address ;
24
24
25
25
pub const KERBASE : Address = 0xFFFFFFFF80000000 ;
26
+ pub const PHYSTOP : Address = 0xE000000 ;
26
27
27
28
//TODO - in C this is a macro - need to figure out the right thing in RUST
28
29
pub fn P2V ( address : Address ) -> Address {
You can’t perform that action at this time.
0 commit comments