Commit Graph

6309 Commits

Author SHA1 Message Date
Yawning Angel 38665431dd core/crypto/_aes/ct64: Disable bounds checking 2025-03-23 19:17:18 +09:00
Yawning Angel 2f301e46dc core/crypto: Switch to using ensure 2025-03-23 19:14:33 +09:00
Yawning Angel dc94452fb9 core/crypto/blake2: Add the ability to easily alter digest size 2025-03-23 19:14:33 +09:00
Yawning Angel 93951ac72a core/crypto/sha2: Clean up the portable code slightly 2025-03-23 19:14:33 +09:00
Yawning Angel 982ab11aa1 core/crypto/sha2: Use hardware SHA224/256 when available (AMD64) 2025-03-23 19:14:33 +09:00
Yawning Angel b220df60b8 core:crypto/deoxysii: Initial import 2025-03-23 19:14:33 +09:00
Yawning Angel c2786a6dd5 core/crypto/aegis: Initial import 2025-03-23 19:14:33 +09:00
Yawning Angel 9fdcc4e39a core/crypto/x448: Initial import 2025-03-23 19:14:33 +09:00
Yawning Angel bb395aeb41 core/crypto: Add rodata annotations (NFC) 2025-03-23 19:14:33 +09:00
Yawning Angel 50d40c2a26 core/crypto/chacha20poly1305: Add missing assertions 2025-03-23 19:14:33 +09:00
Yawning Angel 6e8710fce4 core/crypto/chacha20: Misc Simd128 improvements
- Detect the RISC-V `v` profile
- Don't bother trying to process 4 blocks at a time if emulated
2025-03-23 19:14:33 +09:00
Yawning Angel e4e76f27f6 core/crypto: Use panic_contextless instead of intrinsics.trap 2025-03-23 19:14:33 +09:00
Yawning Angel 4c28f6d170 core/crypto/_aes/hw_intel: Fix comment (NFC) 2025-03-23 19:14:33 +09:00
Barinzaya 7819797a03 Split mem.make_map to match the runtime procs.
The existing `mem.make_map` passes a capacity, but the builtin
`make_map` no longer takes a capacity--it was separated to
`make_map_cap` to allow for making a map without an allocation (#4340).

`core:mem` was not updated to reflect this, so any usage of `mem.make`
to make a map will currently result in a compile error.
2025-03-22 11:03:04 -04:00
Wison Ye 17a01dcebf Merge remote-tracking branch 'upstream/master' 2025-03-22 17:52:43 +13:00
Wison Ye 01e81fe597 Fixed #4892: 'EPoll_Event.events' should be bit set. 2025-03-22 17:51:08 +13:00
Laytan Laats e4bc9677af fix unmarshalling bit sets in json
Fixes #4761
2025-03-22 00:20:00 +01:00
Laytan Laats cf0f73e0cf fix typo for freebsd arm64 MINSIGSTKSZ
Fixes #4878
2025-03-21 23:52:52 +01:00
Laytan Laats 73fd564634 fix tabs 2025-03-21 23:02:00 +01:00
Jonathan Tron 2bccd07426 Prevent registering the same event listener twice on the same element with the exact same data in wasm. 2025-03-21 09:38:23 +01:00
gingerBill 631406eecc Merge pull request #4951 from openhood/wasm-fix-remove-event-listeners
Fix add/remove event listeners in `core:sys/wasm`
2025-03-20 21:31:38 +00:00
gingerBill 539e9bd2e3 Merge pull request #4836 from laytan/fix-wrong-out-of-memory
fix wrong out of memory in edge cases, just try allocate from block for one source of truth
2025-03-20 17:20:26 +00:00
Jonathan Tron dbe53d053a Fix add/remove event listeners in core:sys/wasm
There were multiple issues here:

1. listeners stored in the same key overwriting the previous one
2. missing `use_capture` parameter in `remove_event_listener`/`remove_window_event_listener`

The key used to store the listener function in `listenerMap` was a
javascript `Object`, when used as a key it was thus serialized to
the string `"[object Object]"`, meaning all listeners where effectively
set to the same key when calling `add_event_listener`/`add_window_event_listener`.
Later on when calling `remove_event_listener`/`remove_window_event_listener`,
it then tried to remove the incorrect one or none at all if there was a
mix of the same event name registered on an element or the window.

To fix I implemented a function `listener_key` in the javascript code
which will generate a different key based on the event's:
- `id`: dom element's id or 'window' (when event listener added to the
  window)
- `name`: the event name (eg: `click`), each event handler should be
  removed for the event name it was register on.
- `data`: we can register events with different data, each one generate
  a new listener which has to be removed.
- `callback`: same as `data`, if you register two similar handler but
  with two different callback, each one should be removed.
- `useCapture`: this one is a bit tricky, but when you register an event
  handler in javascript, if you don't pass `useCapture`, it defaults to `false`.
  When you remove an handler, you have to pass the exact same
  `useCapture` option you registered it with. In this case, we allowed
  to register an event with different `useCapture`, but didn't allow to
  pass the `useCapture` when removing it. We always called `removeEventListener`
  without the `useCapture` parameter which removed the handler properly
  only when it was registered with `useCapture=false`.

