changeset 200:1301727600cc

success build
author anatofuz
date Wed, 22 Jan 2020 21:56:18 +0900
parents 429f0c3cc097
children b73c5bd61c37 ee6063379aad
files src/CMakeLists.txt src/impl/vm_impl.cbc src/impl/vm_impl.h src/impl/vm_impl_private.cbc src/interface/vm.h
diffstat 5 files changed, 53 insertions(+), 59 deletions(-) [+]
line wrap: on
line diff
--- a/src/CMakeLists.txt	Wed Jan 22 19:41:31 2020 +0900
+++ b/src/CMakeLists.txt	Wed Jan 22 21:56:18 2020 +0900
@@ -94,6 +94,8 @@
     file(COPY "${CMAKE_SOURCE_DIR}/interface/" DESTINATION ${CMAKE_KERNEL_DIR_C})
     file(GLOB XV6_HEADERS "${CMAKE_SOURCE_DIR}/*.h")
     file(COPY ${XV6_HEADERS} DESTINATION ${CMAKE_KERNEL_DIR_C})
+    file(GLOB XV6_IMPL_HEADERS "${CMAKE_SOURCE_DIR}/impl/*.h")
+    file(COPY ${XV6_IMPL_HEADERS} DESTINATION ${CMAKE_KERNEL_DIR_C})
     include_directories(${CMAKE_KERNEL_DIR_C})
     add_custom_command (
           OUTPUT    ${CMAKE_KERNEL_DIR_C}/c/${_Gears_TARGET}-context.c
@@ -126,7 +128,7 @@
   SOURCES
 	string.c arm.c asm.S bio.c buddy.c console.cbc exec.c file.cbc fs.c log.c main.c memide.c pipe.cbc proc.cbc spinlock.cbc 
 	start.c swtch.S syscall.cbc sysfile.cbc sysproc.c trap_asm.S trap.c vm.c device/picirq.c device/timer.c device/uart.c 
-  SingleLinkedStack.cbc entry.S impl/vm_impl.cbc
+  SingleLinkedStack.cbc entry.S impl/vm_impl.cbc impl/vm_impl_private.cbc
 )
 
 # sys_read_impl.cbc
--- a/src/impl/vm_impl.cbc	Wed Jan 22 19:41:31 2020 +0900
+++ b/src/impl/vm_impl.cbc	Wed Jan 22 21:56:18 2020 +0900
@@ -3,12 +3,13 @@
 
 // ----
 // typedef struct vm_impl<Impl, Isa> impl vm{
-//     unsigned int i;
+//     uint i;
 //     pte_t *pte;
 //     unsigned int sz;
 //  
-//     __code loaduvm_ptesize_check(Impl* vm_impl, __code next(...));
-//     __code loaduvm_loop(Impl* vm_impl, unsigned int i, pte_t *pte, unsigned int sz, __code next(...));
+//     __code loaduvm_ptesize_check(Type* vm_impl, __code next(...));
+//     __code loaduvm_loop(Type* vm_impl, uint i, pte_t *pte, unsigned int sz, __code next(...));
+//     __code next(...);
 //  
 // 
 // } vm_impl;
@@ -18,27 +19,8 @@
     struct vm* vm  = new vm();
     struct vm_impl* vm_impl = new vm_impl();
     vm->vm = (union Data*)vm_impl;
-    vm_impl->i = 0;
+    vm_impl->i  = 0;
     vm_impl->sz = 0;
-    vm->low = 0;
-    vm->hi = 0;
-    vm->p = NULL;
-    vm->pgdir = NULL;
-    vm->init = NULL;
-    vm->sz = 0;
-    vm->addr = NULL;
-    vm->ip = NULL;
-    vm->offset = 0;
-    vm->oldsz = 0;
-    vm->newsz = 0;
-    vm->uva = NULL;
-    vm->va = 0;
-    vm->p = NULL;
-    vm->len = 0;
-    vm->phy_low = 0;
-    vm->phy_hi = 0;
-    vm_impl->loaduvm_ptesize_check = C_loaduvm_ptesize_checkvm_impl;
-    vm_impl->loaduvm_loop = C_loaduvm_loopvm_impl;
     vm->init_vmm = C_init_vmmvm_impl;
     vm->kpt_freerange = C_kpt_freerangevm_impl;
     vm->kpt_alloc = C_kpt_allocvm_impl;
