Commit Graph

58 Commits (9748bb8af86c131d45be1238ea4d5f965a974630)

Author SHA1 Message Date
occheung 9748bb8af8 add riscv32 2021-08-20 17:42:16 +08:00
edef 099bc28867 Ensure arch:👿:StackPointer has defined representation 2019-11-08 01:20:00 +00:00
Gerd Zellweger 5849a2d330 Replace simd with packed_simd
The simd crate no longer builds, as of Rust 1.33 nightly, due to the 
removal of compiler features that it depends on. packed_simd is the 
recommended replacement.
2019-11-08 00:53:38 +00:00
edef 34ab0dc2cd Fix should_panic attributes 2017-02-25 14:24:36 +01:00
Amanieu d'Antras 74c4444a7f Inline the swap trampoline on x86_64 and AArch64 2016-11-02 00:15:15 -04:00
whitequark 809215921b Unbreak or1k.
close #53
2016-09-22 13:41:26 -04:00
Amanieu d'Antras 40e955638e Add support for AArch64
close #43
2016-09-09 10:59:35 -04:00
Amanieu d'Antras fff625767c Clean up and simplify the implementation of generators 2016-09-09 10:59:35 -04:00
Amanieu d'Antras f7f209c1eb Add proper CFI annotations to the inline asm
This ensures that gdb is able to generate a correct backtrace when
stopped at any instruction in the inline asm.

It also makes backtraces accessible to tools that only track frame
pointer chains, like perf or dtrace.

close #49
2016-09-09 10:59:19 -04:00
whitequark f82d0e2c21 Bring back workarounds for Mach-O assembly syntax. 2016-09-04 07:18:55 -04:00
whitequark 491af39fc9 Radically simplify stack linking.
This commit:

  * Gets rid of 2nd init trampoline.
  * Gets rid of any custom CFI, instead using the standard CFI
    for target prologue.
  * Makes backtraces accessible to tools that only track frame
    pointer chains, like perf or dtrace.
  * Keeps the performance at the exact same level.
2016-09-04 07:18:55 -04:00
Amanieu d'Antras b1f5b7458f Pass the new stack pointer by value into the swap trampoline 2016-09-04 02:13:46 -04:00
Amanieu d'Antras 86e29b2baa Remove unnecessary "memory" clobbers for naked function asm 2016-09-04 02:13:46 -04:00
Amanieu d'Antras 38ff4126b6 Add missing inline asm clobbers for x86 and x86_64 2016-09-04 02:13:46 -04:00
Amanieu d'Antras fb9acb73f3 Use raw pointers instead of references to avoid aliasing issues 2016-09-04 02:13:46 -04:00
whitequark c6ece101e2 Expose fringe::STACK_ALIGNMENT, and make OwnedStack respect it. 2016-09-02 19:44:34 -04:00
whitequark a1ea208652 arch/x86_64: hack to work around ld64 shortcomings on OS X.
fix #35, close #36
2016-08-31 20:25:00 -04:00
whitequark a733290359 arch: bring back clobbers for input operands.
This reverts a part of 365e40b. While it is not legal to clobber
the output register, it is legal and necessary to do this for inputs,
since we do not preserve them, and LLVM could have decided to
reuse them.

Thanks to @Amanieu for discovering this.
2016-08-31 14:17:54 -04:00
whitequark 248d7b16b5 arch/or1k: fix typo. 2016-08-31 14:17:54 -04:00
whitequark 2d8cefcabc Do not simultaneously clobber registers passed into assembly.
This is not actually legal (although the restriction is not
documented anywhere), and is not caught by LLVM unless the codegen
option -verify-machineinstrs is specified. This option is now used
on Travis.

