Browse Source

+ implemented system_exit for WASI

git-svn-id: branches/wasm@48302 -
nickysn 4 years ago
parent
commit
204b0a777d
1 changed files with 4 additions and 3 deletions
  1. 4 3
      rtl/wasi/system.pp

+ 4 - 3
rtl/wasi/system.pp

@@ -56,10 +56,13 @@ type
     buf_len: __wasi_size_t;
     buf_len: __wasi_size_t;
   end;
   end;
 
 
+  __wasi_exitcode_t = UInt32;
+
 function fd_write(fd: __wasi_fd_t;
 function fd_write(fd: __wasi_fd_t;
                   iovs: P__wasi_ciovec_t;
                   iovs: P__wasi_ciovec_t;
                   iovs_len: size_t;
                   iovs_len: size_t;
                   nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
                   nwritten: P__wasi_size_t): __wasi_errno_t; external 'wasi_snapshot_preview1';
+procedure proc_exit(rval: __wasi_exitcode_t); noreturn; external 'wasi_snapshot_preview1';
 
 
 {$I system.inc}
 {$I system.inc}
 
 
@@ -73,9 +76,7 @@ End;
 
 
 procedure System_exit;
 procedure System_exit;
 begin
 begin
-  DebugWriteLn('System_exit');
-  repeat
-  until false;
+  proc_exit(ExitCode);
 End;
 End;
 
 
 Function ParamCount: Longint;
 Function ParamCount: Longint;