@@ -53,22 +35,15 @@
     vm->pagind_int = C_pagind_intvm_impl;
     return vm;
 }
-__code loaduvm_ptesize_checkvm_impl(struct vm_impl* vm, __code next(...)) {
-
-    goto next(...);
-}
 
-__code loaduvm_loopvm_impl(struct vm_impl* vm, unsigned int i, pte_t *pte, unsigned int sz, __code next(...)) {
 
-    goto next(...);
-}
 
 __code init_vmmvm_impl(struct vm_impl* vm, __code next(...)) {
 
     goto next(...);
 }
 
-__code kpt_freerangevm_impl(struct vm_impl* vm, unsigned int low, unsigned int hi, __code next(...)) {
+__code kpt_freerangevm_impl(struct vm_impl* vm, uint low, uint hi, __code next(...)) {
 
     goto next(...);
 }
@@ -78,22 +53,23 @@
     goto next(...);
 }
 
-__code switchuvmvm_impl(struct vm_impl* vm ,struct proc* p, __code next(...)) {//:skip
+typedef struct proc proc;
+__code switchuvmvm_impl(struct vm_impl* vm ,struct proc* p, __code next(...)) { //:skip
 
     goto next(...);
 }
 
-__code init_inituvmvm_impl(struct vm_impl* vm, pde_t* pgdir, char* init, unsigned int sz, __code next(...)) {//:skip
+__code init_inituvmvm_impl(struct vm_impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)) { //:skip
 
     goto next(...);
 }
 
-__code loaduvmvm_impl(struct vm_impl* vm,pde_t* pgdir, char* addr, struct inode* ip, unsigned int offset, unsigned int sz,  __code next(...)) {
+__code loaduvmvm_impl(struct vm_impl* vm,pde_t* pgdir, char* addr, struct inode* ip, uint offset, uint sz,  __code next(...)) {
 
     goto next(...);
 }
 
-__code allocuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, unsigned int oldsz, unsigned int newsz, __code next(...)) {
+__code allocuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint oldsz, uint newsz, __code next(...)) {
 
     goto next(...);
 }
@@ -103,7 +79,7 @@
     goto next(...);
 }
 
-__code copyuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, unsigned int sz, __code next(...)) {
+__code copyuvmvm_impl(struct vm_impl* vm, pde_t* pgdir, uint sz, __code next(...)) {
 
     goto next(...);
 }
@@ -113,13 +89,14 @@
     goto next(...);
 }
 
