Mercurial > hg > Members > tobaru > CbC_xv6
changeset 133:ae25a4e76377
fix gen_context.pl
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 11 Dec 2019 17:10:43 +0900 |
parents | 8e93917ce4be |
children | 2a0de2f8596e |
files | src/gearsTools/lib/Gears/Context.pm |
diffstat | 1 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gearsTools/lib/Gears/Context.pm Thu Dec 05 10:59:27 2019 +0900 +++ b/src/gearsTools/lib/Gears/Context.pm Wed Dec 11 17:10:43 2019 +0900 @@ -166,6 +166,18 @@ sub tree2data_struct_str { my ($self, $dg_str) = @_; my $data_struct_str = ""; + + #もとのxv6に登録されているものはcontext.hには定義を書かない + my $alread_defined_str = _already_defined_struct(); + for my $str (sort keys %$dg_str) { + if (defined $alread_defined_str->{$str}) { + my $str_name = $alread_defined_str->{$str}; + $data_struct_str .= "struct $str_name $str_name;\n"; + delete $dg_str->{$str_name}; + } + } + + #定義されてないものはcontext.hに書くフォーマットに合わせておく for my $interface (sort keys %$dg_str) { $data_struct_str .= Gears::Util->h2context_str($dg_str->{$interface}->{elem}); next unless ($dg_str->{$interface}->{impl}); @@ -221,4 +233,31 @@ return \%res; } +sub _already_defined_struct { + my @struct_list = qw/ +__jmp_buf_tag +buf +cbc_devsw +context +cpu +devsw +dinode +dirent +elfhdr +file +inode +pipe +proc +proghdr +spinlock +stat +superblock +trapframe +/; + + my %def_hash; + map { $def_hash{$_} = $_} @struct_list; + return \%def_hash; +} + 1;