Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 2053 → Rev 2054

/trunk/kernel/genarch/src/fb/fb.c
39,7 → 39,6
#include <console/console.h>
#include <sysinfo/sysinfo.h>
#include <mm/slab.h>
#include <align.h>
#include <panic.h>
#include <memstr.h>
#include <config.h>
46,6 → 45,8
#include <bitops.h>
#include <print.h>
#include <ddi/ddi.h>
#include <arch/types.h>
#include <typedefs.h>
 
#include "helenos.xbm"
 
57,7 → 58,7
 
static uint8_t *blankline = NULL;
static uint8_t *dbbuffer = NULL; /* Buffer for fast scrolling console */
static int dboffset;
static index_t dboffset;
 
static unsigned int xres = 0;
static unsigned int yres = 0;
110,13 → 111,15
 
static void bgr_byte0888(void *dst, int rgb)
{
*((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | RED(rgb, 8);
*((uint32_t *) dst) = BLUE(rgb, 8) << 16 | GREEN(rgb, 8) << 8 | RED(rgb,
8);
}
 
static int byte0888_bgr(void *src)
{
int color = *(uint32_t *)(src);
return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color >> 16) & 0xff);
return ((color & 0xff) << 16) | (((color >> 8) & 0xff) << 8) | ((color
>> 16) & 0xff);
}
 
static void rgb_byte888(void *dst, int rgb)
147,7 → 150,8
static void rgb_byte555(void *dst, int rgb)
{
/* 5-bit, 5-bits, 5-bits */
*((uint16_t *) dst) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | BLUE(rgb, 5);
*((uint16_t *) dst) = RED(rgb, 5) << 10 | GREEN(rgb, 5) << 5 | BLUE(rgb,
5);
}
 
/** 16-bit depth (5:5:5) */
154,7 → 158,8
static int byte555_rgb(void *src)
{
int color = *(uint16_t *)(src);
return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) << (8 + 3)) | ((color & 0x1f) << 3);
return (((color >> 10) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x1f) <<
(8 + 3)) | ((color & 0x1f) << 3);
}
 
/** 16-bit depth (5:6:5) */
168,7 → 173,8
static int byte565_rgb(void *src)
{
int color = *(uint16_t *)(src);
return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) << (8 + 2)) | ((color & 0x1f) << 3);
return (((color >> 11) & 0x1f) << (16 + 3)) | (((color >> 5) & 0x3f) <<
(8 + 2)) | ((color & 0x1f) << 3);
}
 
/** Put pixel - 8-bit depth (color palette/3:2:3)
181,7 → 187,8
*/
static void rgb_byte8(void *dst, int rgb)
{
*((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb, 3);
*((uint8_t *) dst) = RED(rgb, 3) << 5 | GREEN(rgb, 2) << 3 | BLUE(rgb,
3);
}
 
/** Return pixel color - 8-bit depth (color palette/3:2:3)
191,7 → 198,8
static int byte8_rgb(void *src)
{
int color = *(uint8_t *)src;
return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8 + 6)) | ((color & 0x7) << 5);
return (((color >> 5) & 0x7) << (16 + 5)) | (((color >> 3) & 0x3) << (8
+ 6)) | ((color & 0x7) << 5);
}
 
static void putpixel(unsigned int x, unsigned int y, int color)
223,7 → 231,8
for (y = 0; y < yres; y++) {
memcpy(&fbaddress[scanline * y], blankline, xres * pixelbytes);
if (dbbuffer)
memcpy(&dbbuffer[scanline * y], blankline, xres * pixelbytes);
memcpy(&dbbuffer[scanline * y], blankline, xres *
pixelbytes);
}
}
 
231,19 → 240,23
/** Scroll screen one row up */
static void scroll_screen(void)
{
uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
int firstsz;
if (dbbuffer) {
count_t first;
 
if (dbbuffer) {
memcpy(&dbbuffer[dboffset * scanline], blankline, ROW_BYTES);
dboffset = (dboffset + FONT_SCANLINES) % yres;
firstsz = yres - dboffset;
first = yres - dboffset;
 
memcpy(fbaddress, &dbbuffer[scanline * dboffset], firstsz * scanline);
memcpy(&fbaddress[firstsz * scanline], dbbuffer, dboffset * scanline);
memcpy(fbaddress, &dbbuffer[scanline * dboffset], first *
scanline);
memcpy(&fbaddress[first * scanline], dbbuffer, dboffset *
scanline);
} else {
memcpy((void *) fbaddress, (void *) &fbaddress[ROW_BYTES], scanline * yres - ROW_BYTES);
uint8_t *lastline = &fbaddress[(rows - 1) * ROW_BYTES];
memcpy((void *) fbaddress, (void *) &fbaddress[ROW_BYTES],
scanline * yres - ROW_BYTES);
/* Clear last row */
memcpy((void *) lastline, (void *) blankline, ROW_BYTES);
}
277,7 → 290,8
unsigned int y;
 
for (y = 0; y < FONT_SCANLINES; y++)
draw_glyph_line(fb_font[glyph * FONT_SCANLINES + y], col * COL_WIDTH, row * FONT_SCANLINES + y);
draw_glyph_line(fb_font[glyph * FONT_SCANLINES + y], col *
COL_WIDTH, row * FONT_SCANLINES + y);
}
 
/** Invert character at given position */
288,7 → 302,8
 
for (x = 0; x < COL_WIDTH; x++)
for (y = 0; y < FONT_SCANLINES; y++)
invert_pixel(col * COL_WIDTH + x, row * FONT_SCANLINES + y);
invert_pixel(col * COL_WIDTH + x, row * FONT_SCANLINES +
y);
}
 
/** Draw character at default position */
311,7 → 326,8
byte = helenos_bits[rowbytes * y + x / 8];
byte >>= x % 8;
if (byte & 1)
putpixel(startx + x, starty + y, COLOR(LOGOCOLOR));
putpixel(startx + x, starty + y,
COLOR(LOGOCOLOR));
}
}
 