-__code copyoutvm_impl(struct vm_impl* vm, pde_t* pgdir, unsigned int va, void* p, unsigned int len, __code next(...)) {
+__code copyoutvm_impl(struct vm_impl* vm, pde_t* pgdir, uint va, void* pp, uint len, __code next(...)) {
 
     goto next(...);
 }
 
-__code pagind_intvm_impl(struct vm_impl* vm, unsigned int phy_low, unsigned int phy_hi, __code next(...)) {
+__code pagind_intvm_impl(struct vm_impl* vm, uint phy_low, uint phy_hi, __code next(...)) {
 
     goto next(...);
 }
 
+
--- a/src/impl/vm_impl.h	Wed Jan 22 19:41:31 2020 +0900
+++ b/src/impl/vm_impl.h	Wed Jan 22 21:56:18 2020 +0900
@@ -1,10 +1,11 @@
 typedef struct vm_impl<Impl, Isa> impl vm{
-    unsigned int i;
-    pte_t *pte;
+    uint i;
+    pte_t* pte;
     unsigned int sz;
  
     __code loaduvm_ptesize_check(Type* vm_impl, __code next(...));
-    __code loaduvm_loop(Type* vm_impl, unsigned int i, pte_t *pte, unsigned int sz, __code next(...));
+    __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, unsigned int sz, __code next(...));
+    __code next(...);
  
 
 } vm_impl;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/impl/vm_impl_private.cbc	Wed Jan 22 21:56:18 2020 +0900
@@ -0,0 +1,14 @@
+#include "../../context.h"
+#interface "vm_impl.h"
+#define __ncode
+
+__ncode loaduvm_ptesize_checkvm_impl(struct vm_impl* vm, enum Code next) {
+
+    // goto meta();
+}
+
+__ncode loaduvm_loopvm_impl(struct vm_impl* vm, uint* i, pte_t* pte, uint sz, enum Code next) {
+
+    // goto meta();
+}
+
--- a/src/interface/vm.h	Wed Jan 22 19:41:31 2020 +0900
+++ b/src/interface/vm.h	Wed Jan 22 21:56:18 2020 +0900
@@ -1,33 +1,33 @@
 typedef struct vm<Type,Impl> {
     union Data* vm;
-    unsigned int low;
-    unsigned int hi;
+    uint low;
+    uint hi;
     struct proc* p;
     pde_t* pgdir;
     char* init;
-    unsigned int sz;
+    uint sz;
     char* addr;
     struct inode* ip;
-    unsigned int offset;
-    unsigned int oldsz;
-    unsigned int newsz;
+    uint offset;
+    uint oldsz;
+    uint newsz;
     char* uva;
-    unsigned int va;
+    uint va;
     void* pp;
-    unsigned int len;
-    unsigned int phy_low;
-    unsigned int phy_hi;
+    uint len;
+    uint phy_low;
+    uint phy_hi;
     __code init_vmm(Impl* vm, __code next(...));
-    __code kpt_freerange(Impl* vm, unsigned int low, unsigned int hi, __code next(...));
+    __code kpt_freerange(Impl* vm, uint low, uint hi, __code next(...));
     __code kpt_alloc(Impl* vm ,__code next(...));
     __code switchuvm(Impl* vm ,struct proc* p, __code next(...));
-    __code init_inituvm(Impl* vm, pde_t* pgdir, char* init, unsigned int sz, __code next(...));
-    __code loaduvm(Impl* vm,pde_t* pgdir, char* addr, struct inode* ip, unsigned int offset, unsigned int sz,  __code next(...));
-    __code allocuvm(Impl* vm, pde_t* pgdir, unsigned int oldsz, unsigned int newsz, __code next(...));
+    __code init_inituvm(Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...));
+    __code loaduvm(Impl* vm,pde_t* pgdir, char* addr, struct inode* ip, uint offset, uint sz,  __code next(...));
+    __code allocuvm(Impl* vm, pde_t* pgdir, uint oldsz, uint newsz, __code next(...));
     __code clearpteu(Impl* vm, pde_t* pgdir, char* uva,  __code next(...));
-    __code copyuvm(Impl* vm, pde_t* pgdir, unsigned int sz, __code next(...));
+    __code copyuvm(Impl* vm, pde_t* pgdir, uint sz, __code next(...));
     __code uva2ka(Impl* vm, pde_t* pgdir, char* uva, __code next(...));
-    __code copyout(Impl* vm, pde_t* pgdir, unsigned int va, void* pp, unsigned int len, __code next(...));
-    __code pagind_int(Impl* vm, unsigned int phy_low, unsigned int phy_hi, __code next(...));
+    __code copyout(Impl* vm, pde_t* pgdir, uint va, void* pp, uint len, __code next(...));
+    __code pagind_int(Impl* vm, uint phy_low, uint phy_hi, __code next(...));
     __code next(...);
 } vm;