Index: asp3_wo_tecs/trunk/kernel/kernel_check.trb
===================================================================
--- asp3_wo_tecs/trunk/kernel/kernel_check.trb	(revision 305)
+++ asp3_wo_tecs/trunk/kernel/kernel_check.trb	(revision 306)
@@ -53,5 +53,5 @@
 #   ã®è²¬ä»»ãè² ããªãï¼
 # 
-#   $Id: kernel_check.trb 588 2016-02-05 12:54:58Z ertl-hiro $
+#   $Id: kernel_check.trb 662 2016-02-27 02:33:51Z ertl-hiro $
 #  
 
@@ -79,4 +79,6 @@
     elsif startIdata.nil?
       error_exit("symbol `lma[:START_IDATA]' not found")
+    else
+      BCOPY(startIdata, startData, endData - startData)
     end
   end
@@ -87,8 +89,8 @@
 å ±ã®ãã§ãã¯é¢æ°
 #
-$tmax_tskid = PEEK(SYMBOL("_kernel_tmax_tskid"), $sizeof_ID)
-$tmax_semid = PEEK(SYMBOL("_kernel_tmax_semid"), $sizeof_ID)
-$tmax_flgid = PEEK(SYMBOL("_kernel_tmax_flgid"), $sizeof_ID)
-$tmax_dtqid = PEEK(SYMBOL("_kernel_tmax_dtqid"), $sizeof_ID)
+$tmax_tskid = $TMIN_TSKID + $cfgData[:CRE_TSK].size - 1
+$tmax_semid = $TMIN_SEMID + $cfgData[:CRE_SEM].size - 1
+$tmax_flgid = $TMIN_FLGID + $cfgData[:CRE_FLG].size - 1
+$tmax_dtqid = $TMIN_DTQID + $cfgData[:CRE_DTQ].size - 1
 
 def checkNotifyHandler(key, params, objid, exinf, nfyhdr)
@@ -122,5 +124,5 @@
       error_wrong_id("E_PAR", params1, :tmehdr, objid, "not aligned")
     end
-    if $CHECK_FUNC_NONNULL == 1 && tmehdr == 0
+    if $CHECK_FUNC_NONNULL && tmehdr == 0
       error_wrong_id("E_PAR", params1, :tmehdr, objid, "null")
     end
@@ -138,5 +140,5 @@
       error_wrong_id("E_PAR", params1, :p_var, objid, "not aligned")
     end
-    if $CHECK_INTPTR_NONNULL == 1 && p_var == 0
+    if $CHECK_INTPTR_NONNULL && p_var == 0
       error_wrong_id("E_PAR", params1, :p_var, objid, "null")
     end
@@ -194,5 +196,5 @@
       error_wrong_id("E_PAR", params1, :p_var, objid, "not aligned")
     end
-    if $CHECK_INTPTR_NONNULL == 1 && p_var == 0
+    if $CHECK_INTPTR_NONNULL && p_var == 0
       error_wrong_id("E_PAR", params1, :p_var, objid, "null")
     end
@@ -244,12 +246,13 @@
 # 
 tinib = SYMBOL("_kernel_tinib_table")
-$cfgData[:CRE_TSK].each do |key, params|
+$cfgData[:CRE_TSK].sort.each do |key, params|
+  task = PEEK(tinib + $offsetof_TINIB_task, $sizeof_TASK)
+
   # ã¿ã¹ã¯ã®å
 é ­çªå°ã®ãã§ãã¯ï¼»NGKI1033ï¼½
-  task = PEEK(tinib + $offsetof_TINIB_task, $sizeof_FP)
   if (task & ($CHECK_FUNC_ALIGN - 1)) != 0
     error_wrong_id("E_PAR", params, :task, :tskid, "not aligned")
   end
-  if $CHECK_FUNC_NONNULL == 1 && task == 0
+  if $CHECK_FUNC_NONNULL && task == 0
     error_wrong_id("E_PAR", params, :task, :tskid, "null")
   end
@@ -257,6 +260,6 @@
   # ã¿ã¹ã¯ã®ã¹ã¿ãã¯é åã®å
 é ­çªå°ã®ãã§ãã¯ï¼»NGKI1056ï¼½
