aboutsummaryrefslogtreecommitdiff
path: root/lib/std/os/linux/mips64.zig
AgeCommit message (Collapse)Author
2025-10-18std.os.linux: remove syscall7() on mips64/mipsn32Alex Rønne Petersen
I'm not sure why this was here, but this is only a thing on O32, not N32/N64.
2025-10-18std: make all MIPS inline asm safe for MIPS IAlex Rønne Petersen
MIPS I has load hazards so we need to insert nops in a few places. This is not a problem for MIPS II and later. While doing this, I also touched up all the inline asm to use ABI register aliases and a consistent formatting convention. Also fixed a few places that didn't properly check if the syscall return value should be negated.
2025-10-17std.os.linux: clean up a bunch of dead constsAlex Rønne Petersen
2025-10-17std.os.linux: retranslate F_* constants and Flock struct, and move out of ↵Alex Rønne Petersen
arch bits Flock is now equivalent to struct flock64, and the related F.* constants map to the 64-bit variants on 32-bit systems.
2025-10-17std.os.linux: replace usize/isize in arch bits with fixed types for clarityAlex Rønne Petersen
2025-10-17std.os.linux: move some generic decls out of the arch bitsAlex Rønne Petersen
2025-10-10std: stop exposing anything having to do with ucontext_tAlex Rønne Petersen
This type is useful for two things: * Doing non-local control flow with ucontext.h functions. * Inspecting machine state in a signal handler. The first use case is not one we support; we no longer expose bindings to those functions in the standard library. They're also deprecated in POSIX and, as a result, not available in musl. The second use case is valid, but is very poorly served by the standard library. As evidenced by my changes to std.debug.cpu_context.signal_context_t, users will be better served rolling their own ucontext_t and especially mcontext_t types which fit their specific situation. Further, these types tend to evolve frequently as architectures evolve, and the standard library has not done a good job keeping up, or even providing them for all supported targets.
2025-10-07std.os.linux: add ucontext_t and mcontext_t for mips/mips64Alex Rønne Petersen
2025-09-30std: rework/remove ucontext_tmlugg
Our usage of `ucontext_t` in the standard library was kind of problematic. We unnecessarily mimiced libc-specific structures, and our `getcontext` implementation was overkill for our use case of stack tracing. This commit introduces a new namespace, `std.debug.cpu_context`, which contains "context" types for various architectures (currently x86, x86_64, ARM, and AARCH64) containing the general-purpose CPU registers; the ones needed in practice for stack unwinding. Each implementation has a function `current` which populates the structure using inline assembly. The structure is user-overrideable, though that should only be necessary if the standard library does not have an implementation for the *architecture*: that is to say, none of this is OS-dependent. Of course, in POSIX signal handlers, we get a `ucontext_t` from the kernel. The function `std.debug.cpu_context.fromPosixSignalContext` converts this to a `std.debug.cpu_context.Native` with a big ol' target switch. This functionality is not exposed from `std.c` or `std.posix`, and neither are `ucontext_t`, `mcontext_t`, or `getcontext`. The rationale is that these types and functions do not conform to a specific ABI, and in fact tend to get updated over time based on CPU features and extensions; in addition, different libcs use different structures which are "partially compatible" with the kernel structure. Overall, it's a mess, but all we need is the kernel context, so we can just define a kernel-compatible structure as long as we don't claim C compatibility by putting it in `std.c` or `std.posix`. This change resulted in a few nice `std.debug` simplifications, but nothing too noteworthy. However, the main benefit of this change is that DWARF unwinding---sometimes necessary for collecting stack traces reliably---now requires far less target-specific integration. Also fix a bug I noticed in `PageAllocator` (I found this due to a bug in my distro's QEMU distribution; thanks, broken QEMU patch!) and I think a couple of minor bugs in `std.debug`. Resolves: #23801 Resolves: #23802
2025-09-28std.os.linux: delete restore and restore_rt for hexagon, loongarch, mips, riscvAlex Rønne Petersen
2025-09-23Don't specify clobbers in `restore_rt`taylor.fish
Per @alexrp, this is unnecessary in naked functions.
2025-07-16canonicalize loongarch clobbersAndrew Kelley
2025-07-16fix mips inline asmAndrew Kelley
wtf are these dollar signs?
2025-07-16zig fmtAndrew Kelley
2025-07-07os: fix missing and incorrect msghdr definitionsNameless
Macos uses the BSD definition of msghdr All linux architectures share a single msghdr definition. Many architectures had manually inserted padding fields that were endian specific and some had fields with different integers. This unifies all architectures to use a single correct msghdr definition.
2025-04-07std.os.linux: use heap.pageSize() instead of MMAP2_UNITStefan Weigl-Bosker
2025-03-05Remove uses of deprecated callconv aliasesLinus Groh
2025-01-19std.os.linux: Don't emit CFI directives if unwind tables are disabled.Alex Rønne Petersen
2024-12-11std.os.linux: Add unwinding protection in clone() implementations.Alex Rønne Petersen
Whatever was in the frame pointer register prior to clone() will no longer be valid in the child process, so zero it to protect FP-based unwinders. Similarly, mark the link register as undefined to protect DWARF-based unwinders. This is only zeroing the frame pointer(s) on Arm/Thumb because of an LLVM assembler bug: https://github.com/llvm/llvm-project/issues/115891
2024-08-18std.os.linux: Fix Stat struct for mips/mips64.Alex Rønne Petersen
2024-08-18std.os.linux: Fix rlimit_resource for mips64; move out of arch bits.Alex Rønne Petersen
It is usually generic, so no point having it in arch bits.
2024-08-18std.os.linux: Fix syscall errno value handling for mips.Alex Rønne Petersen
The kernel sets r7 to 0 (success) or -1 (error), and stores the result in r2. When r7 is -1 and the result is positive, it needs to be negated to get the errno value that higher-level code, such as errnoFromSyscall(), expects to see. The old code was missing the check that r2 is positive, but was also doing the r7 check incorrectly; since it can only be set to 0 or -1, the blez instruction would always branch. In practice, this fix is necessary for e.g. the ENOSYS error to be interpreted correctly. This manifested as hitting an unreachable branch when calling process_vm_readv() in std.debug.MemoryAccessor.
2024-08-12`std.os.linux`: Add clone() implementation for mips64. (#21038)Alex Rønne Petersen
Only for n64; no handling for n32 yet. Also remove pointless comment about o32 in mips64 code.
2024-08-03std.os.linux: Fix CGT_SYM for mips/mips64.Alex Rønne Petersen
2024-07-19fix regression of flock being called on wasi targetsAndrew Kelley
* common symbols are now public from std.c even if they live in std.posix * LOCK is now one of the common symbols since it is the same on 100% of operating systems. * flock is now void value on wasi and windows * std.fs.Dir now uses flock being void as feature detection, avoiding trying to call it on wasi and windows
2024-07-19std.c reorganizationAndrew Kelley
It is now composed of these main sections: * Declarations that are shared among all operating systems. * Declarations that have the same name, but different type signatures depending on the operating system. Often multiple operating systems share the same type signatures however. * Declarations that are specific to a single operating system. - These are imported one per line so you can see where they come from, protected by a comptime block to prevent accessing the wrong one. Closes #19352 by changing the convention to making types `void` and functions `{}`, so that it becomes possible to update `@hasDecl` sites to use `@TypeOf(f) != void` or `T != void`. Happily, this ended up removing some duplicate logic and update some bitrotted feature detection checks. A handful of types have been modified to gain namespacing and type safety. This is a breaking change. Oh, and the last usage of `usingnamespace` site is eliminated.
2024-07-09std: fix typos (#20560)Jora Troosh
2024-03-19extract std.posix from std.osAndrew Kelley
closes #5019
2024-02-11some API work on std.c, std.os, std.os.wasiAndrew Kelley
* std.c: consolidate some definitions, making them share code. For example, freebsd, dragonfly, and openbsd can all share the same `pthread_mutex_t` definition. * add type safety to std.c.O - this caught a bug where mode flags were incorrectly passed as the open flags. * 3 fewer uses of usingnamespace keyword * as per convention, remove purposeless field prefixes from struct field names even if they have those prefixes in the corresponding C code. * fix incorrect wasi libc Stat definition * remove C definitions from incorrectly being in std.os.wasi * make std.os.wasi definitions type safe * go through wasi native APIs even when linking libc because the libc APIs are problematic and wasteful * don't expose WASI definitions in std.posix * remove std.os.wasi.rights_t.ALL: this is a footgun. should it be all future rights too? or only all current rights known? both are the wrong answer.
2024-02-06std.os.linux.MAP: use a packed structAndrew Kelley
Introduces type safety to this constant. Eliminates one use of `usingnamespace`.
2023-07-31std: finish cleanup up asmJacob Young
This also required implementing the necessary syntax in the x86_64 backend.
2023-06-19all: zig fmt and rename "@XToY" to "@YFromX"Eric Joldasov
Signed-off-by: Eric Joldasov <bratishkaerik@getgoogleoff.me>
2023-02-04Add support for mips64/mips64elSuirad