aboutsummaryrefslogtreecommitdiff
path: root/i386/intel
Commit message (Collapse)AuthorAgeFilesLines
* fix a compiler warning.jbranso@dismail.de2024-10-211-0/+4
| | | | | | | | | | | | | | * i386/intel/pmap.c (pmap_page_table_page_dealloc): define it only on the Xen platform. Best not to delete page_alloc, so we know how to do so if need be. i386/intel/pmap.c:1265:1: warning: 'pmap_page_table_page_dealloc' defined but not used [-Wunused-function] 1265 | pmap_page_table_page_dealloc(vm_offset_t pa) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ i386/intel/pmap.c:1171:1: warning: 'pmap_page_table_page_alloc' defined but not used [-Wunused-function] 1171 | pmap_page_table_page_alloc(void) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ Message-ID: <20241020190744.2522-3-jbranso@dismail.de>
* pmap: Avoid leaking USER bit in page tablesSamuel Thibault2024-03-031-5/+6
| | | | | | | | | | We should only set USER - for user processes maps - for 32bit Xen support This was not actually posing problem since in 32bit segmentation protects us, and in 64bit the l4 entry for the kernel is already set. But better be safe than sorry.
* spl: Introduce assert_splvm and use it in process_pmap_updatesSamuel Thibault2024-02-231-0/+1
| | | | Suggested-by: Damien Zammit <damien@zamaudio.com>
* vm_map_lookup: Add parameter for keeping map lockedDamien Zammit2024-02-221-2/+2
| | | | | | | | | | | This adds a parameter called keep_map_locked to vm_map_lookup() that allows the function to return with the map locked. This is to prepare for fixing a bug with gsync where the map is locked twice by mistake. Co-Authored-By: Sergey Bugaev <bugaevc@gmail.com> Message-ID: <20240222082410.422869-3-damien@zamaudio.com>
* process_pmap_updates: Use _nocheck form of lock, already at splvmDamien Zammit2024-02-191-2/+5
|
* Fix non-PAE buildSamuel Thibault2023-10-021-1/+1
|
* pmap: Factorize l4 base accessSamuel Thibault2023-10-011-2/+5
| | | | This also makes the code more coherent with other levels.
* ddb: Add whatis commandSamuel Thibault2023-10-011-0/+100
| | | | This is convenient when tracking buffer overflows
* pmap_phys_address: Fix castingSamuel Thibault2023-08-281-1/+1
| | | | | We need to extend the frame number to 64bit before converting to address.
* pmap: Fix spurious pte release on 64bit and PAESamuel Thibault2023-08-281-2/+2
|
* pmap: Add missing declarationSamuel Thibault2023-08-141-0/+3
|
* pmap+slab: Add more smoketestsSamuel Thibault2023-08-141-4/+8
| | | | | Checking the range of addresses for operations on the kernel_pmap is quite cheap, and allows to catch oddities quite early enough.
* pmap: Fix mayhem when releasing near the end of virtual memorySamuel Thibault2023-08-141-2/+2
| | | | | | l is used to skip over the area mapped by a whole pde. It was clipped to e, but if e is already near the end of virtual memory, l will wrap-around to 0, and mayhem entails.
* pmap: Add MAPWINDOW_SIZE macroSamuel Thibault2023-08-141-3/+4
|
* pmap: reserve last virtual pageSamuel Thibault2023-08-141-2/+2
| | | | So as to catch trying to dereference -1
* pmap: Add more debugging information when getting a null pv_listSamuel Thibault2023-08-141-1/+1
|
* pmap: Fix x32 PAE buildsSamuel Thibault2023-08-141-1/+2
|
* pmap: Fix coping with VM_MAX_USER_ADDRESS not being aligned on l4 limitSamuel Thibault2023-08-141-2/+4
| | | | It is however usually aligned on l3 limit.
* x86_64: Fix memory leak on pmap destructionSamuel Thibault2023-08-141-4/+7
| | | | | | We do need to go through the whole page table, to release the pdpt-s and pdet-s that map the kernel. Only the ptpt-s that map the kernel are shared between tasks.
* pmap: Make pmap_protect sparse-pde awareSamuel Thibault2023-08-121-4/+3
| | | | | | 222020cff440 ("pmap: dynamically allocate the whole user page tree map") made the pde array sparse, but missed updating pmap_protect accordingly: we have to re-lookup for the pde on each PDE_MAPPED_SIZE section.
* pmap: Add missing PMAP_READ_LOCK fixes uninitialized splDamien Zammit2023-08-061-0/+1
| | | | Message-Id: <20230805154913.2003121-1-damien@zamaudio.com>
* pmap: only map lower BIOS memory 1:1 when using Linux driversLuca Dariz2023-05-261-0/+9
| | | | | | | | | * i386/intel/pmap.c: add the check for LINUX_DEV; we could also check for !__x86_64__, as this config would break ther kernel map by removing the BIOS mem map, needed by the console and keyboard drivers, but hopefully we won't need to enable Linux drivers on x86_64. Message-Id: <20230526184801.753581-2-luca@orpolo.org>
* xen: Fix 64bit buildSamuel Thibault2023-05-261-2/+8
|
* pmap: Simplify codeSamuel Thibault2023-05-211-25/+21
| | | | Notably, ptes_per_vm_page is meaninful for the pte level anyway.
* pmap: dynamically allocate the whole user page tree mapLuca Dariz2023-05-212-288/+277
| | | | | | | | | | | | * i386/intel/pmap.c: switch to dynamic allocation of all the page tree map levels for the user-space address range, using a separate kmem cache for each level. This allows to extend the usable memory space on x86_64 to use more than one L3 page for user space. The kernel address map is left untouched for now as it needs a different initialization. * i386/intel/pmap.h: remove hardcoded user pages and add macro to recontruct the page-to-virtual mapping Message-Id: <20230521085758.365640-1-luca@orpolo.org>
* Fix Xen buildSamuel Thibault2023-04-111-9/+9
|
* x86_64: allow compilation if ! USER32Luca Dariz2023-02-271-2/+4
| | | | | | * 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>
* x86_64: fix some compiler warningsLuca Dariz2023-02-161-5/+3
| | | | | | | * i386/include/mach/i386/vm_param.h: extend the vm constants to ULL on x86_64 to avoid a shift overflow warning * i386/intel/pmap.c: fix cast and unused variables Message-Id: <20230216213318.2048699-1-luca@orpolo.org>
* pmap: Make mapwindow per CPUSamuel Thibault2023-02-152-12/+8
| | | | | | They are used temporarily without CPU exchanges, and may need to be used concurrently so 2 slots only would not be enough anyway. This also saves having to lock for them.
* smp: Fix more busy loopsSamuel Thibault2023-02-151-3/+3
| | | | | We need to avoid the kernel optimizing away the reads from memory. Use a standard relaxing instruction for that.
* pmap: Do not TLB shootdown IPI for mapwindow updatesSamuel Thibault2023-02-151-1/+2
| | | | | | These are used only temporarily by the current processor only, so we don't need to notify other processors about them. We however then should flush TLB at allocation, to make sure we don't have some remnant.
* pmap: Fix busy loop waiting for pmap usersSamuel Thibault2023-02-151-1/+1
| | | | | We need to avoid the kernel optimizing away the read from pmap->cpus_using. Use a standard relaxing instruction for that.
* pmap: Do not send TLB flush IPI when a cpu is idleSamuel Thibault2023-02-152-1/+3
| | | | | | | MARK_CPU_ACTIVE already knows to flush TLB when a cpu comes out of idle. However, add memory barriers to be sure that setting cpu_update_needed is seen before testing for cpus_idle.
* Fix warningSamuel Thibault2023-02-141-2/+2
|
* Remove verbose debug printfsDamien Zammit2023-02-141-1/+0
| | | | Message-Id: <20230213084919.1157074-5-damien@zamaudio.com>
* pmap: Signal cpu for TLB update if kernel_pmapDamien Zammit2023-02-131-1/+1
| | | | Message-Id: <20230213084919.1157074-3-damien@zamaudio.com>
* move kernel virtual address space to upper addressesLuca Dariz2023-02-121-2/+10
| | | | | | | | | | | | | | | | | | * i386/i386/vm_param.h: adjust constants to the new kernel map - the boothdr.S code already sets up a temporary map to higher addresses, so we can use INIT_VM_MIN_KERNEL_ADDRESS as in xen - increase the kernel map size to accomodate for bigger structures and more memory - adjust kernel max address and directmap limit * i386/i386at/biosmem.c: enable directmap check also on x86_64 * i386/include/mach/i386/vm_param.h: increase user virtual memory limit as it's not conflicting with the kernel's anymore * i386/intel/pmap.h: adjust lin2pdenum_cont() and INTEL_PTE_PFN to the new kernel map * x86_64/Makefrag.am: change KERNEL_MAP_BASE to be above 4G, and according to mcmodel=kernel. This will allow to use the full memory address space. Message-Id: <20230212172818.1511405-10-luca@orpolo.org>
* separate initialization of kernel and user PTP tablesLuca Dariz2023-02-122-19/+51
| | | | | | | | | | | | | * i386/i386/vm_param.h: temporariliy fix kernel upper address * i386/intel/pmap.c: split kernel and user L3 map initialization. For simplicity in handling the different configurations, on 32-bit (+PAE) the name PDPNUM_KERNEL is used in place of PDPNUM, while only on x86_64 the PDPNUM_USER and PDPNUM_KERNEL are treated differently. Also, change iterating over PTP tables in case the kernel map is not right after the user map. * i386/intel/pmap.h: define PDPNUM_USER and PDPNUM_KERNEL and move PDPSHIFT to simplify ifdefs. Message-Id: <20230212172818.1511405-9-luca@orpolo.org>
* add more explicit names for user space virtual space limitsLuca Dariz2023-02-121-9/+9
| | | | | | | | | | * i386/i386/vm_param.h: add VM_MAX/MIN_USER_ADDRESS to kernel headers. * i386/i386/db_interface.c * i386/i386/ldt.c * i386/i386/pcb.c * i386/intel/pmap.c * kern/task.c: replace VM_MAX/MIN_ADDRESS with VM_MAX/MIN_USER_ADDRESS Message-Id: <20230212172818.1511405-7-luca@orpolo.org>
* use L4 page table directly on x86_64 instead of short-circuiting to pdpbaseLuca Dariz2023-02-122-26/+78
| | | | | | | | | | | This is a preparation to run the kernel on high addresses, where the user vm region and the kernel vm region will use different L3 page tables. * i386/intel/pmap.c: on x86_64, retrieve the value of pdpbase from the L4 table, and add the pmap_pdp() helper (useful also for PAE). * i386/intel/pmap.h: remove pdpbase on x86_64. Message-Id: <20230212172818.1511405-6-luca@orpolo.org>
* factor out PAE-specific bootstrapLuca Dariz2023-02-121-32/+40
| | | | | * i386/intel/pmap.c: move it to pmap_bootstrap_pae() Message-Id: <20230212172818.1511405-5-luca@orpolo.org>
* factor out xen-specific bootstrapLuca Dariz2023-02-121-51/+56
| | | | | * i386/intel/pmap.c: move it to pmap_bootstrap_xen() Message-Id: <20230212172818.1511405-4-luca@orpolo.org>
* pmap: Fix warningSamuel Thibault2023-02-121-2/+3
|
* prepare pmap helpers for full 64 bit memory mapLuca Dariz2023-02-121-5/+23
| | | | | | | * i386/intel/pmap.c: start walking the page table tree from the L4 table instead of the PDP table in pmap_pte() and pmap_pde(), preparing for the kernel to run on high addresses. Message-Id: <20230212172818.1511405-2-luca@orpolo.org>
* add L4 kmem cache for x86_64Luca Dariz2023-02-121-15/+19
| | | | | | | * i386/intel/pmap.c: allocate the L4 page table from a dedicate kmem cache instead of the generic kernel map. Also improve readability of nested ifdef's. Message-Id: <20230212170313.1501404-4-luca@orpolo.org>
* slock: Fix initialization of statically-allocated slocksSamuel Thibault2023-02-081-2/+2
| | | | (this is actually a no-op for i386)
* Lock get_mapwindow infrastructureSamuel Thibault2023-02-071-0/+5
|
* pmap: Refactor temporary mapping functionsDamien Zammit2023-02-032-0/+99
| | | | Message-Id: <20230203100133.835589-1-damien@zamaudio.com>
* pmap: Debug printf when pmap_update_interrupt runsDamien Zammit2023-02-011-0/+1
| | | | Message-Id: <20230201100519.784297-2-damien@zamaudio.com>
* Fix several warnings for -Wmissing-prototypes (part 2)Flavio Cruz2023-01-252-30/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | * i386/i386/io_map.c: code is unused. * i386/i386/io_perm.c: include mig prototypes. * i386/i386/mp_desc.c: Deleted interrupt_stack_alloc since it is not used. * i386/i386/seg.h: Moved descriptor structs to i386/include/mach/i386/mach_i386_types.h as that represents the interface types for RPCs. Defined aliases for real_descriptor since those are used by the i386 RPCs. Inlined many functions here too and removed seg.c. * i386/i386/seg.c: Removed. All the functions are inline now. * i386/i386/trap.c: Use static. * i386/i386/trap.h: Define missing prototypes. * i386/i386/tss.h: Use static inline for ltr. * i386/i386/user_ldt.c: Include mig prototypes. * i386/include/mach/i386/mach_i386.defs: Define real_descriptor_t types since those are used in the RPC definition. Now both prototypes and definitions will match. * i386/include/mach/i386/mach_i386_types.h: Move struct descriptor from seg.h since we need those for the RPC interfaces. Removed include of io_perm.h since it generates circular includes otherwise. * i386/intel/pmap.c: pmap_map is unused. Added static qualifier for several functions. * i386/intel/pmap.h: pmap_update_interrupt declared for non-SMP and SMP. Message-Id: <Y89+R2VekOQK4IUo@jupiter.lan>