Commit Graph

21750 Commits

Author SHA1 Message Date
Yuriy Kolerov 74de7de5a9 arc: libgloss: Add a linker script common for all boards
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22 14:26:09 -04:00
Yuriy Kolerov f507aef5e7 arc: libgloss: Add UART 8250 library
This library implements libgloss input/output and setup
routines for UART 8250 devices of ARC development boards:

    * EM Starter Kit
    * HS Development Kit
    * EM Software Development Platform
    * IoT Development Kit

_uart_8250_setup function with proper parameteres must be called
to setup UART 8250 device for a particular board (refer to
a board's documentation).

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22 14:26:03 -04:00
Yuriy Kolerov 13ae6cae44 arc: libgloss: Clean registers before any use
Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22 14:25:57 -04:00
Claudiu Zissulescu 6cfdd3350e arc: libgloss: Use atexit to setup fini routines
Use atexit funtion to setup fini routines to be called on exit
instead of filling in __atexit structures manually.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-05-22 14:25:50 -04:00
Vladimir Isaev 6d5331054e arc: libgloss: Introduce hostlink interface
There is a special interface built in ARC simulators (such as
nSIM) called MetaWare hostlink IO which can be used to implement
system calls. This commit adds support for this interface to the
ARC port of libgloss.

Here is an example of using this interface:

    $ arc-elf32-gcc -mcpu=hs -specs=hl.specs main.c -o main
    $ nsimdrv -tcf $NSIM_HOME/etc/tcf/templates/hs48_full.tcf main
    Hello, World!

Signed-off-by: Vladimir Isaev <vvisaev@gmail.com>
2024-05-22 14:25:44 -04:00
Luis Silva 25d110dcbd arc: libgloss: Use fstat call instead of stat for nSIM
This change is needed to meet semi-hosting requirements
for nSIM GNU I/O interface.

Signed-off-by: Luis Silva <luis.m.silva99@hotmail.com>
2024-05-22 14:25:37 -04:00
Shahab Vahedi 3f7e8eef09 arc: libc: Record r58/r59 in long-jump's buffer
The "longjmp" expects the "setjmp" to save the r58/r59 registers,
if there is any. With this change they are saved accordingly.

Checked for regression with running GCC's DejaGnu tests:

    $ runtest execute.exp=pr56982.c dg-torture.exp=pr48542.c

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
2024-05-22 14:25:29 -04:00
Yuriy Kolerov 880d537347 arc: libc, libgloss: Remove .file directive from .S files
Assembler for ARCv2 always extends the name provided by
.file directive to an absolute form.

On ARCv3 targets .file directive forces assembler to put
a provided string to DW_AT_name field as is without
extending to an absolute path. Then GDB cannot find
source files because of it.

The best way to fix this issue is just delete lines
with .file directive in .S files and let the compiler
to decide what DW_AT_name must contain. Particularly,
the compiler fills this filed by an absolute path to
a .S file because only absolute paths are used in
toolchain's build process.

Signed-off-by: Yuriy Kolerov <kolerov93@gmail.com>
2024-05-22 14:25:21 -04:00
Claudiu Zissulescu d85bb55f45 arc: libc: Add support of 16-entry register file
ARC supports a restricted register file with 16 registers.
However, optimized routines support only a full register
file. Thus, fallback on default implementation in case
of 16-entry register file.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-05-22 14:22:26 -04:00
Claudiu Zissulescu f84fed5291 arc: libgloss: Use long calls attribute for exit_halt
According to GCC documentation for ARC, a function marked with
the long_call attribute is always called using register-indirect
jump-and-link instructions, thereby enabling the called function
to be placed anywhere within the 32-bit address space.

exit_halt function is provided by crt0.S and it's used
in nsim-syscalls.c. Thus, we want to ensure that a linkage
issue will not arise.

Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
2024-05-22 14:22:06 -04:00
Dimitar Dimitrov 7d386b6dac pru: Do not define MISSING_SYSCALL_NAMES for pru
- The PRU newlib port is supposed to implement case #2 as described in
  newlib/libc/include/reent.h .  Thus drop the defining of
  MISSING_SYSCALL_NAMES.
- libgloss/configure: Regenerate.
- libgloss/libnosys/acinclude.m4: Do not define
  MISSING_SYSCALL_NAMES for pru.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-05-22 11:41:37 -04:00
Neal Frager b59c922f7c libgloss: microblaze: fix read and _write declarations
This patch resolves the following build error which occurs with gcc 14.1.0:
../../.././libgloss/microblaze/linux-outbyte.c: In function 'outbyte':
../../.././libgloss/microblaze/linux-outbyte.c:3:9: error: implicit declaration of function '_write' [-Wimplicit-function-declaration]
    3 |         _write(1, &c, 1);

Signed-off-by: Neal Frager <neal.frager@amd.com>
2024-05-14 14:28:02 -04:00
Marc 4becae7bd8 libgloss: fix read and write prototype
Use _READ_WRITE_RETURN_TYPE for read/write in libgloss/{read,write}.c to
avoid mismatching types.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-05-06 19:17:13 -04:00
Bernd Edlinger 730703bdb8 libgloss: riscv: Fix envp parameter for main
The envp paramter is currently NULL when crt0.S calls main.
With this patch the envp parameter should now be set correctly.
Tested with riscv32 and riscv64: both gdb/sim and qemu do work.
2024-04-12 11:44:07 +02:00
Corinna Vinschen 579064bf4d Cygwin: globify: read full 32 bit character
While commit 0321fb5736 ("Cygwin: glob: convert wchar_t to wint_t")
switched the entire glob mechanism from wchar_t to wint_t, the globify
function calling glob on a DOS command line did not catch up and only
checked for the next character constituting a 16 bit wchar_t. This
broke reading surrogate pairs from incoming DOS command lines if the
string had to go through glob(3).

Check for an entire 32 bit unicode char instead.

Fixes: 0321fb5736 ("Cygwin: glob: convert wchar_t to wint_t")
Reported-by: David Allsopp <david@tarides.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-09 22:30:03 +02:00
Corinna Vinschen 2855c35c41 Cygwin: fhandler_virtual::exists: always set fileid
Commit a0a25849f9 ("Cygwin: fhandler_virtual: move fileid to path_conv
member") broke `ls -l /proc/<PID>'.  Turns out, the commit forgot to set
the fileid in case of a virtual root dir (i. e., returning virt_rootdir)
in fhandlers utilizing fileid.  This crashed opendir() due to a random
fileid.

Make sure to set fileid in any case.

Fixes: a0a25849f9 ("Cygwin: fhandler_virtual: move fileid to path_conv member")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-09 17:02:35 +02:00
Corinna Vinschen 38b5139835 Cygwin: fhandler_base::fstat_by_name: improve debug output.
Since we're opening the parent dir, it doesn't make sense
to print the name of the file in debug output.  Print parent
dirname instead.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-04 18:21:13 +02:00
Corinna Vinschen 56e7563b9a Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE
If FILE_DIRECTORY_FILE is given, FILE_OPEN_NO_RECALL is not allowed,
otherwise NtCreateFile returns STATUS_INVALID_PARAMETER.

Drop FILE_OPEN_NO_RECALL where FILE_DIRECTORY_FILE is specified.

Fixes: f6b56abec1 ("Cygwin: try to avoid recalling offline files")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-04 18:21:13 +02:00
Thomas Schwinge ed50a50b9b amdgcn: Implement proper locks: Fix 'newlib/libc/sys/amdgcn/include/sys/lock.h' for C++
As of commit 7dd4eb1db9
"amdgcn: Implement proper locks", we get, by the thousands, for C++ code:

    In file included from [...]/newlib/libc/include/stdio.h:60,
                     from [...]:
    [...]/newlib/libc/include/sys/reent.h:911:1: error: expected declaration before '}' token
2024-04-04 16:01:35 +02:00
Corinna Vinschen db454e9868 Cygwin: add a fake 3.5.3 release file
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-03 19:47:58 +02:00
Corinna Vinschen a0a25849f9 Cygwin: fhandler_virtual: move fileid to path_conv member
Commit 80f722e97c ("Cygwin: opendir(3): move ENOTDIR check into main
function") introduced a bug in fhandler_virtual handling.  While the
assertion that path_conv::check() already calls exists() and sets
FILE_ATTRIBUTE_DIRECTORY accordingly, the exists() function is called
on a fhandler_virtual object created for just this code snippet.  The
side effect of this is that the fileid member in the calling
fhandler_virtual object is not set after path_conv::check().

Move the fhandler_virtual::fileid member to path_conv::_virt_fileid
and create matching path_conv::virt_fileid() and fhandler_virtual::fileid()
methods.

Let path_conv::check() propagate the fileid set in the local
fhandler_virtual::exists() call to its own  _virt_fileid.

Use new fhandler_virtual::fileid() method throughout.

Fixes: 80f722e97c ("Cygwin: opendir(3): move ENOTDIR check into main function")
Reported-by: Bruce Jerrick <bmj001@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-04-02 14:43:27 +02:00
Corinna Vinschen b7f5a33200 Cygwin: //: fetch only one item per loop
Simplify code in that it only fetches a single entry per
IEnumShellItems::Next call.  For some reason this appears to
be quicker most of the time.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-27 21:57:32 +01:00
Andrew Stubbs 7dd4eb1db9 amdgcn: Implement proper locks
This should prevent printf output from multiple threads getting garbled.

I don't know why IO ever worked properly -- probably it was always a bit
broken -- but the GFX11 devices have a different cache architecture and
trying to print from many threads at once corrupted the FILE buffers.
2024-03-25 11:32:52 +01:00
Corinna Vinschen 9761c6cca1 Cygwin: add //tsclient and //wsl$ support to relnotes
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24 20:06:13 +01:00
Corinna Vinschen 178a8fca15 Cygwin: // and //server: add support for WSL
Root dirs of WSL installations are exposed via \\wsl$.
Add support to expose \\wsl$.

While at it, check if TERMSRV and P9 provider exist before
exposing them.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24 20:02:15 +01:00
Corinna Vinschen 18b8a104ac Cygwin: dir_cache::add: constify input string
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24 19:40:36 +01:00
Corinna Vinschen b95ab5982e Cygwin: fhandler_netdrive: use WNNC_NET_SMB instead of WNNC_NET_LANMAN
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-24 19:39:49 +01:00
Corinna Vinschen cc74a38d4a Cygwin: //tsclient: allow to enumerate shares
The //tsclient provider is WNNC_NET_TERMSRV.

Fixes: 7db1c6fc4e ("Cygwin: //server: revert to using WNet and support NFS shares")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-23 23:54:26 +01:00
Corinna Vinschen 7db1c6fc4e Cygwin: //server: revert to using WNet and support NFS shares
Continue using WSD for enumerating //, but switch back to
WNet for enumerating shares.

Add trying to enumerate NFS shares for machine names given as FQDN.

Only downcase server names, keep case of shares intact.
Move downcasing into dir_cache class.

Add a comment to explain an extrem weirdness in Windows.

Fixes: 205190a80b ("Cygwin: // and //server: switch to Network Discovery")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-23 22:32:42 +01:00
Corinna Vinschen 8d2c1b4ce6 Cygwin: //server: check existence of server with getaddrinfo
Checking server existence by trying to enumerate its shares
may result in 2 minutes delay until some internal timeout is hit.

In the light that every network is an IP network anyway these
days, let's try with a simple getaddrinfo() call.  This is usually
back in 3 secs even if the server doesn't exist, and it's usually
back in 8 secs if the DNS server can't be connected.  This is the
fastest method I found to check server existence yet.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-22 15:34:29 +01:00
Corinna Vinschen 290843bbda Cygwin: utils: refresh tzmap.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21 21:45:26 +01:00
Corinna Vinschen 2c67eeb233 Cygwin: tzmap-from-unicode.org: drop "E. Europe Standard Time" default
E. Europe Standard Time is available in the unicode.org windowsZones.xml
file, so we can drop the default handling.

Fix a few comments.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21 21:45:26 +01:00
Corinna Vinschen ace936b707 Cygwin: tzset(1): use GetDynamicTimeZoneInformation
Use official GetDynamicTimeZoneInformation() function instead of
scanning the registry for the timezone keyname.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21 21:44:57 +01:00
Corinna Vinschen 4c4e6d67d4 Cygwin: fix tzmap-from-unicode.org
The previous change introduced a missing end of comment

Fixes: 60ea9c1c4b ("Cygwin: tzmap-from-unicode.org: drop support for Vista/2008")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-21 21:22:49 +01:00
Corinna Vinschen 8e12860944 Cygwin: utils: refresh tzmap.h
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 23:00:02 +01:00
Corinna Vinschen 60ea9c1c4b Cygwin: tzmap-from-unicode.org: drop support for Vista/2008
Commit b794f2c603 ("Cygwin: drop support for systems not supporting
RFC 4646 locales") erroneously changed tzmap.h manually.  Change
the script accordingly.

Fixes: b794f2c603 ("Cygwin: drop support for systems not supporting RFC 4646 locales")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 22:59:37 +01:00
Corinna Vinschen b9ed33dec0 Cygwin: readdir: drop support for NT4/Win2K shares and Samba < 3.0.22
These systems are at least 18 years old and so buggy that they are
hopefully not used anymore.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 17:45:41 +01:00
Corinna Vinschen 8bd6ba8f16 Cygwin: /proc: fix mem leak in opendir in error case
Fixes: 1f08558f14 ("* fhandler.h (fhandler_proc::opendir): Declare.")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 14:48:55 +01:00
Corinna Vinschen 205190a80b Cygwin: // and //server: switch to Network Discovery
SMBv1 is ultimately deprecated since Novemer 2023.  It's also
not installed by default on latest Windows versions.

Drop using the WNet (SMBv1) API in favor of using Network Discovery.
Given there's no documented Win32 API for that, the code now uses
the Shell API.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 14:46:49 +01:00
Corinna Vinschen 80f722e97c Cygwin: opendir(3): move ENOTDIR check into main function
So far the check for a directory is in the fhandler::opendir
methods. Given that path_conv::check sets FILE_ATTRIBUTE_DIRECTORY
on virtual files either, we can move the check up into the
opendir(3) function. This avoids calling exists() twice when
calling opendir(3).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 12:34:51 +01:00
Corinna Vinschen 1719169604 Cygwin: (mostly) drop NT4 and Samba < 3.0 support
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-20 12:31:50 +01:00
Corinna Vinschen 14970f2645 Cygwin: dirent.h: fix a comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-19 23:21:35 +01:00
Corinna Vinschen d06113bf8b Cygwin: readdir(3): stop support for pre-Cygwin 1.5.0 apps
We're filling dirent::__d_internal1 with the inode number to
support apps built under Cygwin 1.3 and earlier.  This doesn't
make sense anymore.  Drop this to free up __d_internal1 for
other TBD use.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-19 16:22:40 +01:00
Brian Inglis bfe2790e7b winsup/cygwin/fhandler/proc.cc: format_proc_cpuinfo() Linux 6.8 cpuinfo flags
add Linux 6.8 cpuinfo flags:
Intel 0x00000007:1 eax:17 fred		Flexible Return and Event Delivery;
AMD   0x8000001f   eax:4  sev_snp	SEV secure nested paging;
document unused and some unprinted bits that could look like omissions;
fix typos and misalignments;

Signed-off-by: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
2024-03-18 16:33:56 +01:00
Corinna Vinschen 89afbb8d8a Revert "Cygwin: glob: perform ignore_case_with_glob on input"
This reverts commit a51147467e.

Dumb thinko on my part.  What was supposed to be an optimization
actually broke caseinsensitive globbing in that the entire input
of globbed expressions were downcased.

Drop the unused CCHAR() macro nevertheless.

Fixes: a51147467e ("Cygwin: glob: perform ignore_case_with_glob on input")
Reported-by: Michael Goldshteyn <mgold10000@gmail.com>
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-18 11:10:13 +01:00
Joel Sherrill 176b19fbe5 libc/include/sys/select.h: Use elif not elifdef
The cpp directive "elifdef" is only available in very recent GCC versions.
This should be able to compile on older toolchains in C99 mode.`
2024-03-13 09:29:36 -05:00
Chris Johns 8d38c37ed9 RTEMS: Increase FS_SETSIZE to 256 bits 2024-03-13 08:59:24 -05:00
Takashi Yano fc691d0246 Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.
If pipe reader is a non-cygwin app first, and cygwin process reads
the same pipe after that, the pipe has been set to bclocking mode
for the cygwin app. However, the commit 9e4d308cd5 assumes the
pipe for cygwin process always is non-blocking mode. With this patch,
the pipe mode is reset to non-blocking when cygwin app is started.

Addresses: https://cygwin.com/pipermail/cygwin/2024-March/255644.html
Fixes: 9e4d308cd5 ("Cygwin: pipe: Adopt FILE_SYNCHRONOUS_IO_NONALERT flag for read pipe.")
Reported-by: wh <wh9692@protonmail.com>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-03-12 10:17:40 +09:00
Corinna Vinschen 3af5d2bbdd Cygwin: 3.6.0: add release entries for pinned/unpinned flag handling
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-11 12:53:50 +01:00
Corinna Vinschen 775069553b Cygwin: add 3.5.2 release entries for latest commits
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2024-03-11 12:53:24 +01:00