While not legal, this does not seem to result in invalid output
(although it creates an unnecessary spill); however, under extremely
specific circumstances (e.g. when a register scavenger is run under
severe pressure), this will result in a codegen crash, which is
how I found it.
2016-08-30 12:20:34 -04:00
edef f21b8dc936 Update the license headers for MIT/Apache 2016-08-20 23:45:01 +02:00
whitequark e0ad79ea0c Add an OR1K port. 2016-08-19 15:12:42 +02:00
whitequark 145c18125a Explain how trampolines work. 2016-08-13 13:38:04 +02:00
whitequark b79e7c0a9b Rename Stack::top() to Stack::base(), which is correct.
Fixes #25.
2016-08-13 13:38:04 +02:00
whitequark 7d5075edc2 Add more examples to README.
This also renames some functions for a mild increase in backtrace
clarity.
2016-08-13 13:38:04 +02:00
whitequark f34ddc6805 Don't use core::intrinsics.
The core::intrinsics::unreachable() we used at the end of every naked
function is essentially pointless, as #[naked] implies that intrinsic
at the end of the function. rustc currently does not implement that
behavior (rust-lang/rust#32487), but it is a bug. On top of that,
anything except a single asm!() in naked functions is likely to be
disallowed in the future (rust-lang/rust#32490).

A nice side effect is that we avoid the core_intrinsics feature,
which will be never stabilized, though neither asm nor
naked_functions are likely to be stabilized soon.
2016-08-13 13:38:04 +02:00
whitequark 23cf17865d Remove workaround for rust-lang/rust#25544. 2016-08-13 13:38:04 +02:00
whitequark 892a7696ec Allow unwinding to propagate across a context swap.
The main purpose of this is having nice backtraces in gdb, although
it also slightly simplifies poisoning state of the API consumers
after a panic.
2016-08-13 13:38:04 +02:00
whitequark 40fbfdde0c Kill impl StackPointer.
That was a silly idea for a silly abstraction, and it brought no
improvement, only confusion. So, revert it.
2016-08-13 13:38:04 +02:00
edef 8c761d944f Fix Windows x64 ABI 2016-07-17 16:57:23 -04:00
John Ericson 75ca6f66e1 Move x86 trampoline to naked function
Close #19
2016-07-16 16:39:19 -04:00
John Ericson 1ea4b01eda Use mostly the same registers for consistency
The exception to this is %eax is used not %edi on x86 because its
caller-save
2016-07-16 16:39:14 -04:00
whitequark cbe136b762 Completely rework fringe::Context and fringe::arch.
The new design concerns itself with one thing and exactly one thing:
passing values back and forth with an extern "C" function.
This allows to simplify fringe::arch into a single primitive, swap.

Close #21
2016-07-16 15:04:15 -04:00
edef 6284a22caa add fpsr, eflags for good measure
courtesy of @whitequark
2016-04-16 07:41:00 +02:00
John Ericson 35fb046fb5 Factor out common code between x86 and x86_64
Fix #17
2016-04-14 13:37:15 +02:00
edef daece1a8d3 Registers::{swap2 => swap}, to match Context::swap 2016-04-03 19:56:15 +02:00
edef a50e6771b4 coerce rust_trampoline to a function pointer properly 2016-04-03 12:00:21 +02:00
edef 644cd81f9e fix parameter passing to arch/x86_64/swap.s 2016-04-03 11:59:14 +02:00
edef b986931817 remove copyright years
They're obnoxious to update, and I'm told they have no legal value.
2016-03-22 08:25:23 +01:00
edef 709dad1c4a add Context::swap2, to allow distinct save/restore contexts
Fix #5

Context::swap is now implemented in terms of Context::swap2, and it
might make sense to remove Context::swap entirely at some point.
2016-03-22 07:50:50 +01:00
edef 2b23083455 get rid of some minor warnings 2016-03-22 07:35:25 +01:00
edef bb2b92bf6b remove feature attributes for stable stuff 2016-03-16 00:14:09 +01:00
edef cd4fe1ecc8 remove obsolete support for Rust stack limits
rustc removed these in 7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c, and
this removes a Linux-specific TLS slot from our code.
2016-01-04 03:46:07 +01:00
John Ericson a1f286bdaf don't drop uninitialised memory when pushing to stack 2015-08-26 20:42:33 +02:00
John Ericson 96a31d2443 remove stray import 2015-08-26 20:41:12 +02:00
John Ericson 5411f10460 use Void to ensure closure diverges 2015-08-26 00:51:18 +02:00
edef e290a8bbaf remove `extern crate core` and prelude imports
the latest Rust nightly makes this unnecessary
2015-08-26 00:19:53 +02:00
edef 418c53797e x86 support
ref #1
2015-04-16 13:15:46 -04:00
edef 52325b07c0 comment fix: it's 8ns *faster* 2015-04-16 12:21:39 -04:00
edef a1e4c2b745 add Syntastic ASM lint hints 2015-04-16 11:56:45 -04:00