/trunk/kernel/kernel.config |
---|
107,6 → 107,9 |
# Use VHPT |
! [ARCH=ia64] CONFIG_VHPT (n/y) |
# Use TSB |
! [ARCH=sparc64] CONFIG_TSB (n/y) |
## Run-time configuration directives |
# Kernel test type |
/trunk/kernel/genarch/src/mm/asid.c |
---|
122,6 → 122,14 |
* was stolen by invalidating its asid member. |
*/ |
as->asid = ASID_INVALID; |
/* |
* If the architecture uses some software cache |
* of TLB entries (e.g. TSB on sparc64), the |
* cache must be invalidated as well. |
*/ |
as_invalidate_translation_cache(as, 0, 0); |
mutex_unlock(&as->lock); |
/* |
141,7 → 149,7 |
asids_allocated++; |
/* |
* Purge the allocated rid from TLBs. |
* Purge the allocated ASID from TLBs. |
*/ |
tlb_shootdown_start(TLB_INVL_ASID, asid, 0, 0); |
tlb_invalidate_asid(asid); |
/trunk/kernel/generic/include/mm/as.h |
---|
93,6 → 93,9 |
/** Address space identifier. Constant on architectures that do not support ASIDs.*/ |
asid_t asid; |
/** Architecture specific content. */ |
as_arch_t arch; |
}; |
struct as_operations { |
/trunk/kernel/generic/src/mm/as.c |
---|
359,7 → 359,7 |
cond = false; /* we are almost done */ |
i = (start_free - b) >> PAGE_WIDTH; |
if (!used_space_remove(area, start_free, c - i)) |
panic("Could not remove used space."); |
panic("Could not remove used space.\n"); |
} else { |
/* |
* The interval of used space can be completely removed. |
389,6 → 389,11 |
*/ |
tlb_invalidate_pages(AS->asid, area->base + pages*PAGE_SIZE, area->pages - pages); |
tlb_shootdown_finalize(); |
/* |
* Invalidate software translation caches (e.g. TSB on sparc64). |
*/ |
as_invalidate_translation_cache(as, area->base + pages*PAGE_SIZE, area->pages - pages); |
} else { |
/* |
* Growing the area. |
440,7 → 445,7 |
/* |
* Start TLB shootdown sequence. |
*/ |
tlb_shootdown_start(TLB_INVL_PAGES, AS->asid, area->base, area->pages); |
tlb_shootdown_start(TLB_INVL_PAGES, as->asid, area->base, area->pages); |
/* |
* Visit only the pages mapped by used_space B+tree. |
472,9 → 477,14 |
/* |
* Finish TLB shootdown sequence. |
*/ |
tlb_invalidate_pages(AS->asid, area->base, area->pages); |
tlb_invalidate_pages(as->asid, area->base, area->pages); |
tlb_shootdown_finalize(); |
/* |
* Invalidate potential software translation caches (e.g. TSB on sparc64). |
*/ |
as_invalidate_translation_cache(as, area->base, area->pages); |
btree_destroy(&area->used_space); |
area->attributes |= AS_AREA_ATTR_PARTIAL; |
487,11 → 497,11 |
/* |
* Remove the empty area from address space. |
*/ |
btree_remove(&AS->as_area_btree, base, NULL); |
btree_remove(&as->as_area_btree, base, NULL); |
free(area); |
mutex_unlock(&AS->lock); |
mutex_unlock(&as->lock); |
interrupts_restore(ipl); |
return 0; |
} |
/trunk/kernel/arch/xen32/include/mm/as.h |
---|
44,7 → 44,11 |
#define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_install_arch(as) |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
/trunk/kernel/arch/sparc64/include/mm/as.h |
---|
35,6 → 35,10 |
#ifndef KERN_sparc64_AS_H_ |
#define KERN_sparc64_AS_H_ |
#ifdef CONFIG_TSB |
#include <arch/mm/tsb.h> |
#endif |
#define KERNEL_ADDRESS_SPACE_SHADOWED_ARCH 1 |
#define KERNEL_ADDRESS_SPACE_START_ARCH (unsigned long) 0x0000000000000000 |
44,6 → 48,19 |
#define USTACK_ADDRESS_ARCH (0xffffffffffffffffULL-(PAGE_SIZE-1)) |
typedef struct { |
#ifdef CONFIG_TSB |
tsb_entry_t *itsb; |
tsb_entry_t *dtsb; |
#endif |
} as_arch_t; |
#ifdef CONFIG_TSB |
# define as_invalidate_translation_cache(as, page, cnt) tsb_invalidate(as, page, cnt) |
#else |
# define as_invalidate_translation_cache(as, page, cnt) |
#endif |
extern void as_arch_init(void); |
#endif |
50,4 → 67,3 |
/** @} |
*/ |
/trunk/kernel/arch/sparc64/include/mm/tsb.h |
---|
0,0 → 1,64 |
/* |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup sparc64mm |
* @{ |
*/ |
/** @file |
*/ |
#ifndef KERN_sparc64_TSB_H_ |
#define KERN_sparc64_TSB_H_ |
#include <arch/mm/tte.h> |
#include <arch/types.h> |
#include <typedefs.h> |
/* |
* ITSB abd DTSB will claim 64K of memory, which |
* is a nice number considered that it is one of |
* the page sizes supported by hardware, which, |
* again, is nice because TSBs need to be locked |
* in TLBs - only one TLB entry will do. |
*/ |
#define ITSB_ENTRY_COUNT 2048 |
#define DTSB_ENTRY_COUNT 2048 |
struct tsb_entry { |
tte_tag_t tag; |
tte_data_t data; |
} __attribute__ ((packed)); |
typedef struct tsb_entry tsb_entry_t; |
extern void tsb_invalidate(as_t *as, uintptr_t page, count_t pages); |
#endif |
/** @} |
*/ |
/trunk/kernel/arch/sparc64/Makefile.inc |
---|
107,6 → 107,11 |
arch/$(ARCH)/src/drivers/tick.c \ |
arch/$(ARCH)/src/drivers/kbd.c |
ifdef CONFIG_TSB |
ARCH_SOURCES += \ |
arch/$(ARCH)/src/mm/tsb.c |
endif |
ifdef CONFIG_Z8530 |
ARCH_SOURCES += \ |
arch/$(ARCH)/src/drivers/fhc.c |
/trunk/kernel/arch/sparc64/src/mm/tsb.c |
---|
0,0 → 1,53 |
/* |
* Copyright (C) 2006 Jakub Jermar |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
/** @addtogroup sparc64mm |
* @{ |
*/ |
/** @file |
*/ |
#include <arch/mm/tsb.h> |
#include <mm/as.h> |
#include <arch/types.h> |
#include <typedefs.h> |
/** Invalidate portion of TSB. |
* |
* We assume that the address space is already locked. |
* |
* @param as Address space. |
* @param page First page to invalidate in TSB. |
* @param pages Number of pages to invalidate. |
*/ |
void tsb_invalidate(as_t *as, uintptr_t page, count_t pages) |
{ |
} |
/** @} |
*/ |
/trunk/kernel/arch/ia64/include/mm/as.h |
---|
44,6 → 44,11 |
#define USTACK_ADDRESS_ARCH 0x0000000ff0000000ULL |
typedef struct { |
} as_arch_t; |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
#endif |
/trunk/kernel/arch/ppc32/include/mm/as.h |
---|
44,6 → 44,11 |
#define USTACK_ADDRESS_ARCH (0x7fffffff-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
#endif |
/trunk/kernel/arch/amd64/include/mm/as.h |
---|
44,7 → 44,11 |
#define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_install_arch(as) |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
/trunk/kernel/arch/ppc64/include/mm/as.h |
---|
44,7 → 44,11 |
#define USTACK_ADDRESS_ARCH (0x7fffffff-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_install_arch(as) |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
/trunk/kernel/arch/mips32/include/mm/as.h |
---|
44,6 → 44,11 |
#define USTACK_ADDRESS_ARCH (0x80000000-PAGE_SIZE) |
typedef struct { |
} as_arch_t; |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |
#endif |
/trunk/kernel/arch/ia32/include/mm/as.h |
---|
44,7 → 44,11 |
#define USTACK_ADDRESS_ARCH (USER_ADDRESS_SPACE_END_ARCH-(PAGE_SIZE-1)) |
typedef struct { |
} as_arch_t; |
#define as_install_arch(as) |
#define as_invalidate_translation_cache(as, page, cnt) |
extern void as_arch_init(void); |