Commit Graph

154 Commits

Author SHA1 Message Date
gingerBill
7e5342f41f Use contextless where possible 2022-03-01 15:52:14 +00:00
gingerBill
18607e53cb Correct alloc_from_memory_block 2022-03-01 15:38:04 +00:00
Jeroen van Rijn
f971126183 [mem] Add missing \n to tracking allocator example. 2022-03-01 13:51:41 +01:00
Jeroen van Rijn
a3d99765cc mem: Add doc.odin with Tracking_Allocator example. 2022-02-05 22:18:22 +01:00
Yawning Angel
61c581baeb core/sys/unix: Add syscalls_linux.odin
Linux is in the unfortunate situation where the system call number is
architecture specific.  This consolidates the system call number
definitions in a single location, adds some wrappers, and hopefully
fixes the existing non-portable invocations of the syscall intrinsic.
2021-11-17 14:00:00 +00:00
Yawning Angel
672fc9fc4d core/mem: Add zero_explicit
This call is intended to provide the ability to securely scrub memory
without compiler interference, in a similar manner to explicit_bzero,
memset_s, SecureZeroMemory.

The approach taken is a volatile memset followed by a seqentially
consistent memory fence, to prevent the call from being optimized away
by DSE, and from being reordered.  An identical approach is currently
being used by the zeroize Rust crate, and is effective in practice.

LLVM IR output:
```
; Function Attrs: nounwind
define internal i8* @mem.zero_explicit(i8* %0, i64 %1) #0 {
decls:
  call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 %1, i1 true)
  fence seq_cst
  ret i8* %0
}
```
2021-10-31 22:57:13 +00:00
gingerBill
aaaddd03a6 Improve internal procedures 2021-10-25 01:28:06 +01:00
gingerBill
58e3f779f2 Remove nonsense from static_arena_init 2021-10-05 17:12:24 +01:00
gingerBill
455d64fbd4 Add error value to commit 2021-10-05 17:11:12 +01:00
gingerBill
16ca677c1f Correct mmap usage 2021-10-05 17:05:33 +01:00
gingerBill
1f1434b384 Add arena_util.odin 2021-10-05 16:42:42 +01:00
gingerBill
f83370235f Add static_arena_bootstrap_new 2021-10-05 16:39:14 +01:00
gingerBill
4961aff51b Minor cleanup 2021-10-05 16:37:15 +01:00
gingerBill
0ed3143006 Merge branch 'master' of https://github.com/odin-lang/Odin 2021-10-05 16:28:25 +01:00
gingerBill
bc2b8b597c Add virtual.Static_Arena 2021-10-05 16:28:14 +01:00
gingerBill
ccc4c641c4 Clean up Memory_Block logic 2021-10-05 16:25:30 +01:00
Jeroen van Rijn
1931e3147d Remove assert from mem.ptr_to_bytes. Fixes #1206 2021-10-05 14:18:48 +02:00
gingerBill
9d9ec192f1 Rename to growing_arena.odin 2021-10-04 17:57:59 +01:00
gingerBill
586a000152 Add Protect_Flags for virtual.protect 2021-10-04 17:42:15 +01:00
gingerBill
728f143e33 Add virtual_linux.odin 2021-10-04 17:30:06 +01:00
gingerBill
f2e78dcc0b Separate out the virtual memory allocation procedures
`reserve`, `commit`, `reserve_and_commit`, `decommit`, `release`, `protect`
2021-10-04 16:43:52 +01:00
gingerBill
e05a305764 Minor clean up 2021-10-03 12:43:11 +01:00
gingerBill
a437c95fed Remove mutex from Growing_Arena; Add Growing_Arena_Temp 2021-10-03 12:41:24 +01:00
gingerBill
8fe70978ff Add @(init) usage to core:mem/virtual 2021-10-03 12:40:51 +01:00
gingerBill
08ac2fd1b6 Rename virtual.Arena to virtual.Growing_Arena 2021-09-29 16:50:36 +01:00
gingerBill
b2a36f204e Add a mutex to arena_free_all 2021-09-29 16:46:14 +01:00
gingerBill
efdd5cf499 Add a mutex to virtual.Arena 2021-09-29 16:43:58 +01:00
gingerBill
805e48ae1e Add core:mem/virtual 2021-09-29 16:39:20 +01:00
gingerBill
6fa3c992b5 mem.Raw_* alias runtime.Raw_* 2021-09-25 17:29:51 +01:00
gingerBill
bfc92d0aaf Make runtime.memset use int for the length from uint 2021-09-23 23:43:29 +01:00
Jeroen van Rijn
eb9665f836 fix mem.new_clone 2021-09-19 22:19:06 +02:00
Jeroen van Rijn
bf15e63130 Revert "Merge pull request #1177 from Kelimion/new_clone"
This reverts commit efa513262e, reversing
changes made to daccfca11d.
2021-09-19 22:16:02 +02:00
Jeroen van Rijn
64ce55944a fix mem.new_clone 2021-09-19 22:10:19 +02:00
gingerBill
ab85571ae6 Minor improvements to mem.odin 2021-09-11 16:33:05 +01:00
gingerBill
b712c84afb Fix typo 2021-09-10 16:37:43 +01:00
gingerBill
9980f81062 Add other constants to c and libc 2021-09-10 16:14:39 +01:00
gingerBill
12af657369 Unify memset usage across platforms and core:c/libc 2021-09-10 15:59:14 +01:00
gingerBill
99df0f1b12 libc changes: unify c and libc types; Add [^]T where appropriate 2021-09-10 15:41:51 +01:00
gingerBill
ca33cb990b Strip semicolons in core which were missing 2021-09-08 13:12:38 +01:00
gingerBill
3754af62d6 Correct "contextless" stuff in mem 2021-09-08 11:43:00 +01:00
gingerBill
12296cec2c Fix typo 2021-09-08 11:38:22 +01:00
gingerBill
a9f4273514 Make many mem procedures "contextless" 2021-09-08 11:18:05 +01:00
gingerBill
720884e0f1 Strip even more semicolons if followed by a } or ) on the same line 2021-08-31 23:47:57 +01:00
gingerBill
251da264ed Remove unneeded semicolons from the core library 2021-08-31 22:21:13 +01:00
gingerBill
a5c31bbee0 Add map_insert which returns the pointer to inserted value 2021-08-29 11:45:11 +01:00
gingerBill
81623861c0 Correct mem.clone_slice 2021-08-23 14:33:54 +01:00
gingerBill
4ccf135892 Unify new/make the internal logic between runtime and mem 2021-08-23 12:35:29 +01:00
gingerBill
d5bad374d9 Remove deprecated procedure slice_ptr_to_bytes 2021-08-22 12:55:57 +01:00
gingerBill
445ed9be2b Use multi-pointers when appropriate 2021-08-22 12:54:04 +01:00
gingerBill
f0437a4242 Enforce core:builtin and core:intrinsics for imports 2021-08-21 13:44:16 +01:00