I also switched the `WasmMemoryInterface.listenerMap` from `{}`
(javascript object) to a `new Map()`, which is available everywhere
nowadays.
2025-03-20 16:43:49 +01:00
gingerBill 408b3af550 Merge pull request #4933 from laytan/js-open-binding
core/sys/wasm/js: add `open` binding to `window.open`
2025-03-13 09:22:20 +00:00
gingerBill 35340de928 Merge pull request #4932 from laytan/js-pointer-event-and-charcode
core/sys/wasm/js: add pointer event info and add charCode to keyboard
2025-03-13 09:22:03 +00:00
gingerBill 5a12190f51 Merge pull request #4931 from laytan/webgl-improvements
webgl: add `BlendEquationSeparate` and `GetParameter4i`
2025-03-13 09:21:44 +00:00
Laytan Laats 6691acfa03 core/sys/wasm/js: add open binding to window.open 2025-03-12 18:43:03 +01:00
Laytan Laats b76fd84084 webgl: add BlendEquationSeparate and GetParameter4i
`GetParameter4i` can be used to retrieve the current scissor rect, or
the curent viewport, which was previously impossible.

Also adds `BlendEquationSeparate` which seemed to be missing.

Also removes an instance of `do`.
2025-03-12 18:39:57 +01:00
Laytan Laats 00ac48c06c core/sys/wasm/js: add pointer event info and add charCode to keyboard events 2025-03-12 18:37:42 +01:00
Laytan Laats d349c96071 core/sys/wasm/js: improve gamepad API
1. Properly set `id` and `mapping` on the `get_gamepad_state` result
2. Increase `id` limit to 96 bytes, connecting my DualShock 4 made it crash
3. If an `id` or `mapping` is longer than the limits, slice it and add `...`
2025-03-12 18:32:51 +01:00
jason ae02ced175 Fix linux.rt_sigaction
Add missing polymorphic parameter to Sig_Action
2025-03-10 20:27:59 -04:00
gingerBill 6837e23e73 Merge pull request #4919 from latedeployment/add-linux-syscalls
Add missing x86 syscalls from map_shadow_stack to removexattrat
2025-03-10 17:29:32 +00:00
Adam Zadrożny 7866f7ab2b Update fmt docs for procedures with a default allocator parameter 2025-03-09 13:35:12 +01:00
latedeployment 0491ad55f4 Add missing syscalls from map_shadow_stack to removexattrat 2025-03-07 21:54:51 +02:00
flysand7 47eefb3f21 [datetime]: Remove the definition of EPOCH 2025-03-06 20:28:12 +11:00
Feoramund fef5f526f3 Remove unneeded slicing in strings.clone 2025-03-05 13:54:31 -05:00
Feoramund 2ab1ca29e6 Fix data races in os2/env_linux.odin
Switched to a recursive mutex so that procedures which need to perform
lookups can do so while also maintaining the lock across their entire
body in order to guarantee atomicity for each environment operation.
2025-03-04 19:32:05 -05:00
Feoramund 179e5b9266 Fix typo 2025-03-04 19:12:45 -05:00
Feoramund 266f15b672 Fix indentation 2025-03-04 19:11:32 -05:00
Feoramund 2d0dc44636 Shorten buffers used for os2.random_string results
This is needed now that `os2.random_string` fills the whole slice.
2025-03-03 19:18:54 -05:00
Feoramund d6002d68a2 Make os2.random_string use context.random_generator
This removes the data race caused by multiple threads using the
unprotected global `random_string_seed`, so long as no two threads share
the same random generator; this is the default case.

Additionally, `os2.random_string` now takes into account the full buffer
slice given to it.
2025-03-03 19:17:29 -05:00
Laytan Laats 189b4782fb dynlib: fix initialize_symbols when there is no field for the handle in the struct 2025-03-03 20:33:33 +01:00
Laytan Laats 05add96fc8 sys/windows: fix tabs 2025-03-03 19:30:22 +01:00
Feoramund 675bffce88 Add missing allocator in os2.file_info_clone 2025-03-02 17:22:43 -05:00
Feoramund 7d1fcfa09b Fix wrong path in os2.user_config_dir 2025-03-02 17:22:40 -05:00
alektron fd539b5e81 Fix: When resizing a virtual arena by commiting more of the already reserved memory, the total_used field of the arena was not updated; 2025-03-02 17:46:39 +01:00
Jeroen van Rijn 7841d0b14b Merge pull request #4884 from Dzentsetsu/master
Add DWM_WINDOW_CORNER_PREFERENCE enum for window corner preferences
2025-03-02 13:50:00 +01:00
gingerBill 3963ad1cc1 Update core/sys/windows/dwmapi.odin
Co-authored-by: Laytan <laytanlaats@hotmail.com>
2025-03-02 12:24:45 +00:00
flysand7 70daf40cb1 Fix documentation for simd_shuffle 2025-03-02 20:42:13 +11:00
flysand7 698c510ba7 Merge branch 'master' into docs-simd 2025-03-02 20:05:55 +11:00