Age | Commit message (Collapse) | Author | Files | Lines |
|
Regenerate the configuration files since a file was replaced
in the RISC-V port, and one other file was renamed.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Redirect to memcpy() if the memory areas of source and destination
do not overlap. Only redirect if length is > SZREG in order to
reduce overhead on very short copies.
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
If misaligned accesses are slow or prohibited, either
source or destination address are unaligned and the number
of bytes to be copied is > SZREG*2, align the source address
to xlen. This speeds up the function in the case where at
least one address is unaligned, since now one word (or doubleword
for rv64) is loaded at a time, therefore reducing the amount of
memory accesses necessary.
We still need to store back individual bytes since the
destination address might (still) be unaligned after aligning
the source.
The threshold of SZREG*2 was chosen to keep the negative effect
on shorter copies caused by the additional overhead from aligning
the source low.
This change also affects the case where both adresses are xlen-
aligned, the memory areas overlap destructively, and length is not
a multiple of SZREG. In the destructive-overlap case, the copying
needs to be done in reversed order. Therefore the length is added
to the addresses first, which causes them to become unaligned.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Add loop-unrolling for the case where both source and destination
address are aligned in the case of a destructive overlap, and
increase the unroll factor from 4 to 9 for the word-by-word
copy loop in the non-destructive case.
This matches the loop-unrolling done in memcpy() and increases
performance for lenghts >= SZREG*9 while almost not at all
degrading performance for shorter lengths.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Replace macros with static inline functions or RISC-V specifc
macros in order to keep consistency between all functions in the port.
Change data types to fixed-width and/or RISC-V specific types.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
Copy the common implementation of memmove() to the RISC-V port.
Rename memmove.S to memmove-asm.S to keep naming of files
consistent between functions. Update Makefile.inc with the changed
filenames.
Reviewed-by: Christian Herber <christian.herber@oss.nxp.com>
Signed-off-by: m fally <marlene.fally@gmail.com>
|
|
This was previously not handled correctly by newlib.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
According to the POSIX documentation, "when the new process image is
executed, any file descriptor (from this new set) which has its
FD_CLOEXEC flag set shall be closed (see posix_spawn())." The "new set"
is after processing the file actions, so if addopen had the O_CLOEXEC
flag set the descriptor should be closed after the exec.
The adddup2 docs, by contrast, specify that the flag should be cleared,
even if dup2 wouldn't have done so due to the specified file descriptors
being equal. Add a comment to that effect.
Addresses: https://sourceware.org/pipermail/newlib/2025/021968.html
Fixes: c7c1a1ca1b ("2013-10-01 Petr Hosek <phosek@chromium.org>")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
The 'filerace' test may run longer than the watchdog timeout.
'flock' and 'fork' may leave processes behind for some unknown reason.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
Only try to fix the cached DOS attributes if the caller actually
tried to create the file. Otherwise the fixup code is called even
in cases where we open the file with minimal query access bits and
NtQueryInformationFile() could fail with STATUS_ACCESS_DENIED and
the new cached DOS attributes are wrong again.
Fixes: 37c49decc835f ("Cygwin: open: only fix up cached DOS file attributes for on-disk files")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Previously, it was always applied to "myself", which is only appropriate
in the case of _P_OVERLAY (aka exec). Apply the flag to "myself" only
in that case, and apply it to the new child instead in other cases.
Also, clear the flag from "myself" in the case of a failed exec.
Fixes: 8d8724ee1b5a ("Cygwin: pty: Fix Ctrl-C handling further for non-cygwin apps.")
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
This patch defines binutils output binary format for AArch64 which is pei-aarch64-little.
Since =/usr/lib/w32api resolves to $SYSROOT/usr/lib/w32api and Fedora cross-build takes libraries from
/usr/aarch64-pc-cygwin/sys-root/usr/lib/w32api, the SEARCH_DIR("/usr/x86_64-pc-cygwin/lib/w32api"); is
redundant and can be removed.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Add options '-e' and '-r' to control error behavior and number of
test runs.
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
strcmp gives incorrect result for little endian targets under
the following conditions:
1. Length of 1st string is 1 less than a multiple of 4 (i.e len%4=3)
2. First string is a prefix of the second string
3. The first differing character in the second string is extended
ASCII (that is > 127)
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
This _isr_vec_count=1 is prevalent in MIPS Open FGPA examples.
Looks like forcing _isr_vec_007 in to the link was a mistake
and we always intended to only include the top-level _isr_vec
symbol.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
The compiler driver positions the linker script at the end of the linker
command-line, after crtend.o. As a result, any INPUT objects and archive
GROUPs introduced by the linker script end up after crtend.o. This messes up
the end-of-frame marker provided by crtend.o
This has always been a problem, but a recent binutils update to clean-up
redundant NULL markers in .eh_frame exposes it as a execution failure in
exception-handling tests. This patch re-orders .eh_frame in all linker
scripts so that the one from crtend.o is placed last.
An alternative approach would be to fix the compiler driver to put
the linker script before the ENDFILE spec.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Improve `strcmp` by using `ext` instruction, if available.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Fix prefetching in core loop to avoid exceeding the operated upon
memory region. Revert accidentally changed prefetch-hint back to
streaming mode. Refactor various bits and provide pre-processor
checks to allow parameters to be overridden from compiler command
line.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Add .eh_frame_hdr and .gnu_extab to linker scripts for compactEH
Fix orphaned .gcc_except_table sections in uhi32.ld.
Fix orphaned .gcc_except_table sections in mti32.ld.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
srec2hex.pl is a PERL script file which converts S-record file
to a MIPS HEX file, which can be useful for some simulation
environments.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Make using MIPS HAL component easier by including `mipshal.mk`
into source Makefile.
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
Implement abstract interface for MIPS, including unified hosting
interface (UHI).
Signed-off-by: Jovan Dmitrović <jovan.dmitrovic@htecgroup.com>
|
|
For aarch64 on ELF targets, the library does not export
fe{enable,disable,get}except as symbols from the library, relying on
static inline functions to provide suitable definitions if required.
But for Cygwin we need to create real definitions to satisfy the DLL
export script.
So arrange for real definitions of these functions when building on Cygwin.
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
To fetch heap info for a process in our /proc/PID/maps emulation,
we call RtlQueryProcessDebugInformation on this process since
commit b4966f91396b ("(heap_info::heap_info): Rearrange using
RtlQueryProcessDebugInformation").
However, it turns out that this call can crash the targeted
process, if it's called from multiple threads or processes in
parallel.
Worse, the entire code from creating the debug buffer, over
fetching the debug info, subsequent collecting the information
from said debug buffer, up to destroying the buffer, needs to be
guarded against parallel access.
We do this by adding a global mutex object, serializing access to
the debug info of a process.
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Fixes: b4966f91396b ("(heap_info::heap_info): Rearrange using RtlQueryProcessDebugInformation")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
We're using RtlQueryProcessDebugInformation from dlsym since
commit 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.")
Observations on the Cygwin mailing list show that calling
RtlQueryProcessDebugInformation on a process is neither
thread-safe, nor multi-process-safe, see
https://cygwin.com/pipermail/cygwin/2025-July/258403.html
for details.
This patch essentially reverts 31ddf45dd8694. Fetch the list of
loaded modules in the current process by calling EnumProcessModules
again.
Reported-by: Christian Franke <Christian.Franke@t-online.de>
Fixes: 31ddf45dd8694 ("* autoload.cc (EnumProcessModules): Remove.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
|
|
Currently, when cygwin app is launched, the console input mode is
set to tty::cygwin, even if the stdin is not a console. However,
it is not necessary because the cygwin app does not use stdin.
This also applies to stdout and stderr.
With this patch, the console mode is set only when std{in,out,err}
is a console for the cygwin app for better coexistence with non-
cygwin apps.
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
With the commit 476135a24506, set_input_mode() reffers to the flag
disable_master_thread in tty::cygwin mode. So it is necessary to call
set_input_mode() after changing disable_master_thread flag. However,
the commit 476135a24506 was missing that.
With this patch, set_input_mode() is called after changing the flag
disable_master_thread, if the console input mode is tty::cygwin.
Fixes: 476135a24506 ("Cygwin: console: Set ENABLE_PROCESSED_INPUT when disable_master_thread");
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
A __WCTOMB call on the terminating NUL may emit more than a NUL byte.
This is the case if the string ends with a lone UTF-16 high surrogate.
Fixes: 2a3a02a68764 ("Add SUSV2 support for calculating size if output buffer is NULL")
Signed-off-by: Christian Franke <christian.franke@t-online.de>
|
|
for aarch64-pc-cygwin
Signed-off-by: Radek Bartoň <radek.barton@microsoft.com>
|
|
Fix typo - parenthesis without an opening parenthesis.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
Running setup-x86_64.exe and performing an individual search for each package,
is a pain in the neck. And the user running "setup-x86_64.exe -q -P packageName"
may have a typo and the package would not be installed.
So by copying and pasting these commands into the terminal setup-x86_64.exe runs
a preliminary search, so when they reach the "Select Packages" window these packages
will be amongst the packages ready to be downloaded. Additionally sorting them makes it
easier to go down the list, and make sure all packages are listed.
Putting separate commands allows the user to pick which packages to download in the
case they want to run config, where those packages are not needed i.e. --without-cross-bootstrap.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
Add 5 additional packages:
for build: libtool;
for dumper utility: libiconv, libiconv2;
for documentation: perl-XML-SAX-Expat, docbook-utils.
When building from a sandbox environment on Windows 11 using the packages currently listed
in faq 6.21, I got the below error after calling "make":
"""""""""""""""
make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/testsuite'
Making all in doc
make[3]: Entering directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc'
GEN Makefile.dep
GEN cygwin-ug-net/cygwin-ug-net.pdf
GEN cygwin-api/cygwin-api.pdf
GEN cygwin-api/cygwin-api.html
etc...
GEN cygwin-api.info
could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX
warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt'
sh: line 1: /usr/bin/iconv: No such file or directory
-: warning: document without nodes
GEN cygwin-ug-net.info
could not find ParserDetails.ini in /usr/share/perl5/vendor_perl/5.40/XML/SAX
warning : xmlAddEntity: invalid redeclaration of predefined entity 'lt'
docbook2texi://refentry[@id='proc']/refnamediv: section is too deep
docbook2texi://refsect1[@id='proc-desc']: section is too deep
etc...
sh: line 1: /usr/bin/iconv: No such file or directory
-: warning: document without nodes
make[3]: *** [Makefile:721: cygwin-ug-net.info] Error 141
make[3]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup/doc'
make[2]: *** [Makefile:398: all-recursive] Error 1
make[2]: Leaving directory '/home/WDAGUtilityAccount/build-newlib/x86_64-pc-cygwin/winsup'
make[1]: *** [Makefile:9464: all-target-winsup] Error 2
make[1]: Leaving directory '/home/WDAGUtilityAccount/build-newlib'
make: *** [Makefile:883: all] Error 2
"""""""""""""""
Added the packages: libtool, libiconv, libiconv2, perl-XML-SAX-Expat, and docbook-utils.
Ran "make" again, and the error was resolved, and the install completed.
In the case that someone is using a similar OS (Windows 10 and 11), architecture (x64-based PC),
and/or verions of cygwin (3.6.3) for building cygwin from newlib-cygwin, this commit may prevent
those errors from occuring.
Additionally sorting the packages makes it easier to go down the list when selecting from the
"Select Packages" GUI window from setup-x86_64.exe, making sure all packages have been checked.
Signed-off-by: John Haugabook <johnhaugabook@gmail.com>
|
|
GCC 13 does not define the __riscv_misaligned_* builtin defines. They are
supported by GCC 14 or later. Test for __riscv_misaligned_fast to select an
always correct memcpy() implementation for GCC 13.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
|
|
This patch resolves issues related to unsafe access to deallocated
stack memory in the pthread wrapper for AArch64.
Key changes:
- Removed use of x19 by directly loading the thread function and
argument using LDP from [WRAPPER_ARG], freeing one register.
- Stored thread function and argument in x20 and x21 before
VirtualFree to preserve them across calls.
- Used x1 as a temporary register to load the stack base,
subtract CYGTLS, and update SP.
- Moved the thread argument back into x0 after VirtualFree and
before calling the thread function.
Earlier, `wrapper_arg` lived on the stack, which was freed via
`VirtualFree`, risking segfaults on later access. Now, the thread
`func` and `arg` are loaded before the stack is freed, stored in
callee-saved registers, and restored to `x0` before calling the
thread function.
Fixes: f4ba145056db ("Aarch64: Add inline assembly pthread wrapper")
Signed-off-by: Thirumalai Nagalingam <thirumalai.nagalingam@multicorewareinc.com>
|
|
Currently, ENABLE_PROCESSED_INPUT is set in set_input_mode() if
master_thread_suspended is true. This enables Ctrl-C handling when
cons_master_thread is suspended, since Ctrl-C is normally handled
by cons_master_thread.
However, when disable_master_thread is true, ENABLE_PROCESSED_INPUT
is not set, even though this also disables Ctrl-C handling in
cons_master_thread. Due to this bug, the command
C:\cygwin64\bin\sleep 10 < NUL
in the Command Prompt cannot be terminated with Ctrl-C.
This patch addresses the issue by setting ENABLE_PROCESSED_INPUT
when either disable_master_thread or master_thread_suspended is true.
This bug also affects cases where non-Cygwin Git (Git for Windows)
launches Cygwin SSH. In such cases, SSH also cannot be terminated
with Ctrl-C.
Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2995983695
Fixes: 746c8116dd4f ("Cygwin: console: Allow pasting very long text input.")
Reported-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
This is apparently relative to the new cwd, but my implementation is
currently treating it as relative to the parent's cwd, so it's worth
testing.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
This is a legal (if non-obvious) thing to do, so test it.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Test CWD and redirection of standard handles.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
This program is currently meant to test standard file handles and
current working directory (since these are settable via posix_spawn),
but could be extended to add additional checks if other cygwin-to-win32
process properties need to be tested.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
|
|
Fixes: 940dbeffa713 ("Cygwin: pipe: Fix unexpected blocking mode change by pipe_data_available()")
Reported by: Andrew Ng <anng.sw@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
There are tree variables for similar purpose in raw_write(), avail,
chunk, and len1. avail is the amount of writable space in the pipe.
len1 is the data length to attempt to NtWriteFile(). And chunk is
intermediate value to calculate len1 from avail which holds
min(avail, len). Here, chunk has no clear role among them. In fact,
it appears to obscure the intent of the code for the reader.
This patch removes the use of chunk and obtains len1 directly from
avail.
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
ipipe_data_available() is called from raw_write(). If the pipe is in
real_non_blocking_mode at that time, calling pipe_data_available()
can, in some cases, inadvertently revert the pipe to blocking mode.
Here is the background: pipe_data_available() checks the amount of
writable space in the pipe by calling NtQueryInformationFile() with
the FilePipeLocalInformation parameter. However, if the read side of
the pipe is simultaneously consuming data with a large buffer,
NtQueryInformationFile() may return 0 for WriteQuotaAvailable.
As a workaround for this behavior, pipe_data_available() temporarily
attempts to change the pipe-mode to blocking. If the pipe contains
data, this operation fails-indicating that the pipe is full. If it
succeeds, the pipe is considered empty. The problem arises from the
assumption that the pipe is always in real blocking mode before
attempting to flip the mode. However, if raw_write() has already set
the pipe to non-blocking mode due to its failure to determine available
space, two issues occur:
1) Changing to non-blocking mode in pipe_data_available() always
succeeds, since the pipe is already in non-blocking mode.
2) After this, pipe_data_available() sets the pipe back to blocking
mode, unintentionally overriding the non-blocking state required
by raw_write().
This patch addresses the issue by having pipe_data_available() check
the current real blocking mode, temporarily flip the pipe-mode and
then restore the pipe-mode to its original state.
Addresses: https://github.com/git-for-windows/git/issues/5682#issuecomment-2997428207
Fixes: 7ed9adb356df ("Cygwin: pipe: Switch pipe mode to blocking mode by default")
Reported-by: Andrew Ng <andrew.ng@sony.com>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|
|
... rather than 1 when the pipe space estimation fails, so that
select() and raw_wrie() can perform appropriate fallback handling.
In select(), even if pipe space is unknown, return writable to avoid
deadlock. Even with select() returns writable, write() can blocked
anyway, if data is larger than pipe space. In raw_write(), if the
pipe is real non-blocking mode, attempting to write larger data than
pipe space is safe. Otherwise, return error.
For other cases than FH_PIPEW, PDA_UNKNOWN never orrurs. Therefore,
it is not necessary to handle it in that cases.
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
|