# HG changeset patch # User anatofuz # Date 1576051843 -32400 # Node ID ae25a4e76377445756857b5055698481f074e311 # Parent 8e93917ce4be96585b8278bc26e850507b591e86 fix gen_context.pl diff -r 8e93917ce4be -r ae25a4e76377 src/gearsTools/lib/Gears/Context.pm --- 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;