トップ «前の日記(2011-12-17) 最新 次の日記(2011-12-19)» 編集

ヨタの日々

2001|08|09|10|11|12|
2002|01|02|03|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|03|04|05|06|07|08|09|10|11|12|
2009|01|02|03|04|05|06|07|08|09|10|11|12|
2010|01|02|03|04|05|06|07|08|09|10|11|12|
2011|01|02|03|04|05|06|07|08|09|10|11|12|
2012|01|02|03|04|05|06|07|08|09|10|11|12|
2013|01|02|03|04|05|06|07|08|09|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|04|05|06|07|08|09|10|11|12|
2016|01|02|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|05|06|07|08|09|10|11|12|
2021|01|02|03|04|05|06|07|08|09|10|11|12|
2022|01|02|03|04|05|06|07|08|09|10|11|12|
2023|01|02|03|04|05|06|07|08|12|
2024|01|02|03|04|

2011-12-18 :-)

_ 午前

0930 起床

1030 おひる。ジェノベーゼらしきもの

_ 午後

1400 KOZOS

_

2130 飯。たらのフライというか 白身魚のコーンフレークス揚げ のようなことをやろうとしたら結局普通にフライになった。

_ ルタオのクリスマスソシエール

ウェブ に見当たらない。

ろうそくが付いていたのでせっかくだから火をつけてみた。

IMG_9331

_ ,

細江慎治さんの(ブログの)言葉使いがどうも馴染みあるなあと思ってたら ohguchi と同じような言葉使いなのだった

_ [KOZOS]KOZOS 9章

いつものアライメント

--- C:/home/rin/work/OS/KOZOS/osbook_03/09/os/kozos.c	Sat Mar 20 15:02:12 2010
+++ C:/home/rin/work/OS/KOZOS/osbook/src/09/os/kozos.c	Sun Dec 18 17:11:34 2011
@@ -35,6 +35,9 @@
   } syscall;

   kz_context context; /* コンテキスト情報 */
+
+  char dummy[8];
+
 } kz_thread;

 /* スレッドのレディー・キュー */
@@ -233,10 +236,11 @@
   return old;
 }

+static void thread_intr(softvec_type_t type, unsigned long sp);
+
 /* 割込みハンドラの登録 */
 static int setintr(softvec_type_t type, kz_handler_t handler)
 {
-  static void thread_intr(softvec_type_t type, unsigned long sp);

   /*
    * 割込みを受け付けるために,ソフトウエア・割込みベクタに

手で数えるのが面倒なので kozos.c 冒頭の構造体定義をコピペして sizeof することにした。printf は kozos の lib.h にも宣言されてるのでちゃんと stdio.h のほうを使う。

#include <stdio.h>

#include "defines.h"
#include "kozos.h"
#include "intr.h"
#include "interrupt.h"
#include "syscall.h"
//#include "lib.h"

#define THREAD_NUM 6
#define PRIORITY_NUM 16
#define THREAD_NAME_SIZE 15

/* スレッド・コンテキスト */
typedef struct _kz_context {
  uint32 sp; /* スタック・ポインタ */
} kz_context;

/* タスク・コントロール・ブロック(TCB) */
typedef struct _kz_thread {
  struct _kz_thread *next;
  char name[THREAD_NAME_SIZE + 1]; /* スレッド名 */
  int priority;   /* 優先度 */
  char *stack;    /* スタック */
  uint32 flags;   /* 各種フラグ */
#define KZ_THREAD_FLAG_READY (1 << 0)

  struct { /* スレッドのスタート・アップ(thread_init())に渡すパラメータ */
    kz_func_t func; /* スレッドのメイン関数 */
    int argc;       /* スレッドのメイン関数に渡す argc */
    char **argv;    /* スレッドのメイン関数に渡す argv */
  } init;

  struct { /* システム・コール用バッファ */
    kz_syscall_type_t type;
    kz_syscall_param_t *param;
  } syscall;

  kz_context context; /* コンテキスト情報 */

  char dummy[8];

} kz_thread;


int main(int argc, char** argv)
{
  printf( "kz_thread: %d byte\n", sizeof(kz_thread));
  return 0;
}

そんだけ

% gcc -I./09/os kz_thread.c
% ./a.exe
kz_thread: 64 byte