Commit Graph

287 Commits

Author SHA1 Message Date
Nikolay Nikolov
bae50d80d2 * preopen fd names and current dir changed to use ansistring, as well as the
parameters and result of ConvertToFdRelativePath. This will allow easier
  implementation of ChDir.
2021-10-10 09:11:19 +03:00
Nikolay Nikolov
d45915b6ba * preopened dirs structure in the system unit modified to be a pointer to an
array of records
2021-10-06 07:44:04 +03:00
Nikolay Nikolov
e078408dcf + implemented SysUtils.GetEnvironmentVariable, GetEnvironmentVariableCount and
GetEnvironmentString for WASI
2021-10-06 06:12:58 +03:00
Nikolay Nikolov
7533496505 + implemented SysUtils.Sleep for WASI 2021-10-06 05:39:11 +03:00
Nikolay Nikolov
d134fc1ddf + implemented SysUtils.GetTickCount64 for WASI 2021-10-06 04:46:44 +03:00
Nikolay Nikolov
e19fcd2b8b + implemented GetMsCount in the DOS unit for WASI 2021-10-05 20:49:32 +03:00
Nikolay Nikolov
387c80cc57 + default exception handling in WebAssembly native exceptions mode 2021-10-05 08:02:39 +03:00
Nikolay Nikolov
c0cec218d6 + added unhandled exception handling code for the branchful exceptions mode 2021-10-05 04:06:56 +03:00
Nikolay Nikolov
a01a602140 - removed commented out code from the WASI startup code 2021-10-05 03:48:47 +03:00
Nikolay Nikolov
be90ad1672 + enabled compilation of unit heaptrc for the WASI target 2021-10-03 03:29:54 +03:00
Nikolay Nikolov
77ca8ba16d * always return error in SysUtils.FindFirst and .FindNext on the WASI platform,
in order to prevent infinite loops in tests
2021-10-03 01:08:52 +03:00
Nikolay Nikolov
c450b63f1c + enabled compilation of the fpintres unit for the WASI target and enabled tf_has_winlike_resources for the target 2021-10-02 22:43:05 +03:00
Nikolay Nikolov
02745b0b83 + implemented GetDate, GetTime and WeekDay in the WASI dos unit. They return
UTC time (I don't know how to obtain the local time zone from within WASI).
2021-10-01 06:34:52 +03:00
nickysn
f0543ad8d5 * use -1 instead of 0 for indicating empty DirFD
git-svn-id: trunk@49574 -
2021-07-01 01:48:25 +00:00
nickysn
0219b4018c + initial working implementation of FindFirst/FindNext
git-svn-id: trunk@49573 -
2021-07-01 01:34:07 +00:00
nickysn
5eac35664f + started working on DOS.FindFirst
git-svn-id: trunk@49555 -
2021-06-24 01:35:24 +00:00
nickysn
433050a2c4 * set EXEEXT to .wasm for the WASI target in fpcmake
git-svn-id: trunk@49552 -
2021-06-24 00:16:00 +00:00
nickysn
afb9c2ae94 + implemented environment variables support in the DOS unit for the WASI target
git-svn-id: trunk@49551 -
2021-06-23 23:15:15 +00:00
nickysn
c275c3c7f2 + implemented Randomize
git-svn-id: trunk@49550 -
2021-06-23 22:11:11 +00:00
nickysn
4240279a84 + always request pollfd_readwrite rights, when opening a file
git-svn-id: trunk@49549 -
2021-06-23 21:48:10 +00:00
nickysn
ca3f1d7b6d + always request FD_ADVISE rights, when opening a file
git-svn-id: trunk@49548 -
2021-06-23 21:45:52 +00:00
nickysn
5ff2af5176 + always request FD_FDSTAT_SET_FLAGS rights
git-svn-id: trunk@49547 -
2021-06-23 21:44:19 +00:00
nickysn
90eb1351dc + request FD_DATASYNC and FD_SYNC rights when a file is opened for writing
git-svn-id: trunk@49546 -
2021-06-23 21:42:49 +00:00
nickysn
67c1520928 * changed the formatting of the setting of fs_rights_base in Do_Open. No functional changes.
git-svn-id: trunk@49545 -
2021-06-23 21:41:12 +00:00
nickysn
9efcd4e554 + request fd_allocate rights when opening a file for writing
git-svn-id: trunk@49544 -
2021-06-23 21:39:10 +00:00
nickysn
3fd6704582 + request the rights to set size (truncate) and set times, when a file is opened for writing
git-svn-id: trunk@49543 -
2021-06-23 21:36:22 +00:00
nickysn
a5309a5d0c + request fd_seek and fd_tell rights when opening a file
git-svn-id: trunk@49542 -
2021-06-23 21:31:55 +00:00
nickysn
720068360e + workaround for newer wasmtime versions that don't report the fd type of
stdin/stdout/stderr. Always assume handles 0..2 are a device, so that
  standard input and output are flushed.

git-svn-id: trunk@49541 -
2021-06-23 21:22:15 +00:00
nickysn
827f543289 * fixed date calculation in WasiDateToDT
git-svn-id: trunk@49540 -
2021-06-23 21:01:30 +00:00
nickysn
c48f27225e + request the FD_FILESTAT_GET capability when opening files
git-svn-id: trunk@49539 -
2021-06-23 20:58:10 +00:00
nickysn
25a9843ea4 * also set doserror to 5 for access denied in dos.getfattr
git-svn-id: trunk@49538 -
2021-06-23 20:57:50 +00:00
nickysn
953893267b + initial WASI implementation of DOS.GetFTime. Not working yet, due to a
compiler bug, related to the import of fd_filestat_get from the wasiapi unit.

git-svn-id: trunk@49536 -
2021-06-23 20:04:03 +00:00
nickysn
ba1dcfc6a4 + also resolve absolute paths in ConvertToFdRelativePath
git-svn-id: trunk@49535 -
2021-06-23 15:44:17 +00:00
nickysn
125dbdc21c + implemented Do_Rename for the WASI target
git-svn-id: trunk@49532 -
2021-06-23 00:30:47 +00:00
nickysn
539ea53bab + implemented Do_Seek and Do_Seekend for the WASI target
git-svn-id: trunk@49531 -
2021-06-23 00:20:48 +00:00
nickysn
17fac45ddc + implemented Do_FileSize for the WASI target
git-svn-id: trunk@49530 -
2021-06-23 00:12:22 +00:00
nickysn
5718b33dd8 + implemented Do_FilePos for the WASI target
git-svn-id: trunk@49529 -
2021-06-23 00:03:44 +00:00
nickysn
5ee902800c + implemented do_truncate for the WASI target
git-svn-id: trunk@49528 -
2021-06-22 23:57:39 +00:00
nickysn
a7b3747b7b + implemented Erase() for the WASI target
git-svn-id: trunk@49527 -
2021-06-22 23:52:22 +00:00
nickysn
0af333bd0f + implemented RmDir for the WASI target
git-svn-id: trunk@49526 -
2021-06-22 23:36:30 +00:00
nickysn
144d7ed978 + implemented MkDir for the WASI target
git-svn-id: trunk@49525 -
2021-06-22 23:33:54 +00:00
nickysn
bc08af99b0 + initial implementation of resolving relative paths
git-svn-id: trunk@49524 -
2021-06-22 23:14:33 +00:00
nickysn
ba3383f7e3 + keep also the fds for the current dirs
git-svn-id: trunk@49523 -
2021-06-22 22:44:20 +00:00
nickysn
d3ce008cd3 + initial implementation of GetDir() for WASI
git-svn-id: trunk@49522 -
2021-06-22 22:35:32 +00:00
nickysn
0a384b0905 * enumerate preopened dirs on startup and store them in a list, accessible via global vars in the system unit
git-svn-id: trunk@49521 -
2021-06-22 20:51:19 +00:00
nickysn
e00dca1448 + enabled compilation of unit extpas for the WASI target
git-svn-id: trunk@49455 -
2021-06-01 22:43:01 +00:00
nickysn
e830ed6cbc + compile the unit dos (OS-specific functions are dummies for now) for the WASI target
git-svn-id: trunk@49454 -
2021-06-01 22:38:54 +00:00
nickysn
de7ebe219c + enabled compilation of unit uuchar for the WASI platform
git-svn-id: trunk@49453 -
2021-06-01 22:22:45 +00:00
nickysn
fa7444a0d8 + enabled compilation of unit classes for the WASI target
git-svn-id: trunk@49452 -
2021-06-01 22:16:16 +00:00
nickysn
c69649782a + added tthread.inc rtl include file for WASI
git-svn-id: trunk@49450 -
2021-06-01 21:58:02 +00:00
nickysn
84b3036574 + added classes unit for the WASI target (not yet enabled in the makefiles)
git-svn-id: trunk@49446 -
2021-06-01 20:32:10 +00:00
nickysn
9bebe9bcb7 + enabled compilation of unit fpwidestring for the WASI target
git-svn-id: trunk@49445 -
2021-06-01 20:19:16 +00:00
nickysn
3d56f75ba7 + enabled compilation of units unicodedata and unicodenumtable for the WASI target
* fixed the dependencies of unit character

git-svn-id: trunk@49444 -
2021-06-01 20:14:58 +00:00
nickysn
d6fc3129b3 + enabled compilation of unit character for the WASI target
git-svn-id: trunk@49443 -
2021-06-01 20:02:36 +00:00
nickysn
cf857a22ee + enabled compilation of unit cpall for the WASI target
git-svn-id: trunk@49442 -
2021-06-01 19:38:02 +00:00
nickysn
47b664ba92 + enabled compilation of unit charset for the WASI target
git-svn-id: trunk@49441 -
2021-06-01 19:34:31 +00:00
nickysn
2a688eb948 + enabled compilation of unit getopts for the WASI target
git-svn-id: trunk@49440 -
2021-06-01 19:30:23 +00:00
nickysn
a7dfbf0124 + enabled compilation of unit iso7185 for the WASI target
git-svn-id: trunk@49439 -
2021-06-01 19:25:42 +00:00
nickysn
1e34f04729 + enabled compilation of unit macpas for the WASI target
git-svn-id: trunk@49438 -
2021-06-01 19:20:40 +00:00
nickysn
d0b3a599a3 + enabled compilation of unit fgl for the WASI target
git-svn-id: trunk@49437 -
2021-06-01 19:15:41 +00:00
nickysn
08520e032a + enabled compilation of unit typinfo for the WASI target
git-svn-id: trunk@49436 -
2021-06-01 19:11:54 +00:00
nickysn
27ff471ff4 + enabled compilation of unit types for the WASI target
git-svn-id: trunk@49433 -
2021-06-01 17:14:24 +00:00
nickysn
390be44cce + enable compilation of unit rtlconsts for the WASI target
git-svn-id: trunk@49432 -
2021-06-01 17:06:14 +00:00
nickysn
45620b11c0 + enabled compilation of unit math for the WASI target
git-svn-id: trunk@49431 -
2021-06-01 16:56:55 +00:00
nickysn
87111246ca + enabled compilation of unit sortbase for the WASI target
git-svn-id: trunk@49429 -
2021-06-01 15:53:22 +00:00
nickysn
93fea6de3a + enabled compilation of unit SysUtils for the WASI target. Note that WASI
snapshot building fails, when compiler is built with -CR, because of a
  use-after-free bug in the compiler, related to generics. A fix for this bug
  is currently being worked on.

git-svn-id: trunk@49416 -
2021-05-30 20:52:21 +00:00
nickysn
711efc3e3a + started working on the SysUtils unit for the WASI platform
git-svn-id: trunk@49220 -
2021-04-17 14:39:54 +00:00
nickysn
a0e88efa6a + compile the sysconst unit for wasm32-wasi
git-svn-id: trunk@49216 -
2021-04-17 11:26:21 +00:00
Jonas Maebe
500e29e5e2 * regenerated with FreeBSD/AArch64 support
git-svn-id: trunk@49159 -
2021-04-10 08:19:40 +00:00
florian
e4cc8af8fc * Makefiles regenerated
git-svn-id: trunk@49124 -
2021-04-05 15:39:07 +00:00
nickysn
ea8f068817 * regenerated makefiles after sync with trunk
git-svn-id: branches/wasm@48951 -
2021-03-13 21:52:13 +00:00
nickysn
a74024e7d5 * synchronized with trunk
git-svn-id: branches/wasm@48654 -
2021-02-12 01:54:24 +00:00
nickysn
616db5df68 + compile the strings unit for the wasi target
git-svn-id: branches/wasm@48427 -
2021-01-25 21:17:28 +00:00
nickysn
c5b0348c2a - removed $(EXECPPAS) from WASI rtl makefile and changed tabs with spaces
git-svn-id: branches/wasm@48426 -
2021-01-25 21:06:17 +00:00
nickysn
a3f383ed95 + added unit ctypes to the WASI rtl
git-svn-id: branches/wasm@48425 -
2021-01-25 21:02:46 +00:00
nickysn
45b67bf8c8 + added unit wasiapi
git-svn-id: branches/wasm@48424 -
2021-01-25 20:54:25 +00:00
nickysn
1d9d1ab859 * regenerated makefiles
git-svn-id: branches/wasm@48369 -
2021-01-24 02:01:11 +00:00
nickysn
e7a1ef962e + partially implemented the initial enumeration of preopened dirs
git-svn-id: branches/wasm@48356 -
2021-01-23 21:14:33 +00:00
nickysn
7799cd0f80 + implemented ParamStr and ParamCount for WASI
git-svn-id: branches/wasm@48355 -
2021-01-23 17:59:23 +00:00
nickysn
cf71bf40dd + added all the WASI API procs
git-svn-id: branches/wasm@48354 -
2021-01-23 17:27:52 +00:00
nickysn
0f50c85b44 * prefixed all wasi api functions with __wasi_, similar to the C header
git-svn-id: branches/wasm@48353 -
2021-01-23 16:29:31 +00:00
nickysn
d5b8f6ac7a + added all the WASI API types and constants
git-svn-id: branches/wasm@48352 -
2021-01-23 16:21:53 +00:00
nickysn
04828b22f6 * WASI API consts, types and procs moved to separate include files
git-svn-id: branches/wasm@48351 -
2021-01-23 15:19:21 +00:00
nickysn
5dd7e116ce + added header comment with copyright and license info to the WASI system unit
git-svn-id: branches/wasm@48350 -
2021-01-23 14:56:23 +00:00
nickysn
6f20e32ddd + added argc and argv (not yet initialized), so that unit objpas compiles
git-svn-id: branches/wasm@48347 -
2021-01-23 07:34:09 +00:00
nickysn
a277228b57 + also attempt to compile objpas in the WASI makefiles
git-svn-id: branches/wasm@48346 -
2021-01-23 07:31:30 +00:00
nickysn
6350401d4c + debug output in the WASM directory functions
git-svn-id: branches/wasm@48345 -
2021-01-23 07:24:41 +00:00
nickysn
a28eb39f4b + implemented WASI file close
git-svn-id: branches/wasm@48344 -
2021-01-23 07:04:32 +00:00
nickysn
8e2e31f95c * memory.grow returns the previous memory size in pages, so we don't need to ask for the size first in SysOSAlloc
git-svn-id: branches/wasm@48343 -
2021-01-23 06:40:45 +00:00
nickysn
a6d332d092 - removed the heap alloc/free function debug output
git-svn-id: branches/wasm@48342 -
2021-01-23 06:37:22 +00:00
nickysn
0077b16cc3 * pass 3 as fd for path_open
git-svn-id: branches/wasm@48341 -
2021-01-23 06:15:19 +00:00
nickysn
fb29456a0a * fixed parameter of DebugWriteHexLongWord
git-svn-id: branches/wasm@48339 -
2021-01-23 05:00:21 +00:00
nickysn
a329325217 * THandle is a longint on the WASI target
git-svn-id: branches/wasm@48315 -
2021-01-22 04:09:51 +00:00
nickysn
cdb74f034c + call InitSystemThreads in the system unit startup for WASI
git-svn-id: branches/wasm@48313 -
2021-01-22 03:01:55 +00:00
nickysn
c8760b12d4 + initial attempt for implementing do_open. Not working yet
git-svn-id: branches/wasm@48311 -
2021-01-22 02:43:54 +00:00
nickysn
e14451c6b6 + added error handling to the do_read and do_Write WASI routines
git-svn-id: branches/wasm@48310 -
2021-01-22 02:06:30 +00:00
nickysn
85ea2b9b11 + added the WASI errno constants
git-svn-id: branches/wasm@48309 -
2021-01-22 01:35:12 +00:00
nickysn
9b173ac119 + implemented do_isdevice for WASI
git-svn-id: branches/wasm@48308 -
2021-01-22 01:26:35 +00:00
nickysn
d6038c5709 + implemented do_read for WASI
git-svn-id: branches/wasm@48307 -
2021-01-22 01:04:19 +00:00
nickysn
f585b2d846 + si_prc startup unit added to the makefiles
git-svn-id: branches/wasm@48306 -
2021-01-22 00:55:01 +00:00
nickysn
f5f15e3dbf + added startup code for WASI
git-svn-id: branches/wasm@48304 -
2021-01-22 00:41:51 +00:00
nickysn
7f60637c92 - removed the system unit startup code debug output
git-svn-id: branches/wasm@48303 -
2021-01-22 00:31:16 +00:00
nickysn
204b0a777d + implemented system_exit for WASI
git-svn-id: branches/wasm@48302 -
2021-01-22 00:28:13 +00:00
nickysn
d8f2d85474 * switch to wasi_snapshot_preview1
git-svn-id: branches/wasm@48301 -
2021-01-22 00:19:10 +00:00
nickysn
8866fcbc56 - removed the FULL_RTL ifdefs, i.e. always build a full rtl
git-svn-id: branches/wasm@48300 -
2021-01-22 00:16:34 +00:00
nickysn
5794afac54 + implemented do_write for WASI. Error handling is not yet done.
git-svn-id: branches/wasm@48299 -
2021-01-22 00:15:01 +00:00
nickysn
9b2e3aa251 + rtl file routines debug output
git-svn-id: branches/wasm@48298 -
2021-01-22 00:07:00 +00:00
nickysn
00d2f6273b + implemented OpenStdIO
git-svn-id: branches/wasm@48297 -
2021-01-22 00:04:42 +00:00
nickysn
bc0d510ee2 + added DebugWriteHexWord and DebugWriteHexLongWord
git-svn-id: branches/wasm@48296 -
2021-01-22 00:03:55 +00:00
nickysn
ae39e3da44 + endless loop in system_exit (for now)
git-svn-id: branches/wasm@48294 -
2021-01-21 23:22:44 +00:00
nickysn
dd47111e61 + call SysInitStdIO (empty for now) and clear InOutRes at startup
git-svn-id: branches/wasm@48293 -
2021-01-21 23:21:07 +00:00
nickysn
84bf3a390e + init exceptions and the unicode string manager
git-svn-id: branches/wasm@48291 -
2021-01-21 23:15:37 +00:00
nickysn
54299874d3 + implemented memory.grow and memory.size intrinsics and implemented SysOSAlloc
git-svn-id: branches/wasm@48290 -
2021-01-21 23:13:49 +00:00
nickysn
fe7fd69d5e + initialize heap in the system unit startup (but SysOSAlloc is not yet implemented)
git-svn-id: branches/wasm@48289 -
2021-01-21 22:22:08 +00:00
nickysn
11ed6adf63 + set IsConsole and IsLibrary in the wasi system unit startup
git-svn-id: branches/wasm@48288 -
2021-01-21 22:19:33 +00:00
nickysn
83f3d68537 + some system unit debug output
git-svn-id: branches/wasm@48287 -
2021-01-21 22:17:48 +00:00
nickysn
899d718895 + more WASI rtl functions (dummy, not yet implemented)
git-svn-id: branches/wasm@48240 -
2021-01-20 21:38:53 +00:00
nickysn
6df4254c12 + added WASI sysdir.inc and sysfile.inc (functions not implemented yet)
git-svn-id: branches/wasm@48239 -
2021-01-20 21:29:40 +00:00
nickysn
9f69800394 + added some more WASI RTL constants
git-svn-id: branches/wasm@48238 -
2021-01-20 21:23:40 +00:00
nickysn
2f233adda2 + dummy WASI heap functions
git-svn-id: branches/wasm@48220 -
2021-01-19 19:55:34 +00:00
nickysn
67206943e8 + added WASI RTL makefile
git-svn-id: branches/wasm@47992 -
2021-01-02 22:56:43 +00:00
nickysn
a5fafea8d1 * more updates to attempt to get a larger part of the full RTL to compile for WASM32
git-svn-id: branches/wasm@47970 -
2021-01-02 13:01:39 +00:00
nickysn
bb42589829 + added DebugWriteLn
git-svn-id: branches/wasm@47961 -
2021-01-02 10:47:04 +00:00
nickysn
1911fcd8ce * fixed StrLen double definition when compiling WASI with -dFULL_RTL
git-svn-id: branches/wasm@47960 -
2021-01-02 09:02:32 +00:00
nickysn
9bd8b66e86 + first attempts to compile a full WASI rtl
git-svn-id: branches/wasm@47958 -
2021-01-02 08:05:02 +00:00
nickysn
76a3014e3a + added DebugWriteHexByte
git-svn-id: branches/wasm@47954 -
2021-01-02 07:30:21 +00:00
nickysn
7221e9fe7f + added DebugWriteHexDigit
git-svn-id: branches/wasm@47953 -
2021-01-02 07:28:56 +00:00
nickysn
b80a650c7d + added DebugWriteChar
git-svn-id: branches/wasm@47952 -
2021-01-02 07:27:13 +00:00
nickysn
065d2c718d * no need to copy the local var paramater in StrLen()
git-svn-id: branches/wasm@47948 -
2021-01-02 06:37:52 +00:00
nickysn
4b9397fce4 * our_iov converted to a local var
git-svn-id: branches/wasm@47931 -
2020-12-31 18:37:59 +00:00
nickysn
82e9cb0189 * our_nwritten converted to a local var
git-svn-id: branches/wasm@47930 -
2020-12-31 18:37:07 +00:00
nickysn
08ae48aebf * i in strlen converted to a local variable, because that now works
git-svn-id: branches/wasm@47928 -
2020-12-31 18:24:16 +00:00
nickysn
0858579b50 * the gp: pchar global variable converted to local, because the code generator can now cope with this
git-svn-id: branches/wasm@47922 -
2020-12-31 08:18:00 +00:00
nickysn
76c48eb705 + added DebugWrite to the WASI system unit
git-svn-id: branches/wasm@47182 -
2020-10-24 19:01:30 +00:00
nickysn
96052c8d92 * synchronized with trunk
git-svn-id: branches/wasm@46754 -
2020-09-02 23:53:36 +00:00
nickysn
893e08489d + added a dummy test rtl function that takes parameters and returns a result
git-svn-id: branches/wasm@46712 -
2020-08-26 23:03:45 +00:00
nickysn
16aa4f0dfd + added the minimal system unit from the wasm demo
git-svn-id: branches/wasm@46260 -
2020-08-05 16:02:51 +00:00