383,7 → 399,8
* @param visual Color model
*
*/
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan, unsigned int visual)
void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int scan,
unsigned int visual)
{
switch (visual) {
case VISUAL_INDIRECT_8:
455,7 → 472,7
sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
 
/* Allocate double buffer */
unsigned int order = fnzb(SIZE2FRAMES(ALIGN_UP(fbsize, FRAME_SIZE))) + 1;
unsigned int order = fnzb(SIZE2FRAMES(fbsize) - 1) + 1;
dbbuffer = (uint8_t * ) frame_alloc(order, FRAME_ATOMIC | FRAME_KA);
if (!dbbuffer)
printf("Failed to allocate scroll buffer.\n");
/trunk/kernel/arch/sparc64/include/mm/tlb.h
382,7 → 382,8
/** Perform IMMU TLB Demap Operation.
*
* @param type Selects between context and page demap.
* @param context_encoding Specifies which Context register has Context ID for demap.
* @param context_encoding Specifies which Context register has Context ID for
* demap.
* @param page Address which is on the page to be demapped.
*/
static inline void itlb_demap(int type, int context_encoding, uintptr_t page)
397,7 → 398,9
da.context = context_encoding;
da.vpn = pg.vpn;
asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); /* da.value is the address within the ASI */
asi_u64_write(ASI_IMMU_DEMAP, da.value, 0); /* da.value is the
* address within the
* ASI */
flush();
}
 
404,7 → 407,8
/** Perform DMMU TLB Demap Operation.
*
* @param type Selects between context and page demap.
* @param context_encoding Specifies which Context register has Context ID for demap.
* @param context_encoding Specifies which Context register has Context ID for
* demap.
* @param page Address which is on the page to be demapped.
*/
static inline void dtlb_demap(int type, int context_encoding, uintptr_t page)
419,7 → 423,9
da.context = context_encoding;
da.vpn = pg.vpn;
asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the address within the ASI */
asi_u64_write(ASI_DMMU_DEMAP, da.value, 0); /* da.value is the
* address within the
* ASI */
membar();
}
 
/trunk/kernel/arch/sparc64/src/smp/ipi.c
73,10 → 73,13
panic("Interrupt Dispatch Status busy bit set\n");
do {
asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t) func);
asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_0, (uintptr_t)
func);
asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_1, 0);
asi_u64_write(ASI_UDB_INTR_W, ASI_UDB_INTR_W_DATA_2, 0);
asi_u64_write(ASI_UDB_INTR_W, (mid << INTR_VEC_DISPATCH_MID_SHIFT) | ASI_UDB_INTR_W_DISPATCH, 0);
asi_u64_write(ASI_UDB_INTR_W, (mid <<
INTR_VEC_DISPATCH_MID_SHIFT) | ASI_UDB_INTR_W_DISPATCH,
0);
membar();
/trunk/kernel/arch/sparc64/src/proc/scheduler.c
94,9 → 94,15
}
/*
* Write kernel stack address to %g6 and a pointer to the last
* item in the userspace window buffer to %g7 in the alternate
* and interrupt sets.
* Write kernel stack address to %g6 of the alternate and
* interrupt global sets.
*
* Write pointer to the last item in the userspace window buffer
* to %g7 in the alternate set. Write to the interrupt %g7 is
* not necessary because:
* - spill traps operate only in the alternate global set,
* - preemptible trap handler switches to alternate globals
* before it explicitly uses %g7.
*/
uint64_t sp = (uintptr_t) THREAD->kstack + STACK_SIZE
- (STACK_BIAS + ALIGN_UP(STACK_ITEM_SIZE,
109,7 → 115,7
 
/** Perform sparc64 specific steps before a thread stops running.
*
* Demap any locked DTLB entries isntalled by the thread (i.e. kernel stack
* Demap any locked DTLB entries installed by the thread (i.e. kernel stack
* and userspace window buffer).
*/
void after_thread_ran_arch(void)
/trunk/kernel/arch/sparc64/src/trap/interrupt.c
97,7 → 97,8
* Spurious interrupt.
*/
#ifdef CONFIG_DEBUG
printf("cpu%d: spurious interrupt (intrcv=%#llx, data0=%#llx)\n", CPU->id, intrcv, data0);
printf("cpu%d: spurious interrupt (intrcv=%#llx, "
"data0=%#llx)\n", CPU->id, intrcv, data0);
#endif
}