# HG changeset patch # User anatofuz # Date 1580785059 -32400 # Node ID 63a65e3a534073fb385d67623e08e205ee609750 # Parent 7e4e7f86497045ddbdfbc3cbf59a6523d3153d20 tweak_regex... diff -r 7e4e7f864970 -r 63a65e3a5340 src/gearsTools/generate_stub.pl --- a/src/gearsTools/generate_stub.pl Tue Feb 04 11:35:37 2020 +0900 +++ b/src/gearsTools/generate_stub.pl Tue Feb 04 11:57:39 2020 +0900 @@ -141,7 +141,7 @@ } if (/__code (\w+)/) { my $args = $'; - while ($args =~ /(struct|union|const)?\s*([\w\[\]_]+)\*?\s*(\w+),?/g) { + while ($args =~ /\s*(struct|union|const)?\s*([\w\[\]_]+)\*?\s*(\w+),?/g) { #$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)); my $const_type = $1; my $ttype = $2; diff -r 7e4e7f864970 -r 63a65e3a5340 src/gearsTools/lib/Gears/Util.pm --- a/src/gearsTools/lib/Gears/Util.pm Tue Feb 04 11:35:37 2020 +0900 +++ b/src/gearsTools/lib/Gears/Util.pm Tue Feb 04 11:57:39 2020 +0900 @@ -3,7 +3,6 @@ use warnings; use Carp qw/croak/; use File::Find; -use List::Util qw/uniq/; sub parse { my ($class, $file_name) = @_; @@ -58,7 +57,7 @@ push(@tmp_args,"enum Code $1;\n"); my $args = $'; #$args eq (Impl* vm, pde_t* pgdir, char* init, uint sz, __code next(...)); - while ($args =~ /(struct|union|const)?\s*([\w*\[\]_]+)\s*(\w+),?/g) { + while ($args =~ /\s*(struct|union|const)?\s*([\w*\[\]_]+)\s*(\w+),?/g) { my $const_type = $1; my $type = $2; my $vname = $3; @@ -74,10 +73,15 @@ push(@tmp_args,$line); } - push(@{$ir->{content}}, uniq(@tmp_args)); + push(@{$ir->{content}}, _uniq(@tmp_args)); return $ir; } +sub _uniq { + my %seen; + return grep { !$seen{$_}++ } @_; +} + sub parse_with_rewrite { my ($class, $file) = @_; my $ir = _parse_base($file); diff -r 7e4e7f864970 -r 63a65e3a5340 src/impl/vm_impl.h --- a/src/impl/vm_impl.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/impl/vm_impl.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,33 +1,4 @@ typedef struct vm_impl impl vm{ - union Data* vm_impl; - uint i; - pte_t* pte; - uint sz; - pde_t* pgdir; - char* addr; - struct inode* ip; - uint offset; - uint pa; - uint n; - uint oldsz; - uint newsz; - uint a; - int ret; - char* mem; - char* uva; - pde_t* d; - uint ap; - uint phy_low; - uint phy_hi; - uint va; - void* pp; - uint len; - char* buf; - char* pa0; - uint va0; - proc_struct* p; - char* init; - __code kpt_alloc_check_impl(Type* vm_impl, __code next(...)); __code loaduvm_ptesize_check(Type* vm_impl, __code next(int ret, ...)); __code loaduvm_loop(Type* vm_impl, uint i, pte_t* pte, uint sz, __code next(int ret, ...)); diff -r 7e4e7f864970 -r 63a65e3a5340 src/interface/TaskManager.h --- a/src/interface/TaskManager.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/interface/TaskManager.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,7 +1,4 @@ typedef struct TaskManager{ - union Data* taskManager; - struct Context* task; - struct Element* taskList; __code spawn(Impl* taskManager, struct Context* task, __code next(...)); __code spawnTasks(Impl* taskManagerImpl, struct Element* taskList, __code next1(...)); __code setWaitTask(Impl* taskManagerImpl, struct Context* task, __code next(...)); diff -r 7e4e7f864970 -r 63a65e3a5340 src/interface/vm.h --- a/src/interface/vm.h Tue Feb 04 11:35:37 2020 +0900 +++ b/src/interface/vm.h Tue Feb 04 11:57:39 2020 +0900 @@ -1,22 +1,4 @@ typedef struct vm { - union Data* vm; - uint low; - uint hi; - struct proc* p; - pde_t* pgdir; - char* init; - uint sz; - char* addr; - struct inode* ip; - uint offset; - uint oldsz; - uint newsz; - char* uva; - uint va; - void* pp; - uint len; - uint phy_low; - uint phy_hi; __code init_vmm(Impl* vm, __code next(...)); __code kpt_freerange(Impl* vm, uint low, uint hi, __code next(...)); __code kpt_alloc(Impl* vm ,__code next(...));