Commit Graph

1188 Commits

Author SHA1 Message Date
Jeremy Soller
9ea278997c Disable threaded syscalls until threaded allocation issues are solved 2021-10-20 20:05:47 -06:00
Jeremy Soller
64f1533d6f Implement anonymous fmap 2021-09-22 21:04:04 -06:00
Jeremy Soller
17309754d6 Merge branch 'no-more-recursive-mapping' into 'master'
No more recursive mapping

See merge request redox-os/kernel!187
2021-08-13 02:13:07 +00:00
4lDO2
307fcf3ad7 Remove now unused TLS struct. 2021-08-11 17:46:40 +02:00
4lDO2
d6e1797620 Make Mapper::map fallible. 2021-08-11 17:46:40 +02:00
4lDO2
df145ea0a9 Utilize linear_phys_to_virt where applicable. 2021-08-11 17:46:40 +02:00
4lDO2
16a31b0cd1 Add linear_phys_to_virt and vice versa.
However, since not all platforms will allow the entire physical address
space to be simultaneously mapped to part of the virtual address space,
we may still require some dynamic mapping.
2021-08-11 17:46:40 +02:00
4lDO2
5f4978a6dc Return ENOMEM rather than panicking for PML4 alloc. 2021-08-11 17:46:40 +02:00
4lDO2
67cc6799bd Fix possible UB by checking for null allocating FX.
Namely, the global allocator API in Rust, actually only returns a null
pointer on failure, rather than wrapping it in a Result, which AllocRef
does. Since Box::from_raw(null) is direct UB, this can in theory lead to
very strange behavior.
2021-08-11 17:46:40 +02:00
4lDO2
465c461b60 WIP: Stop using recursive mapping.
Note that this is very preliminary, and I merely got my already freezing
kernel branch not to triple fault, but I would probably apply this patch
to upstream.

What is changed here, is that rather than relying on recursive mapping
for accessing page table frames, it now uses linear translation
(virt=phys+KERNEL_OFFSET). The only problem is that the paging code now
makes assumptions that the entire physical address space remains mapped,
which is not necessarily the case on x86_64 architecturally, even though
systems with RAM more than a PML4 are very rare. We'd probably lazily
(but linearly) map physical address space using huge pages.
2021-08-11 17:46:33 +02:00
Jeremy Soller
0c3542ff51 Store funmap data with the context's grants 2021-08-10 20:46:30 -06:00
Jeremy Soller
f94dc3beb8 Allow current process to access its own proc data 2021-08-10 16:33:49 -06:00
Jeremy Soller
0b1445f8bd Merge branch 'fix_interrupt_handlers' into 'master'
Fix TLS in paranoid interrupt handlers

See merge request redox-os/kernel!186
2021-08-09 21:19:39 +00:00
4lDO2
1a80351a2c Fix TLS in paranoid entries. 2021-08-09 14:25:15 +02:00
4lDO2
41d5a2a786 Use naked functions in syscall inst handler too. 2021-08-06 18:08:04 +02:00
4lDO2
d7a1c6255b Fix possible race condition in paranoid ISRs.
Additionally, because it turned out to be infeasible to rely on
link-time constants in global_asm! code, I have also converted the
interrupt handlers to naked fns. This removes the proc-macro-reliant
"paste" dependency, but inserts a tiny ud2 at the end of every ISR.
2021-08-06 17:34:56 +02:00
4lDO2
1047728f35 Only set process regs for faults from ring 3.
This fixes a deadlock that might occur if a page fault is triggered
while a lock to the current context is held.
2021-08-06 15:41:38 +02:00
4lDO2
862265f150 Merge branch 'fsgsbase' into 'master'
FSGSBASE and user-controlled TLS

See merge request redox-os/kernel!185
2021-08-06 13:22:45 +00:00
4lDO2
25a82eeb1b Update syscall again. 2021-08-06 15:09:32 +02:00
4lDO2
57a1e37535 Update syscall. 2021-08-06 14:46:47 +02:00
4lDO2
87241a9d3c Pass AT_PHDR via a grant rather than the stack. 2021-08-01 14:57:41 +02:00
4lDO2
3eedbeb14d WIP: Let userspace manage fsbase/gsbase and TLS. 2021-08-01 12:09:22 +02:00
4lDO2
0968e4f87e Support fsgsbase at compile time. 2021-07-31 10:12:59 +02:00
Jeremy Soller
9c3cf84453 Merge branch 'futex_wait64' into 'master'
Add support for full 64-bit futex words