-  if $USE_TSKINICTXB == 1
-    stk = GetStackTskinictxb(key, params)
+  if $USE_TSKINICTXB
+    stk = GetStackTskinictxb(key, params, tinib)
   else
     stk = PEEK(tinib + $offsetof_TINIB_stk, $sizeof_void_ptr)
@@ -265,5 +268,5 @@
     error_wrong_id("E_PAR", params, :stk, :tskid, "not aligned")
   end
-  if $CHECK_STACK_NONNULL == 1 && stk == 0
+  if $CHECK_STACK_NONNULL && stk == 0
     error_wrong_id("E_PAR", params, :stk, :tskid, "null")
   end
@@ -276,5 +279,5 @@
 # 
 mpfinib = SYMBOL("_kernel_mpfinib_table")
-$cfgData[:CRE_MPF].each do |key, params|
+$cfgData[:CRE_MPF].sort.each do |key, params|
   mpf = PEEK(mpfinib + $offsetof_MPFINIB_mpf, $sizeof_void_ptr)
 
@@ -284,5 +287,5 @@
     error_wrong_id("E_PAR", params, :mpf, :mpfid, "not aligned")
   end
-  if $CHECK_MPF_NONNULL == 1 && mpf == 0
+  if $CHECK_MPF_NONNULL && mpf == 0
     error_wrong_id("E_PAR", params, :mpf, :mpfid, "null")
   end
@@ -295,7 +298,7 @@
 # 
 cycinib = SYMBOL("_kernel_cycinib_table")
-$cfgData[:CRE_CYC].each do |key, params|
+$cfgData[:CRE_CYC].sort.each do |key, params|
   exinf = PEEK(cycinib + $offsetof_CYCINIB_exinf, $sizeof_intptr_t)
-  nfyhdr = PEEK(cycinib + $offsetof_CYCINIB_nfyhdr, $sizeof_FP)
+  nfyhdr = PEEK(cycinib + $offsetof_CYCINIB_nfyhdr, $sizeof_NFYHDR)
 
   #	éç¥æ
@@ -310,7 +313,7 @@
 # 
 alminib = SYMBOL("_kernel_alminib_table")
-$cfgData[:CRE_ALM].each do |key, params|
+$cfgData[:CRE_ALM].sort.each do |key, params|
   exinf = PEEK(alminib + $offsetof_ALMINIB_exinf, $sizeof_intptr_t)
-  nfyhdr = PEEK(alminib + $offsetof_ALMINIB_nfyhdr, $sizeof_FP)
+  nfyhdr = PEEK(alminib + $offsetof_ALMINIB_nfyhdr, $sizeof_NFYHDR)
 
   #	éç¥æ
@@ -324,12 +327,15 @@
 #  éã¿ã¹ã¯ã³ã³ãã­ã¹ãç¨ã®ã¹ã¿ãã¯é åã«é¢ãããã§ãã¯
 # 
-istk = PEEK(SYMBOL("_kernel_istk"), $sizeof_void_ptr)
-
-# éã¿ã¹ã¯ã³ã³ãã­ã¹ãç¨ã®ã¹ã¿ãã¯é åã®å
+istkAddr = SYMBOL("_kernel_istk")
+if !istkAddr.nil?
+  istk = PEEK(istkAddr, $sizeof_void_ptr)
+
+  # éã¿ã¹ã¯ã³ã³ãã­ã¹ãç¨ã®ã¹ã¿ãã¯é åã®å
 é ­çªå°ã®ãã§ãã¯ï¼»NGKI3222ï¼½
-if (istk & ($CHECK_STACK_ALIGN - 1)) != 0
-  error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "not aligned")
-end
-if $CHECK_STACK_NONNULL == 1 && istk == 0
-  error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "null")
-end
+  if (istk & ($CHECK_STACK_ALIGN - 1)) != 0
+    error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "not aligned")
+  end
+  if $CHECK_STACK_NONNULL && istk == 0
+    error_wrong("E_PAR", $cfgData[:DEF_ICS][1], :istk, "null")
+  end
+end
