Skip to content

Simple examples for understanding the usage of xv6 swtch

Notifications You must be signed in to change notification settings

titech-os/swtest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swtest

xv6の swtch の動作を理解するためのサンプルコード

ビルド方法

$ make

xv6の swtch.S および context 構造体をそのまま流用しているため,32ビット(i386)用のコンパイラおよびライブラリが必要です.macOS (10.13.x) 上で動作を確認しています.

例えば64ビット版Ubuntuで動作させる場合は以下のようにして必要なライブラリを導入します.

$ apt-get install multilib

さらにLinuxで動作させるためには,swtch.S を編集してラベル _swtchswtch に変更し, vallocmalloc に変更する等の措置が必要となるかも知れません.

実行方法

$ ./swtest
foo: 0
bar: 0
baz: 0
foo: 1
bar: 2
baz: 3
foo: 2
bar: 4
baz: 6
foo: 3
bar: 6
baz: 9
...
$ ./schtest
foo: 0
bar: 0
baz: 0
foo: 1
bar: 2
baz: 3
foo: 2
bar: 4
baz: 6
foo: 3
bar: 6
baz: 9
...

About

Simple examples for understanding the usage of xv6 swtch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published