| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Message-Id: <20230517181150.65810-1-bugaevc@gmail.com>
|
|
|
|
|
|
| |
We are checking for the existence of time_value64_t but we didn't add
that to the task_thread_times_info structure.
Message-Id: <ZGRDbS0XIm1fJwkG@jupiter.tail36e24.ts.net>
|
|
|
|
|
| |
Fixes 31dd30a94a682955c3c9e2f42252b4a07687067a "add setting gs/fsbase".
Message-Id: <20230515074434.1351060-1-bugaevc@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
...like it's already done when exiting a trap. This is required, since
handing a syscall can result in an AST; in particular this happens when
the current thread is being terminated, which sets AST_TERMINATE and
expects the thread to never return to userspace.
Fixes a kernel crash upon calling exit () or pthread_exit () in glibc.
Message-Id: <20230511192859.890693-1-bugaevc@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 31dd30a94a682955c3c9e2f42252b4a07687067a "add setting gs/fsbase"
added the code to set fs and gs bases on context_switch. However, this
was only being done when switching context via the explicit
switch_context() method, but not in other cases where the context is
switched, such as with call_continuation().
Instead, put setting fsgs base into switch_ktss(), where it will be
called in all cases.
Message-Id: <20230511135844.837338-1-bugaevc@gmail.com>
|
|
|
|
| |
So that userland's uname -m still reports i686-AT386.
|
| |
|
|
|
|
|
|
|
| |
We can fast track the simplification of the RPC ABI for x86_64 if we don't have
MACH_MSG_TYPE_STRING used in RPCs which forces msgt_size to use more than 8
bits.
Message-Id: <ZFht+/9cVPHuV90D@jupiter.tail36e24.ts.net>
|
|
|
|
|
| |
File is unused.
Message-Id: <ZFSSbAzZ+7KYKtOF@jupiter.tail36e24.ts.net>
|
| |
|
|
|
|
|
| |
msgt_deallocate was not initialized explicitly, this fixes that too.
Message-Id: <ZFM2cLr1Ms/B3v8U@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <ZFMz+B3dsMAWl3hM@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <ZFLq5/a9zzRHOlSf@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In case the kernel interfaces use dynamically sized strings, we will
end up calling mig_deallocate to free the out of line string that was copied
into the kernel. As a matter of contract such type of data is freed
automatically either in kernel code when the RPC fails or in the MiG
stub if it succeeds.
This was tested by changing task_set_name to use dynamic strings and making
sure out of line data is passed when strlen(name) > 4.
Message-Id: <ZFB64/0vOJ3x15ub@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
| |
* include/mach/mig_support.h: Drop the ifndef because this file is only
used internally to compile gnumach. We export mig_support.h from glibc
already.
* kern/ipc_mig.c: len should be vm_size_t.
* kern/ipc_mig.h: Drop duplicate prototypes.
Message-Id: <ZFBjEk07CaQgx9Ru@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
| |
* i386/i386/i386asm.sym: add offsets for asm
* i386/i386/pcb.c: switch FSBASE/GSBASE on context switch and
implement accessors in thread setstatus/getstatus
* i386/i386/thread.h: add new state to thread saved state
* kern/thread.c: add i386_FSGS_BASE_STATE handler
* x86_64/locore.S: fix fs/gs handling, skipping the base address and
avoid resetting it by manually re-loading fs/gs
Message-Id: <20230419194703.410575-5-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While theoretically we could still use the same call gate as for
32-bit userspace, it doesn't seem very common, and gcc seems to not
encode properly the instruction. Instead we use syscall/sysret as
other kernels (e.g. XNU,Linux). This version still has some
limitations, but should be enough to start working on the 64-bit user
space.
* i386/i386/i386asm.sym: add more constants to fill pcb->iss
* i386/i386/ldt.c: configure 64-bit syscall entry point. We can just
check for the SEP bit as MSR are always available on x86_64.
* i386/i386/ldt.h: swap CS/DS segments order if !USER32 as required by
sysret
* i386/i386/locore.h: add syscall64 prototype
* i386/i386/msr.h: add MSR definitions and C read/write helpers
* i386/include/mach/i386/syscall_sw.h: remove old BSD_TRAP
* x86_64/Makefrag.am: selectively install syscall_sw.h depending on
USER32
* x86_64/include/syscall_sw.h: add entry point template from user
space
* x86_64/locore.S: implement syscall64 entry point and use it when a
64-bit user-space is configured
Message-Id: <20230419194703.410575-4-luca@orpolo.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Added device_open_new and device_open_new_request and reused the old MiG
ID for xxx_device_set_status which has not been in used in the past
decade.
Note that device_open_new is gated on defining
DEVICE_ENABLE_DEVICE_OPEN_NEW because otherwise some hurd servers
wouldn't compile anymore unless patched. This macro allows us to control
the rollout.
Message-Id: <ZEi1LV+9ShuXqtcr@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
| |
RPCs remain compatible with existing clients but if they know about the
new size then we will populate the new fields.
Message-Id: <ZDzPLCJccKeRB5Pd@mars.tail36e24.ts.net>
|
|
|
|
|
| |
* x86_64/copy_user.c: use the correct user/kernel msg structure
Message-Id: <20230419194703.410575-2-luca@orpolo.org>
|
|
|
|
|
|
| |
* x86_64/locore.S: the faulty address is found in %rbp and not in
%rsi, so copy that in CR2
Message-Id: <20230419194703.410575-1-luca@orpolo.org>
|
| |
|
| |
|
|
|
|
|
| |
Not used.
Message-Id: <ZDN13tll1jYc1jYh@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
| |
host_get_kernel_boot_info was added recently to fix the use of
MACH_MSG_TYPE_STRING.
Message-Id: <ZC5Sz8a4FCT6IjCY@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
| |
* i386/i386/thread.h: Define USER_STACK_ALIGN which is 16-byte for 64 bit
programs as recommended by the System V AMD64 guidelines. Also define
KERNEL_STACK_ALIGN which can differ from user land.
* i386/i386/pcb.c: Use USER_STACK_ALIGN to align the bootstrap arguments and
ultimately the stack where the program starts on.
* kern/bootstrap.c: Do not align arg_len here since it will be aligned
in set_user_regs.
Message-Id: <ZCpOb6vNEfPclKPr@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
| |
On EXC_BAD_ACCESS, exception subcode is used to pass the faulting memory
address, so it needs to be (at least) pointer-sized. Thus, make it into
a long.
This requires matching changes in glibc and the Hurd.
Message-Id: <20230319151017.531737-4-bugaevc@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
As far as I can see, this file was imported in the very beginning of GNU Mach
history, and unused since then. Nobody implements or uses this interface. GNU
Mach uses a different way to pass the privileged ports to the bootstrap tasks:
instead of the task(s) actively asking for the ports in an RPC, the ports are
preemptively inserted into the IPC space(s) of the task(s), as configured by
the boot script.
Remove bootstrap.defs so as to not confuse anyone into thinking it works.
Message-Id: <20230319151017.531737-3-bugaevc@gmail.com>
|
|
|
|
| |
Message-Id: <20230319151017.531737-2-bugaevc@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
As mentioned in 5447f965, the c_string type correctly uses
msgt_size/msgt_number, resulting in a more compact ABI that doesn't
require mach_msg_type_long_t.
I redefined host_load_symbol_table with a new Id since this is just a
debug RPC and is not used anywhere.
Message-Id: <ZBFgyJp+Pcb7zFhf@mars.tail36e24.ts.net>
|
| |
|
|
|
|
|
|
|
|
| |
Changed kern/timer.c to use the higher precision time_value64_t.
Of course, this won't suffer from the 2038 overflow but it does provide
nanosecond precision (if gnumach ever uses a better timer) and
moves us closer to only having time_value64_t.
Message-Id: <ZA63tGcv3bETUJFJ@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <ZA64CbpYEz+BgiEw@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The existing definitions for kernel_version_t and kernel_boot_info_t use
(MACH_MSG_TYPE_STRING, length*8) which result in message types that have
a single element of 512 or 4096 bytes (set as msgt_size). This results
in MiG generating mach_msg_type_long_t. Using c_string has the benefit
of moving this size to be defined as msgt_number which doesn't overflow.
This will allow us to simplify the 64 bit RPC ABI since all msgt_size can
be defined with just 8 bits (as it should be expected).
The resulting implementation is the same but we still need to define new
RPCs since server and user expect different mach_msg_type_t.
Message-Id: <ZA63pS8j9J6NwuXY@jupiter.tail36e24.ts.net>
|
|
|
|
| |
Message-Id: <ZAzYoE7+ugFsH5JA@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
|
| |
hz variable is the number of mach ticks in 1 second.
We want to know how many lapic ticks in 1 mach tick.
Therefore, we set a timer for 10 mach ticks and divide
the lapic stopwatch counter value by 10.
Message-Id: <20230311072937.450161-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
uintptr_t.
With this change, any 64 bit code using the IPC subsystem without relying on
MiG will work without any changes. We have a few examples of this inside gnumach but
also in the Hurd servers. For example, in hurd/console/display.c
typedef struct
{
mach_msg_header_t Head;
mach_msg_type_t ticknoType;
natural_t tickno;
mach_msg_type_t changeType;
file_changed_type_t change;
mach_msg_type_t startType;
loff_t start;
mach_msg_type_t endType;
loff_t end;
} Request;
This will now work correctly in 64 bits, without requiring any explicit padding.
As a follow up, we can simplify mach_msg_type_long_t so that we
only need an 8 byte structure where the second field will include the
number of elements for the long form. This is already included in
mach_msg_type_t as unused_msgtl_number.
Message-Id: <ZAbhOfOzsb8qPFs6@jupiter.tail36e24.ts.net>
|
| |
|
|
|
|
|
|
|
|
| |
TESTED:
- by setting MACH_LOCK_MON to 1 in configfrag.ac
and running "show all slocks" in kdb
- does not break default configured kernel
Message-Id: <20230306070512.292715-1-damien@zamaudio.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Previously the lapic timer was calibrated by one-shot PIT timer2.
This method can be buggy and generally unused in emulation environments.
This patch reworks the timer calibration to use a mach timer based
on regular PIT interrupts to remapped IOAPIC pin.
This also changes the primary clock source to use PIT timer0 remapped
to an IOAPIC pin when APIC mode is enabled, instead of a periodic lapic
timer.
Message-Id: <20230306070452.292697-1-damien@zamaudio.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We introduce both a user alignment and a kernel alignment. These are
separate requirements since for 64 bit with a 32 bit kernel we need to
ensure the kernel can consume messages that are 8-byte aligned. This
change removes any possibility of undefined behavior and also allows the
kernel to support 64 bit RPCs for the userland.
A lot of the code that performs alignment was simplified under the
assumption that the message headers are well aligned. To enforce that
going forward, a few static assertions were added.
Message-Id: <Y/KrixiC9Njmu7ef@jupiter.tail36e24.ts.net>
|
|
|
|
|
|
|
| |
* i386/i386/locore.h: user vm_offset_t in the recovery_table
* x86_64/locore.S: fix RECOVERY() location and keep user regs in %rbx,
as it seems the convention. This only applies to 32-bit userspace.
Message-Id: <20230227204501.2492152-5-luca@orpolo.org>
|
|
|
|
|
|
|
| |
* x86_64/copy_user.c: in mach_msg_user_header_t there are some holes
that need to be cleared, to adapt to the different layout of
mach_msg_header_t.
Message-Id: <20230227204501.2492152-4-luca@orpolo.org>
|
|
|
|
|
|
| |
* x86_64/copy_user.c: fix copyin/out, we already have a pointer to
user/kernel buffers
Message-Id: <20230227204501.2492152-3-luca@orpolo.org>
|
|
|
|
|
|
| |
* i386/intel/pmap.c: remove #error and allow compilation, keeping a
reminder to fix the pmap module.
Message-Id: <20230227204501.2492152-2-luca@orpolo.org>
|
|
|
|
|
|
| |
NB: This relies on a fix for QEMU as one-shot PIT mode
is currently broken in qemu.
Message-Id: <20230226013110.50606-1-damien@zamaudio.com>
|
|
|
|
|
|
| |
All PC compatibles operate the PIT at a clock rate of (105/88) MHz
Message-Id: <20230226063555.66284-1-damien@zamaudio.com>
|
|
|
|
| |
Message-Id: <20230226013052.50577-1-damien@zamaudio.com>
|
|
|
|
|
|
| |
TESTED: With and without apic/smp
Message-Id: <20230225061420.16985-1-damien@zamaudio.com>
|