auto merge of #13692 : vadimcn/rust/Win64-pre, r=alexcrichton
Stack unwinding doesn't work yet, so this won't pass a lot of tests.
This commit is contained in:
commit
1ce0b98c7b
10 changed files with 111 additions and 48 deletions
4
mk/rt.mk
4
mk/rt.mk
|
@ -247,8 +247,8 @@ $$(COMPRT_LIB_$(1)): $$(COMPRT_DEPS) $$(MKFILE_DEPS)
|
||||||
RANLIB="$$(AR_$(1)) s" \
|
RANLIB="$$(AR_$(1)) s" \
|
||||||
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1))" \
|
CFLAGS="$$(CFG_GCCISH_CFLAGS_$(1))" \
|
||||||
TargetTriple=$(1) \
|
TargetTriple=$(1) \
|
||||||
triple-runtime
|
triple-builtins
|
||||||
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/runtime/libcompiler_rt.a $$(COMPRT_LIB_$(1))
|
$$(Q)cp $$(COMPRT_BUILD_DIR_$(1))/triple/builtins/libcompiler_rt.a $$(COMPRT_LIB_$(1))
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# libbacktrace
|
# libbacktrace
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit f4b221571ce6f05714c1f1c6fa48f1393499989c
|
Subproject commit ed112ca1e4275e1c5707a898f2bf6164707ba378
|
|
@ -50,7 +50,9 @@ triple = sys.argv[1]
|
||||||
if len(sys.argv) == 3:
|
if len(sys.argv) == 3:
|
||||||
dl_path = sys.argv[2]
|
dl_path = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
snap = determine_curr_snapshot(triple)
|
# There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead, for now
|
||||||
|
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-pc-mingw32"
|
||||||
|
snap = determine_curr_snapshot(snap_triple)
|
||||||
dl = os.path.join(download_dir_base, snap)
|
dl = os.path.join(download_dir_base, snap)
|
||||||
url = download_url_base + "/" + snap
|
url = download_url_base + "/" + snap
|
||||||
print("determined most recent snapshot: " + snap)
|
print("determined most recent snapshot: " + snap)
|
||||||
|
|
|
@ -52,20 +52,9 @@ macro_rules! rtabort (
|
||||||
|
|
||||||
pub fn dumb_println(args: &fmt::Arguments) {
|
pub fn dumb_println(args: &fmt::Arguments) {
|
||||||
use std::io;
|
use std::io;
|
||||||
use libc;
|
use std::rt;
|
||||||
|
|
||||||
struct Stderr;
|
let mut w = rt::Stderr;
|
||||||
impl io::Writer for Stderr {
|
|
||||||
fn write(&mut self, data: &[u8]) -> io::IoResult<()> {
|
|
||||||
unsafe {
|
|
||||||
libc::write(libc::STDERR_FILENO,
|
|
||||||
data.as_ptr() as *libc::c_void,
|
|
||||||
data.len() as libc::size_t);
|
|
||||||
}
|
|
||||||
Ok(()) // just ignore the result
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut w = Stderr;
|
|
||||||
let _ = fmt::writeln(&mut w as &mut io::Writer, args);
|
let _ = fmt::writeln(&mut w as &mut io::Writer, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,19 +29,8 @@ macro_rules! uvdebug (
|
||||||
|
|
||||||
pub fn dumb_println(args: &fmt::Arguments) {
|
pub fn dumb_println(args: &fmt::Arguments) {
|
||||||
use std::io;
|
use std::io;
|
||||||
use libc;
|
use std::rt;
|
||||||
|
|
||||||
struct Stderr;
|
let mut w = rt::Stderr;
|
||||||
impl io::Writer for Stderr {
|
|
||||||
fn write(&mut self, data: &[u8]) -> io::IoResult<()> {
|
|
||||||
let _ = unsafe {
|
|
||||||
libc::write(libc::STDERR_FILENO,
|
|
||||||
data.as_ptr() as *libc::c_void,
|
|
||||||
data.len() as libc::size_t)
|
|
||||||
};
|
|
||||||
Ok(()) // just ignore the errors
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut w = Stderr;
|
|
||||||
let _ = fmt::writeln(&mut w as &mut io::Writer, args);
|
let _ = fmt::writeln(&mut w as &mut io::Writer, args);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ out.write(bytes!("Hello, world!"));
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use container::Container;
|
|
||||||
use fmt;
|
use fmt;
|
||||||
use io::{Reader, Writer, IoResult, IoError, OtherIoError,
|
use io::{Reader, Writer, IoResult, IoError, OtherIoError,
|
||||||
standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
|
standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
|
||||||
|
@ -37,11 +36,11 @@ use mem::replace;
|
||||||
use option::{Option, Some, None};
|
use option::{Option, Some, None};
|
||||||
use prelude::drop;
|
use prelude::drop;
|
||||||
use result::{Ok, Err};
|
use result::{Ok, Err};
|
||||||
|
use rt;
|
||||||
use rt::local::Local;
|
use rt::local::Local;
|
||||||
use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
|
use rt::rtio::{DontClose, IoFactory, LocalIo, RtioFileStream, RtioTTY};
|
||||||
use rt::task::Task;
|
use rt::task::Task;
|
||||||
use str::StrSlice;
|
use str::StrSlice;
|
||||||
use slice::ImmutableVector;
|
|
||||||
|
|
||||||
// And so begins the tale of acquiring a uv handle to a stdio stream on all
|
// And so begins the tale of acquiring a uv handle to a stdio stream on all
|
||||||
// platforms in all situations. Our story begins by splitting the world into two
|
// platforms in all situations. Our story begins by splitting the world into two
|
||||||
|
@ -236,18 +235,7 @@ fn with_task_stdout(f: |&mut Writer| -> IoResult<()> ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
None => {
|
None => {
|
||||||
struct Stdout;
|
let mut io = rt::Stdout;
|
||||||
impl Writer for Stdout {
|
|
||||||
fn write(&mut self, data: &[u8]) -> IoResult<()> {
|
|
||||||
unsafe {
|
|
||||||
libc::write(libc::STDOUT_FILENO,
|
|
||||||
data.as_ptr() as *libc::c_void,
|
|
||||||
data.len() as libc::size_t);
|
|
||||||
}
|
|
||||||
Ok(()) // just ignore the results
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut io = Stdout;
|
|
||||||
f(&mut io as &mut Writer)
|
f(&mut io as &mut Writer)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -665,6 +665,89 @@ mod imp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
mod arch {
|
||||||
|
use libc::{c_longlong, c_ulonglong};
|
||||||
|
use libc::types::os::arch::extra::{WORD, DWORD, DWORDLONG};
|
||||||
|
|
||||||
|
pub struct CONTEXT {
|
||||||
|
P1Home: DWORDLONG,
|
||||||
|
P2Home: DWORDLONG,
|
||||||
|
P3Home: DWORDLONG,
|
||||||
|
P4Home: DWORDLONG,
|
||||||
|
P5Home: DWORDLONG,
|
||||||
|
P6Home: DWORDLONG,
|
||||||
|
|
||||||
|
ContextFlags: DWORD,
|
||||||
|
MxCsr: DWORD,
|
||||||
|
|
||||||
|
SegCs: WORD,
|
||||||
|
SegDs: WORD,
|
||||||
|
SegEs: WORD,
|
||||||
|
SegFs: WORD,
|
||||||
|
SegGs: WORD,
|
||||||
|
SegSs: WORD,
|
||||||
|
EFlags: DWORD,
|
||||||
|
|
||||||
|
Dr0: DWORDLONG,
|
||||||
|
Dr1: DWORDLONG,
|
||||||
|
Dr2: DWORDLONG,
|
||||||
|
Dr3: DWORDLONG,
|
||||||
|
Dr6: DWORDLONG,
|
||||||
|
Dr7: DWORDLONG,
|
||||||
|
|
||||||
|
Rax: DWORDLONG,
|
||||||
|
Rcx: DWORDLONG,
|
||||||
|
Rdx: DWORDLONG,
|
||||||
|
Rbx: DWORDLONG,
|
||||||
|
Rsp: DWORDLONG,
|
||||||
|
Rbp: DWORDLONG,
|
||||||
|
Rsi: DWORDLONG,
|
||||||
|
Rdi: DWORDLONG,
|
||||||
|
R8: DWORDLONG,
|
||||||
|
R9: DWORDLONG,
|
||||||
|
R10: DWORDLONG,
|
||||||
|
R11: DWORDLONG,
|
||||||
|
R12: DWORDLONG,
|
||||||
|
R13: DWORDLONG,
|
||||||
|
R14: DWORDLONG,
|
||||||
|
R15: DWORDLONG,
|
||||||
|
|
||||||
|
Rip: DWORDLONG,
|
||||||
|
|
||||||
|
FltSave: FLOATING_SAVE_AREA,
|
||||||
|
|
||||||
|
VectorRegister: [M128A, .. 26],
|
||||||
|
VectorControl: DWORDLONG,
|
||||||
|
|
||||||
|
DebugControl: DWORDLONG,
|
||||||
|
LastBranchToRip: DWORDLONG,
|
||||||
|
LastBranchFromRip: DWORDLONG,
|
||||||
|
LastExceptionToRip: DWORDLONG,
|
||||||
|
LastExceptionFromRip: DWORDLONG,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct M128A {
|
||||||
|
Low: c_ulonglong,
|
||||||
|
High: c_longlong
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct FLOATING_SAVE_AREA {
|
||||||
|
_Dummy: [u8, ..512] // FIXME: Fill this out
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn init_frame(frame: &mut super::STACKFRAME64,
|
||||||
|
ctx: &CONTEXT) -> DWORD {
|
||||||
|
frame.AddrPC.Offset = ctx.Rip as u64;
|
||||||
|
frame.AddrPC.Mode = super::AddrModeFlat;
|
||||||
|
frame.AddrStack.Offset = ctx.Rsp as u64;
|
||||||
|
frame.AddrStack.Mode = super::AddrModeFlat;
|
||||||
|
frame.AddrFrame.Offset = ctx.Rbp as u64;
|
||||||
|
frame.AddrFrame.Mode = super::AddrModeFlat;
|
||||||
|
super::IMAGE_FILE_MACHINE_AMD64
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct Cleanup {
|
struct Cleanup {
|
||||||
handle: libc::HANDLE,
|
handle: libc::HANDLE,
|
||||||
SymCleanup: SymCleanupFn,
|
SymCleanup: SymCleanupFn,
|
||||||
|
|
|
@ -71,6 +71,8 @@ pub use self::util::default_sched_threads;
|
||||||
// Export unwinding facilities used by the failure macros
|
// Export unwinding facilities used by the failure macros
|
||||||
pub use self::unwind::{begin_unwind, begin_unwind_raw, begin_unwind_fmt};
|
pub use self::unwind::{begin_unwind, begin_unwind_raw, begin_unwind_fmt};
|
||||||
|
|
||||||
|
pub use self::util::{Stdio, Stdout, Stderr};
|
||||||
|
|
||||||
// FIXME: these probably shouldn't be public...
|
// FIXME: these probably shouldn't be public...
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub mod shouldnt_be_public {
|
pub mod shouldnt_be_public {
|
||||||
|
|
|
@ -71,14 +71,22 @@ pub fn default_sched_threads() -> uint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Stderr;
|
pub struct Stdio(libc::c_int);
|
||||||
|
|
||||||
impl io::Writer for Stderr {
|
pub static Stdout: Stdio = Stdio(libc::STDOUT_FILENO);
|
||||||
|
pub static Stderr: Stdio = Stdio(libc::STDERR_FILENO);
|
||||||
|
|
||||||
|
impl io::Writer for Stdio {
|
||||||
fn write(&mut self, data: &[u8]) -> IoResult<()> {
|
fn write(&mut self, data: &[u8]) -> IoResult<()> {
|
||||||
|
#[cfg(unix)]
|
||||||
|
type WriteLen = libc::size_t;
|
||||||
|
#[cfg(windows)]
|
||||||
|
type WriteLen = libc::c_uint;
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::write(libc::STDERR_FILENO,
|
let Stdio(fd) = *self;
|
||||||
|
libc::write(fd,
|
||||||
data.as_ptr() as *libc::c_void,
|
data.as_ptr() as *libc::c_void,
|
||||||
data.len() as libc::size_t);
|
data.len() as WriteLen);
|
||||||
}
|
}
|
||||||
Ok(()) // yes, we're lying
|
Ok(()) // yes, we're lying
|
||||||
}
|
}
|
||||||
|
|
|
@ -444,6 +444,8 @@ mod imp {
|
||||||
static SPIN_COUNT: DWORD = 4000;
|
static SPIN_COUNT: DWORD = 4000;
|
||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
static CRIT_SECTION_SIZE: uint = 24;
|
static CRIT_SECTION_SIZE: uint = 24;
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
static CRIT_SECTION_SIZE: uint = 40;
|
||||||
|
|
||||||
pub struct Mutex {
|
pub struct Mutex {
|
||||||
// pointers for the lock/cond handles, atomically updated
|
// pointers for the lock/cond handles, atomically updated
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue