changeset 207:8a55878f6a25

loaduvm
author tobaru
date Thu, 23 Jan 2020 17:32:48 +0900
parents 247aa9ee931c
children a0620ca23f19
files src/gearsTools/lib/Gears/Context.pm src/impl/vm_impl.h src/impl/vm_impl_private.cbc
diffstat 3 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/lib/Gears/Context.pm	Thu Jan 23 17:12:02 2020 +0900
+++ b/src/gearsTools/lib/Gears/Context.pm	Thu Jan 23 17:32:48 2020 +0900
@@ -240,7 +240,7 @@
 
   my $header_paths = Gears::Util->find_headers_path($search_bash_path);
   map {
-    if (/(\w+)\.(?:h|dg)/) {
+    if (/(\w+)\.(?:h|dg)$/) {
         my $header_file = $1;
         if (exists $res{$header_file}) {
           if ($res{$header_file} =~ /^\d+$/){
--- a/src/impl/vm_impl.h	Thu Jan 23 17:12:02 2020 +0900
+++ b/src/impl/vm_impl.h	Thu Jan 23 17:32:48 2020 +0900
@@ -8,6 +8,7 @@
     struct inode* ip;
     uint offset;
     uint pa;
+    uint n;
 
     __code loaduvm_ptesize_check(Type* vm_impl, __code next(...));
     __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, uint sz, __code next(...));
--- a/src/impl/vm_impl_private.cbc	Thu Jan 23 17:12:02 2020 +0900
+++ b/src/impl/vm_impl_private.cbc	Thu Jan 23 17:32:48 2020 +0900
@@ -62,6 +62,17 @@
 }
 
 __code loaduvm_check_PTE_SZ(struct vm_impl* vm_impl, __code next(...)) {
+    if (vm_impl->sz - vm_impl->i < PTE_SZ) {
+        vm_impl->n = vm_impl->sz - vm_impl->i;
+    } else {
+        vm_impl->n = PTE_SZ;
+    }
+
+    if (readi(vm_impl->ip, p2v(vm_impl->pa), vm_impl->offset + vm_impl->i, vm_impl->n) != vm_impl->n) {
+        // panic 
+        // return -1;
+    }
+
     goto loaduvm_exit(vm_impl, next(...));
 }