197
|
1 #include "../../context.h"
|
195
|
2 #interface "vm.h"
|
|
3
|
|
4 // ----
|
|
5 // typedef struct vm_impl<Impl, Isa> impl vm{
|
200
|
6 // uint i;
|
195
|
7 // pte_t *pte;
|
|
8 // unsigned int sz;
|
|
9 //
|
200
|
10 // __code loaduvm_ptesize_check(Type* vm_impl, __code next(...));
|
|
11 // __code loaduvm_loop(Type* vm_impl, uint i, pte_t *pte, unsigned int sz, __code next(...));
|
|
12 // __code next(...);
|
195
|
13 //
|
|
14 //
|
|
15 // } vm_impl;
|
|
16 // ----
|
|
17
|
|
18 vm* createvm_impl(struct Context* cbc_context) {
|
|
19 struct vm* vm = new vm();
|
|
20 struct vm_impl* vm_impl = new vm_impl();
|
|
21 vm->vm = (union Data*)vm_impl;
|
200
|
22 vm_impl->i = 0;
|
195
|
23 vm_impl->sz = 0;
|
|
24 vm->init_vmm = C_init_vmmvm_impl;
|
|
25 vm->kpt_freerange = C_kpt_freerangevm_impl;
|
|
26 vm->kpt_alloc = C_kpt_allocvm_impl;
|
|
27 vm->switchuvm = C_switchuvmvm_impl;
|
|
28 vm->init_inituvm = C_init_inituvmvm_impl;
|
|
29 vm->loaduvm = C_loaduvmvm_impl;
|
|
30 vm->allocuvm = C_allocuvmvm_impl;
|
|
31 vm->clearpteu = C_clearpteuvm_impl;
|
|
32 vm->copyuvm = C_copyuvmvm_impl;
|
|
33 vm->uva2ka = C_uva2kavm_impl;
|
|
34 vm->copyout = C_copyoutvm_impl;
|
|
35 vm->pagind_int = C_pagind_intvm_impl;
|
|
36 return vm;
|
|
37 }
|
|
38
|
|
39
|
|
40
|
|
41 __code init_vmmvm_impl(struct vm_impl* vm, __code next(...)) {
|
|
42
|
|
43 goto next(...);
|
|
44 }
|
|
45
|
200
|
46 __code kpt_freerangevm_impl(struct vm_impl* vm, uint low, uint hi, __code next(...)) {
|
195
|
47
|
|
48 goto next(...);
|
|
49 }
|
|
50
|
|
51 __code kpt_allocvm_impl(struct vm_impl* vm ,__code next(...)) {
|
|
52
|
|
53 goto next(...);
|
|
54 }
|
|
55
|
200
|
56 typedef struct proc proc;
|
|
57 __code switchuvmvm_impl(struct vm_impl* vm ,struct proc* p, __code next(...)) { //:skip
|
195
|
58
|
|
59 goto next(...);
|
|
60 }
|
|
61
|
200
|
62 __code init_inituvmvm_impl(struct vm_impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)) { //:skip
|
195
|
63
|
|
64 goto next(...);
|
|
65 }
|
|
66
|
200
|
67 __code loaduvmvm_impl(struct vm_impl* vm,pde_t* pgdir, char* addr, struct inode* ip, uint offset, uint sz, __code next(...)) {
|
195
|
68
|
|
69 goto next(...);
|
|
70 }
|
|
71
|
200
|
72 __code allocuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint oldsz, uint newsz, __code next(...)) {
|
195
|
73
|
|
74 goto next(...);
|
|
75 }
|
|
76
|
|
77 __code clearpteuvm_impl(struct vm_impl* vm, pde_t* pgdir, char* uva, __code next(...)) {
|
|
78
|
|
79 goto next(...);
|
|
80 }
|
|
81
|
200
|
82 __code copyuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint sz, __code next(...)) {
|
195
|
83
|
|
84 goto next(...);
|
|
85 }
|
|
86
|
|
87 __code uva2kavm_impl(struct vm_impl* vm, pde_t* pgdir, char* uva, __code next(...)) {
|
|
88
|
|
89 goto next(...);
|
|
90 }
|
|
91
|
200
|
92 __code copyoutvm_impl(struct vm_impl* vm, pde_t* pgdir, uint va, void* pp, uint len, __code next(...)) {
|
195
|
93
|
|
94 goto next(...);
|
|
95 }
|
|
96
|
200
|
97 __code pagind_intvm_impl(struct vm_impl* vm, uint phy_low, uint phy_hi, __code next(...)) {
|
195
|
98
|
|
99 goto next(...);
|
|
100 }
|
|
101
|
200
|
102
|