view user/pine/note/2021/08/31.md @ 83:2fcd083f5441

backup 2021-09-01
author autobackup
date Wed, 01 Sep 2021 00:10:03 +0900
parents
children
line wrap: on
line source

# 研究目的
- アプリケーションの信頼性を保証するために、アプリケーションが動作するOSの信頼性を高める必要がある。

- 本研究室では、Continuation Based C(CbC)を用いて、信頼性と拡張性を両立するOSであるGearsOSを開発している。

- ソフトウェア開発においてエラー・バグは付き物であり、その発見が重要である。現在GearsOSにはデバッガーが未実装であるため、円滑なOS開発を行うために、GearsOSのデバッガーを作成する。

## やったこと
- 論文読みつつGearsOSのコードリーディング

- DataGearの表示

## 作業ログ
DataGearを表示するCodeGearとして、printDataGearを作成。

とりあえずDataGearの中でもPhilsだけを出力してみた。

```
__code printDataGear() {
    printf("context address: %p\n", context);
    printf("DataGear address in context: %p\n", context->data);
    printf("print Phils in DataGear\n");
    printf("phils = %p\n", context->data[1]->Phils.phils);
    printf("putdown_lfork = %i\n", context->data[1]->Phils.putdown_lfork);
    printf("putdown_rfork = %i\n", context->data[1]->Phils.putdown_rfork);
    printf("thinking = %i\n", context->data[1]->Phils.thinking);
    printf("pickup_rfork = %i\n", context->data[1]->Phils.pickup_rfork);
    printf("pickup_lfork = %i\n", context->data[1]->Phils.pickup_lfork);
    printf("eating = %i\n", context->data[1]->Phils.eating);
    printf("next CodeGear = %i\n", context->data[1]->Phils.next);
    printf("-------------------------------\n\n");
    goto meta(context, context->next);
}
```

このprintDataGearをMCWorker.cbc内のmcMetaの実行後の遷移先として指定して実行してみた。

mcMetaの最後の部分
```
    // printf("depth %d count %d\n", depth, count++);
    mcWorker->parent = out;
    mcWorker->count++;
    mcWorker->mcContext = context;
    // goto meta(context, context->next);
    goto printDataGear(context);
}
```

出力結果が以下のような感じ
```
4: phickup_rfork
ffffffff ffffffff 02000000 03000000 ffffffff 47000000 47000000 01000000 01000000 01000000  flag 0 0x7fb726c108d0 -> 0x7fb726c0fde0 hash ea6a009c iter 5
context address: 0x7fb9b0504120
DataGear address in context: 0x7fb5e6c00000
print Phils in DataGear
phils = 0x0
putdown_lfork = 0
putdown_rfork = 0
thinking = 0
pickup_rfork = 0
pickup_lfork = 0
eating = 0
next CodeGear = 0
```


## 疑問点

- 現状、DataGearをprintfするために型などを直接書いて出力している。
    - それだとDataGearが多い場合や、他の例題に対応できないと考えてる。
    - DataGearを定義してるcontext.hから参照できたりする?
- 出力結果は出たが、0x0だったり、0が出てしまうのでちゃんとDataGearを出力できてなさそう。


## やること
- 論文読み&コードリーディング
- DataGearの表示機能の作成
- CodeGearの表示機能の作成

## その他
- 夏休み前半遊んでいて全然研究してなかった。。。
    - やっと本腰を入れ始めた