Changeset d364e94 in mainline


Ignore:
Timestamp:
2008-10-02T20:24:01Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1d132ae
Parents:
c2ad500
Message:

Do not allocate full page for the uspace window buffer.
Instead, allocate only the bare minimum to fit NWINDOWS - 1
uspace windows and to satisfy alignment requirements.

Location:
kernel/arch/sparc64
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/trap/regwin.h

    rc2ad500 rd364e94  
    4040#include <arch/stack.h>
    4141#include <arch/arch.h>
     42#include <align.h>
    4243
    4344#define TT_CLEAN_WINDOW                 0x24
     
    7273#define I6_OFFSET       112
    7374#define I7_OFFSET       120
     75
     76/* Uspace Window Buffer constants. */
     77#define UWB_SIZE        ((NWINDOWS - 1) * STACK_WINDOW_SAVE_AREA_SIZE)
     78#define UWB_ALIGNMENT   1024
     79#define UWB_ASIZE       ALIGN_UP(UWB_SIZE, UWB_ALIGNMENT)
    7480
    7581#ifdef __ASM__
  • kernel/arch/sparc64/src/proc/thread.c

    rc2ad500 rd364e94  
    3535#include <proc/thread.h>
    3636#include <arch/proc/thread.h>
    37 #include <mm/frame.h>
    38 #include <mm/page.h>
    39 #include <arch/mm/page.h>
     37#include <mm/slab.h>
     38#include <arch/trap/regwin.h>
    4039#include <align.h>
    4140
     
    5150{
    5251        if (t->arch.uspace_window_buffer) {
     52                uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
    5353                /*
    5454                 * Mind the possible alignment of the userspace window buffer
    5555                 * belonging to a killed thread.
    5656                 */
    57                 frame_free(KA2PA(ALIGN_DOWN((uintptr_t)
    58                     t->arch.uspace_window_buffer, PAGE_SIZE)));
     57                free((uint8_t *) ALIGN_DOWN(uw_buf, UWB_ALIGNMENT));
    5958        }
    6059}
     
    6867                 * returned from the slab allocator doesn't have any.
    6968                 */
    70                 t->arch.uspace_window_buffer = frame_alloc(ONE_FRAME, FRAME_KA);
     69                t->arch.uspace_window_buffer = malloc(UWB_ASIZE, 0);
    7170        } else {
    7271                uintptr_t uw_buf = (uintptr_t) t->arch.uspace_window_buffer;
     
    7776                 */
    7877                t->arch.uspace_window_buffer = (uint8_t *) ALIGN_DOWN(uw_buf,
    79                     PAGE_SIZE);
     78                    UWB_ASIZE);
    8079        }
    8180}
  • kernel/arch/sparc64/src/trap/trap_table.S

    rc2ad500 rd364e94  
    749749         */
    750750        clr %g4
    751         set PAGE_SIZE - 1, %g5
    752 0:      andcc %g7, %g5, %g0                     ! PAGE_SIZE alignment check
    753         bz 0f                                   ! %g7 is page-aligned, no more windows to refill
     7510:      andcc %g7, UWB_ALIGNMENT - 1, %g0       ! alignment check
     752        bz 0f                                   ! %g7 is UWB_ALIGNMENT-aligned, no more windows to refill
    754753        nop
    755754
Note: See TracChangeset for help on using the changeset viewer.