From: j8takagi Date: Thu, 7 Apr 2011 06:02:54 +0000 (+0900) Subject: 入出力時のエラー条件を変更 X-Git-Tag: v0.1p35~2 X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?p=YACASL2.git;a=commitdiff_plain;h=00272c954ced5a20c2ea9452ac3d9b4a67dc01c1 入出力時のエラー条件を変更 入出力領域がメモリ容量を越えた場合にエラーとしていたのを、 プログラム領域を越えた場合にエラーとするよう変更 --- diff --git a/include/struct.h b/include/struct.h index 6a5a0e4..88ecda9 100644 --- a/include/struct.h +++ b/include/struct.h @@ -91,7 +91,7 @@ typedef struct { char *name; /**<命令名 */ CMDTYPE type; /**<命令タイプ */ WORD code; /**<命令コード */ - const void (*ptr); /**<命令の関数ポインタ */ + const void (*ptr); /**<命令の関数ポインタ */ } CMD; /** diff --git a/src/exec.c b/src/exec.c index 61faee3..3fb2771 100644 --- a/src/exec.c +++ b/src/exec.c @@ -99,7 +99,7 @@ void svcin() --i; break; } - if(sys->cpu->gr[1] + i >= sys->memsize - 1) { + if(sys->cpu->gr[1] + i > execptr->end) { setcerr(208, NULL); /* SVC input - memory overflow */ break; } @@ -118,7 +118,7 @@ void svcout() WORD w; for(i = 0; i < sys->memory[sys->cpu->gr[2]]; i++) { - if(sys->cpu->gr[1] + i >= sys->memsize - 1) { + if(sys->cpu->gr[1] + i > execptr->end) { setcerr(209, NULL); /* SVC output - memory overflow */ return; } diff --git a/test/system/casl2/err_209/0.txt b/test/system/casl2/err_209/0.txt index 4a8bc44..6f1974a 100644 --- a/test/system/casl2/err_209/0.txt +++ b/test/system/casl2/err_209/0.txt @@ -6,4 +6,4 @@ BUF DC ' !' LEN DC 60 END !< -........Execute error - 209: SVC output - memory overflow +..Execute error - 209: SVC output - memory overflow diff --git a/test/system/comet2/err_209/0.txt b/test/system/comet2/err_209/0.txt index 7d15bf3..f7d3df1 100644 --- a/test/system/comet2/err_209/0.txt +++ b/test/system/comet2/err_209/0.txt @@ -1,2 +1,2 @@ !< -........Execute error - 209: SVC output - memory overflow +..Execute error - 209: SVC output - memory overflow