Changeset 730376d in mainline


Ignore:
Timestamp:
2006-12-20T22:07:25Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0af7a09
Parents:
deada67
Message:

Fix important comment in kernel/arch/sparc64/src/proc/scheduler.c.

Improve framebuffer code.

Formatting and indentation fixes.

Location:
kernel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/include/mm/tlb.h

    rdeada67 r730376d  
    6666/* TLB Tag Access shifts */
    6767#define TLB_TAG_ACCESS_CONTEXT_SHIFT    0
    68 #define TLB_TAG_ACCESS_CONTEXT_MASK     ((1<<13)-1)
     68#define TLB_TAG_ACCESS_CONTEXT_MASK     ((1 << 13) - 1)
    6969#define TLB_TAG_ACCESS_VPN_SHIFT        13
    7070
     
    107107        uint64_t value;
    108108        struct {
    109                 uint64_t vpn : 51;              /**< Virtual Address bits 63:13. */
    110                 unsigned context : 13;          /**< Context identifier. */
     109                uint64_t vpn : 51;      /**< Virtual Address bits 63:13. */
     110                unsigned context : 13;  /**< Context identifier. */
    111111        } __attribute__ ((packed));
    112112};
     
    383383 *
    384384 * @param type Selects between context and page demap.
    385  * @param context_encoding Specifies which Context register has Context ID for demap.
     385 * @param context_encoding Specifies which Context register has Context ID for
     386 *      demap.
    386387 * @param page Address which is on the page to be demapped.
    387388 */
     
    398399        da.vpn = pg.vpn;
    399400       
    400         asi_u64_write(ASI_IMMU_DEMAP, da.value, 0);     /* da.value is the address within the ASI */
     401        asi_u64_write(ASI_IMMU_DEMAP, da.value, 0);     /* da.value is the
     402                                                         * address within the
     403                                                         * ASI */
    401404        flush();
    402405}
     
    405408 *
    406409 * @param type Selects between context and page demap.
    407  * @param context_encoding Specifies which Context register has Context ID for demap.
     410 * @param context_encoding Specifies which Context register has Context ID for
     411 *       demap.
    408412 * @param page Address which is on the page to be demapped.
    409413 */
     
    420424        da.vpn = pg.vpn;
    421425       
    422         asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the address within the ASI */
     426        asi_u64_write(ASI_DMMU_DEMAP, da.value, 0);     /* da.value is the
     427                                                         * address within the
     428                                                         * ASI */
    423429        membar();
    424430}
  • kernel/arch/sparc64/src/proc/scheduler.c

    rdeada67 r730376d  
    9595               
    9696                /*
    97                  * Write kernel stack address to %g6 and a pointer to the last
    98                  * item in the userspace window buffer to %g7 in the alternate
    99                  * and interrupt sets.
     97                 * Write kernel stack address to %g6 of the alternate and
     98                 * interrupt global sets.
     99                 *
     100                 * Write pointer to the last item in the userspace window buffer
     101                 * to %g7 in the alternate set. Write to the interrupt %g7 is
     102                 * not necessary because:
     103                 * - spill traps operate only in the alternate global set,
     104                 * - preemptible trap handler switches to alternate globals
     105                 *   before it explicitly uses %g7.
    100106                 */
    101107                uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE
     
    110116/** Perform sparc64 specific steps before a thread stops running.
    111117 *
    112  * Demap any locked DTLB entries isntalled by the thread (i.e. kernel stack
     118 * Demap any locked DTLB entries installed by the thread (i.e. kernel stack
    113119 * and userspace window buffer).
    114120 */
  • kernel/arch/sparc64/src/smp/ipi.c

    rdeada67 r730376d  
    7474       
    7575        do {
    76                 asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t) func);
     76                asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t)
     77                        func);
    7778                asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_1, 0);
    7879                asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_2, 0);
    79                 asi_u64_write(ASI_UDB_INTR_W, (mid << INTR_VEC_DISPATCH_MID_SHIFT) | ASI_UDB_INTR_W_DISPATCH, 0);
     80                asi_u64_write(ASI_UDB_INTR_W, (mid <<
     81                        INTR_VEC_DISPATCH_MID_SHIFT) | ASI_UDB_INTR_W_DISPATCH,
     82                        0);
    8083       
    8184                membar();
  • kernel/arch/sparc64/src/trap/interrupt.c

    rdeada67 r730376d  
    9898                 */
    9999#ifdef CONFIG_DEBUG
    100                 printf("cpu%d: spurious interrupt (intrcv=%#llx, data0=%#llx)\n", CPU->id, intrcv, data0);
     100                printf("cpu%d: spurious interrupt (intrcv=%#llx, "
     101                        "data0=%#llx)\n", CPU->id, intrcv, data0);
    101102#endif
    102103        }
  • kernel/genarch/src/fb/fb.c

    rdeada67 r730376d  
    4040#include <sysinfo/sysinfo.h>
    4141#include <mm/slab.h>
    42 #include <align.h>
    4342#include <panic.h>
    4443#include <memstr.h>
     
    4746#include <print.h>
    4847#include <ddi/ddi.h>
     48#include <arch/types.h>
     49#include <typedefs.h>
    4950
    5051#include "helenos.xbm"
     
    5758
    5859static uint8_t *blankline = NULL;
    59 static uint8_t *dbbuffer = NULL; /* Buffer for fast scrolling console */
    60 static int dboffset;
     60static uint8_t *dbbuffer = NULL;        /* Buffer for fast scrolling console */
     61static index_t dboffset;
    6162
    6263static unsigned int xres = 0;
     
    111112static void bgr_byte0888(void *dst, int rgb)
    112113{
    113         *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | RED(rgb, 8);
     114        *((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | RED(rgb,
     115                8);
    114116}
    115117
     
    117119{
    118120        int color = *(uint32_t *)(src);
    119         return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color >> 16) & 0xff);
     121        return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color
     122                >> 16) & 0xff);
    120123}
    121124
     
    148151{
    149152        /* 5-bit, 5-bits, 5-bits */
    150         *((uint16_t *) dst) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | BLUE(rgb, 5);
     153        *((uint16_t *) dst) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | BLUE(rgb,
     154                5);
    151155}
    152156
     
    155159{
    156160        int color = *(uint16_t *)(src);
    157         return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) << (8 + 3)) | ((color & 0x1f) << 3);
     161        return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) <<
     162                (8 + 3)) | ((color & 0x1f) << 3);
    158163}
    159164
     
    162167{
    163168        /* 5-bit, 6-bits, 5-bits */
    164         *((uint16_t *) dst) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb, 5);
     169        *((uint16_t *) dst) = RED(rgb, 5) << 11 | GREEN(rgb, 6) << 5 | BLUE(rgb,                5);
    165170}
    166171
     
    169174{
    170175        int color = *(uint16_t *)(src);
    171         return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
     176        return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) <<
     177                (8 + 2)) | ((color & 0x1f) << 3);
    172178}
    173179
     
    182188static void rgb_byte8(void *dst, int rgb)
    183189{
    184         *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);
     190        *((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb,
     191                3);
    185192}
    186193
     
    192199{
    193200        int color = *(uint8_t *)src;
    194         return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
     201        return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8
     202                + 6)) | ((color & 0x7) << 5);
    195203}
    196204
     
    224232                memcpy(&fbaddress[scanline * y], blankline, xres * pixelbytes);
    225233                if (dbbuffer)
    226                         memcpy(&dbbuffer[scanline * y], blankline, xres * pixelbytes);
     234                        memcpy(&dbbuffer[scanline * y], blankline, xres *
     235                                pixelbytes);
    227236        }
    228237}
     
    232241static void scroll_screen(void)
    233242{
    234         uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
    235         int firstsz;
    236 
    237243        if (dbbuffer) {
     244                count_t first;
     245               
    238246                memcpy(&dbbuffer[dboffset * scanline], blankline, ROW_BYTES);
    239247               
    240248                dboffset = (dboffset + FONT_SCANLINES) % yres;
    241                 firstsz = yres - dboffset;
    242 
    243                 memcpy(fbaddress, &dbbuffer[scanline * dboffset], firstsz * scanline);
    244                 memcpy(&fbaddress[firstsz * scanline], dbbuffer, dboffset * scanline);
     249                first = yres - dboffset;
     250
     251                memcpy(fbaddress, &dbbuffer[scanline * dboffset], first *
     252                        scanline);
     253                memcpy(&fbaddress[first * scanline], dbbuffer, dboffset *
     254                        scanline);
    245255        } else {
    246                 memcpy((void *) fbaddress, (void *) &fbaddress[ROW_BYTES], scanline * yres - ROW_BYTES);
     256                uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
     257               
     258                memcpy((void *) fbaddress, (void *) &fbaddress[ROW_BYTES],
     259                        scanline * yres - ROW_BYTES);
    247260                /* Clear last row */
    248261                memcpy((void *) lastline, (void *) blankline, ROW_BYTES);
     
    278291
    279292        for (y = 0; y < FONT_SCANLINES; y++)
    280                 draw_glyph_line(fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
     293                draw_glyph_line(fb_font[glyph * FONT_SCANLINES + y], col *
     294                        COL_WIDTH, row * FONT_SCANLINES + y);
    281295}
    282296
     
    289303        for (x = 0; x < COL_WIDTH; x++)
    290304                for (y = 0; y < FONT_SCANLINES; y++)
    291                         invert_pixel(col * COL_WIDTH + x, row * FONT_SCANLINES + y);
     305                        invert_pixel(col * COL_WIDTH + x, row * FONT_SCANLINES +
     306                                y);
    292307}
    293308
     
    312327                        byte >>= x % 8;
    313328                        if (byte & 1)
    314                                 putpixel(startx + x, starty + y, COLOR(LOGOCOLOR));
     329                                putpixel(startx + x, starty + y,
     330                                        COLOR(LOGOCOLOR));
    315331                }
    316332}
     
    384400 *
    385401 */
    386 void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan, unsigned int visual)
     402void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan,
     403        unsigned int visual)
    387404{
    388405        switch (visual) {
     
    456473
    457474        /* Allocate double buffer */
    458         unsigned int order = fnzb(SIZE2FRAMES(ALIGN_UP(fbsize, FRAME_SIZE))) + 1;
    459         dbbuffer = (uint8_t * ) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
     475        unsigned int order = fnzb(SIZE2FRAMES(fbsize) - 1) + 1;
     476        dbbuffer = (uint8_t *) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
    460477        if (!dbbuffer)
    461478                printf("Failed to allocate scroll buffer.\n");
Note: See TracChangeset for help on using the changeset viewer.