See merge request redox-os/kernel!183
2021-07-11 22:14:10 +00:00
4lDO2
6993c98e0f Update rmm and syscall. 2021-07-12 00:10:48 +02:00
4lDO2
bbe6b4650a Futex: check for lower-half addrs manually. 2021-07-08 16:08:02 +02:00
4lDO2
bcfd7b175e Update rmm. 2021-07-08 13:47:16 +02:00
4lDO2
9e9d025bb5 Add support for FUTEX_WAIT64. 2021-07-08 13:28:46 +02:00
Jeremy Soller
b973c5db95 Merge branch 'dont-hardcode-reg-offsets' into 'master'
Use offset_of! in context::arch::switch_to.

See merge request redox-os/kernel!180
2021-06-21 19:06:56 +00:00
4lDO2
3e5cf387d5 Use offset_of! in context::arch::switch_to.
This is definitely better than hardcoding the offsets!
2021-06-21 10:16:41 +02:00
4lDO2
6039026349 Merge branch 'update_toolchain' into 'master'
Update toolchain

See merge request redox-os/kernel!179
2021-06-18 15:15:15 +00:00
4lDO2
ecfcedb9bf Remove explicit .intel_syntax directive.
It is now default, and the new compiler generated a lot of warnings now
that Intel syntax has (luckily) become the default.
2021-06-18 09:20:13 +02:00
4lDO2
1cf5f5ea22 Update dependencies to work with latest nightly. 2021-06-17 22:42:54 +02:00
4lDO2
2dc899dc3b Update paste and align interrupt handlers. 2021-06-17 22:42:50 +02:00
4lDO2
7594dd60d2 Remove compare_and_swap from int_like!. 2021-06-17 22:42:44 +02:00
4lDO2
7d4defa5e5 Use weak CAS and use abort() in context::switch.
Previously context::switch used compare_and_swap for acquiring the
global context switch lock, but given its deprecation in more recent
Rust versions, it has been replaced with compare_exchange_weak (which
can be further optimized on some architectures).

It also replaces panic!() with abort() in switch_finish_hook, because
unwinding from assembly is not that fun.
2021-06-17 22:42:38 +02:00
4lDO2
cc6f792a03 Use options(noreturn) in all naked functions. 2021-06-17 22:42:31 +02:00
4lDO2
dc5f1fe055 Update toolchain. 2021-06-17 22:42:23 +02:00
Jeremy Soller
d3cf4db47b Prerequisites for risv64 support 2021-05-12 20:23:53 -06:00
Jeremy Soller
0a79c17307 Show meaning of CODE on page fault 2021-05-10 11:34:14 -06:00
Jeremy Soller
8130e4752b Map TSS using RMM 2021-05-07 09:13:25 -06:00
Jeremy Soller
77f6887fbc Debug use of memory map and env data 2021-05-07 08:54:36 -06:00
Jeremy Soller
38f7884e21 Improvements for aarch64 serial driver on real hardware 2021-05-06 21:25:15 -06:00
Jeremy Soller
2c474f98f9 Merge branch 'higher_half_percpu' into 'master'
Put the KPCRs in high memory, in their own PML4.

See merge request redox-os/kernel!173
2021-05-06 19:25:16 +00:00
4lDO2
36b3a4a49e Add KERNEL_PERCPU_PML4 on AArch64. 2021-05-06 21:22:48 +02:00
4lDO2
558109a9cb Put the KPCRs in high memory, in their own PML4.
This also removes the need to do another semi-expensive remap when
cloning processes, since the KPCRs (for kernel TLS) are no longer stored
in the user PML4.
2021-05-06 21:21:37 +02:00
Jeremy Soller
2e38fab913 Do not hardcode aarch64 uart 2021-05-06 13:16:50 -06:00
Jeremy Soller
c4617c0bce Merge branch 'outsource-most-acpi' into 'master'
Move most of ACPI to userspace

See merge request redox-os/kernel!175
2021-05-06 18:36:06 +00:00
4lDO2
3eacbdda2a Remove unnecessary exit() diff. 2021-05-06 19:49:58 +02:00
4lDO2
fd97fa80bb Move pid back to inner scope in exit() handler. 2021-05-06 19:49:58 +02:00