6.828: Operating System Engineering (93)

とりあえず進めます。次は segment_alloc 手続きなんですが、問題文には

segment_alloc():
allocates and maps physical memory for an environment


とあります。あるいは env.c の記述が以下。

//
// Allocate len bytes of physical memory for environment env,
// and map it at virtual address va in the environment's address space.
// Does not zero or otherwise initialize the mapped pages in any way.
// Pages should be writable by user and kernel.
// Panic if any allocation attempt fails.
//
static void
segment_alloc(struct Env *e, void *va, size_t len)
{
	// LAB 3: Your code here.
	// (But only if you need it for load_icode.)
	//
	// Hint: It is easier to use segment_alloc if the caller can pass
	//   'va' and 'len' values that are not page-aligned.
	//   You should round va down, and round len up.
}

うーん、最初の_Allocate len bytes of physical memory for environment env,_の意味が分からん。
そもそも env.c の中に env_alloc という手続きがあったりなんかするんですが、これとどう違うのか、とか struct Env な領域は纏めて確保済みなんじゃないのか、とか色々微妙な疑問があったりします。
ん、なんとなく load_icode 手続きの方が先なカンジがするなぁ。曰く、以下らしいですが

load_icode():
you will need to parse an ELF binary image, much like the boot loader already does, and load its contents into the user address space of a new environment.


なるほど、ちょっと ELF 云々な復習が必要なカンジですね。

続き

帰宅後、KOZOS 本とか見つつリハビリを。
てか、KOZOS は complete できてないのでこの冬の休みで済ませておく必要がある、ってかリハビリ含めで最初からリトライしたいな。
とりあえずこの load_icode についてはコメントをヒントにしつつ、なのか。とりあえず週末はこっち方面で云々な方向にて。