Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3683 → Rev 3684

/branches/tracing/kernel/genarch/include/fb/visuals.h
44,7 → 44,6
#define VISUAL_RGB_0_8_8_8 5
 
#define VISUAL_BGR_0_8_8_8 6
#define VISUAL_SB1500_PALETTE 7
 
#endif
 
/branches/tracing/kernel/genarch/src/fb/fb.c
191,26 → 191,6
BLUE(rgb, 3);
}
 
static void sb1500rgb_byte8(void *dst, int rgb)
{
if (RED(rgb, 1) && GREEN(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 255;
else if (RED(rgb, 1) && GREEN(rgb, 1))
*((uint8_t *) dst) = 150;
else if (GREEN(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 47;
else if (RED(rgb, 1) && BLUE(rgb, 1))
*((uint8_t *) dst) = 48;
else if (RED(rgb, 1))
*((uint8_t *) dst) = 32;
else if (GREEN(rgb, 1))
*((uint8_t *) dst) = 47;
else if (BLUE(rgb, 1))
*((uint8_t *) dst) = 2;
else
*((uint8_t *) dst) = 1;
}
 
/** Return pixel color - 8-bit depth (color palette/3:2:3)
*
* See the comment for rgb_byte().
466,11 → 446,6
scr2rgb = byte8_rgb;
pixelbytes = 1;
break;
case VISUAL_SB1500_PALETTE:
rgb2scr = sb1500rgb_byte8;
scr2rgb = byte8_rgb;
pixelbytes = 1;
break;
case VISUAL_RGB_5_5_5:
rgb2scr = rgb_byte555;
scr2rgb = byte555_rgb;
505,10 → 480,11
panic("Unsupported visual.\n");
}
unsigned int fbsize = props->scan * props->y + props->offset;
unsigned int fbsize = props->scan * props->y;
/* Map the framebuffer */
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize);
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset,
fbsize);
fbaddress += props->offset;
xres = props->x;
531,6 → 507,7
sysinfo_set_item_val("fb.scanline", NULL, props->scan);
sysinfo_set_item_val("fb.visual", NULL, props->visual);
sysinfo_set_item_val("fb.address.physical", NULL, props->addr);
sysinfo_set_item_val("fb.offset", NULL, props->offset);
sysinfo_set_item_val("fb.invert-colors", NULL, invert_colors);
 
/* Allocate double buffer */
/branches/tracing/kernel/generic/include/udebug/udebug.h
215,9 → 215,9
 
/** What type of event are we stopped in or 0 if none. */
udebug_event_t cur_event;
bool go; /**< thread is GO */
bool stoppable; /**< thread is stoppable */
bool debug_active; /**< thread is in a debugging session */
bool go; /**< thread is GO */
bool stoppable; /**< thread is stoppable */
bool active; /**< thread is in a debugging session */
} udebug_thread_t;
 
struct task;
/branches/tracing/kernel/generic/src/time/clock.c
191,15 → 191,18
spinlock_unlock(&THREAD->lock);
if (!ticks && !PREEMPTION_DISABLED) {
 
#ifdef CONFIG_UDEBUG
istate_t *istate;
#endif
scheduler();
 
#ifdef CONFIG_UDEBUG
/*
* Give udebug chance to stop the thread
* before it begins executing.
* before it begins executing userspace code.
*/
if (istate_from_uspace(THREAD->udebug.uspace_state))
istate = THREAD->udebug.uspace_state;
if (istate && istate_from_uspace(istate))
udebug_before_thread_runs();
#endif
}
/branches/tracing/kernel/generic/src/udebug/udebug.c
72,7 → 72,7
ut->uspace_state = NULL;
ut->go = false;
ut->stoppable = true;
ut->debug_active = false;
ut->active = false;
ut->cur_event = 0; /* none */
}
 
112,7 → 112,7
bool res;
 
mutex_lock(&THREAD->udebug.lock);
res = THREAD->udebug.debug_active;
res = THREAD->udebug.active;
mutex_unlock(&THREAD->udebug.lock);
 
return res;
170,7 → 170,7
* Active debugging session
*/
 
if (THREAD->udebug.debug_active == true &&
if (THREAD->udebug.active == true &&
THREAD->udebug.go == false) {
/*
* Thread was requested to stop - answer go call
210,8 → 210,7
mutex_lock(&TASK->udebug.lock);
mutex_lock(&THREAD->udebug.lock);
 
if (THREAD->udebug.debug_active &&
THREAD->udebug.go == false) {
if (THREAD->udebug.active && THREAD->udebug.go == false) {
TASK->udebug.begin_call = NULL;
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
264,8 → 263,7
mutex_lock(&THREAD->udebug.lock);
 
/* Must only generate events when in debugging session and is go. */
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.go == false ||
if (THREAD->udebug.active != true || THREAD->udebug.go == false ||
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) {
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
334,9 → 332,9
LOG("- check state\n");
 
/* Must only generate events when in debugging session */
if (THREAD->udebug.debug_active != true) {
LOG("- debug_active: %s, udebug.go: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
if (THREAD->udebug.active != true) {
LOG("- udebug.active: %s, udebug.go: %s\n",
THREAD->udebug.active ? "yes(+)" : "no(-)",
THREAD->udebug.go ? "yes(-)" : "no(+)");
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
384,9 → 382,9
LOG("- check state\n");
 
/* Must only generate events when in debugging session. */
if (THREAD->udebug.debug_active != true) {
/* printf("- debug_active: %s, udebug.go: %s\n",
THREAD->udebug.debug_active ? "yes(+)" : "no(-)",
if (THREAD->udebug.active != true) {
/* printf("- udebug.active: %s, udebug.go: %s\n",
THREAD->udebug.active ? "yes(+)" : "no(-)",
THREAD->udebug.go ? "yes(-)" : "no(+)");*/
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
401,7 → 399,7
IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E);
 
/* Prevent any further debug activity in thread. */
THREAD->udebug.debug_active = false;
THREAD->udebug.active = false;
THREAD->udebug.cur_event = 0; /* none */
THREAD->udebug.go = false; /* set to initial value */
 
424,8 → 422,7
mutex_lock(&THREAD->udebug.lock);
 
/* Must only generate events when in debugging session and have go. */
if (THREAD->udebug.debug_active != true ||
THREAD->udebug.go == false) {
if (THREAD->udebug.active != true || THREAD->udebug.go == false) {
mutex_unlock(&THREAD->udebug.lock);
mutex_unlock(&TASK->udebug.lock);
return;
516,13 → 513,13
/* Only process userspace threads. */
if ((flags & THREAD_FLAG_USPACE) != 0) {
/* Prevent any further debug activity in thread. */
t->udebug.debug_active = false;
t->udebug.active = false;
t->udebug.cur_event = 0; /* none */
 
/* Is the thread still go? */
if (t->udebug.go == true) {
/*
* Yes, so clear go. As debug_active == false,
* Yes, so clear go. As active == false,
* this doesn't affect anything.
*/
t->udebug.go = false;
/branches/tracing/kernel/generic/src/udebug/udebug_ops.c
58,7 → 58,7
* Specifically, verifies that thread t exists, is a userspace thread,
* and belongs to the current task (TASK). Verifies, that the thread
* is (or is not) go according to being_go (typically false).
* It also locks t->udebug.lock, making sure that t->udebug.debug_active
* It also locks t->udebug.lock, making sure that t->udebug.active
* is true - that the thread is in a valid debugging session.
*
* With this verified and the t->udebug.lock mutex held, it is ensured
108,7 → 108,7
}
 
/* Verify debugging state. */
if (t->udebug.debug_active != true) {
if (t->udebug.active != true) {
/* Not in debugging session or undesired GO state */
spinlock_unlock(&t->lock);
interrupts_restore(ipl);
117,8 → 117,8
}
 
/*
* Since the thread has debug_active == true, TASK->udebug.lock
* is enough to ensure its existence and that debug_active remains
* Since the thread has active == true, TASK->udebug.lock
* is enough to ensure its existence and that active remains
* true.
*/
spinlock_unlock(&t->lock);
204,7 → 204,7
reply = 0; /* no reply */
}
/* Set udebug.debug_active on all of the task's userspace threads. */
/* Set udebug.active on all of the task's userspace threads. */
 
for (cur = TASK->th_head.next; cur != &TASK->th_head; cur = cur->next) {
t = list_get_instance(cur, thread_t, th_link);
211,7 → 211,7
 
mutex_lock(&t->udebug.lock);
if ((t->flags & THREAD_FLAG_USPACE) != 0)
t->udebug.debug_active = true;
t->udebug.active = true;
mutex_unlock(&t->udebug.lock);
}
 
/branches/tracing/kernel/arch/sparc64/src/drivers/scr.c
78,6 → 78,7
}
uintptr_t fb_addr;
unsigned int fb_offset = 0;
uint32_t fb_width = 0;
uint32_t fb_height = 0;
uint32_t fb_depth = 0;
167,10 → 168,12
return;
}
 
fb_offset = 4 * 0x2000;
 
switch (fb_depth) {
case 8:
fb_scanline = fb_linebytes * (fb_depth >> 3);
visual = VISUAL_SB1500_PALETTE;
visual = VISUAL_INDIRECT_8;
break;
case 16:
fb_scanline = fb_linebytes * (fb_depth >> 3);
225,7 → 228,7
 
fb_properties_t props = {
.addr = fb_addr,
.offset = 0,
.offset = fb_offset,
.x = fb_width,
.y = fb_height,
.scan = fb_scanline,
/branches/tracing/uspace/lib/libc/include/loader/pcb.h
47,25 → 47,25
* arguments, environment variables etc.
*/
typedef struct {
/** Program entry point */
/** Program entry point. */
entry_point_t entry;
 
/** Number of command-line arguments */
/** Number of command-line arguments. */
int argc;
/** Command-line arguments */
/** Command-line arguments. */
char **argv;
 
/*
* ELF-specific data
* ELF-specific data.
*/
/** Pointer to ELF dynamic section of the program */
/** Pointer to ELF dynamic section of the program. */
void *dynamic;
/** Pointer to dynamic section of the runtime linker */
void *rtld_dynamic;
/** Runtime-linker load bias */
uintptr_t rtld_bias;
} pcb_t;
 
/**
* A pointer to the program control block. Having received the PCB pointer,
* the C library startup code stores it here for later use.
*/
extern pcb_t *__pcb;
 
#endif
/branches/tracing/uspace/srv/loader/main.c
59,12 → 59,6
#include <elf.h>
#include <elf_load.h>
 
/**
* Bias used for loading the dynamic linker. This will be soon replaced
* by automatic placement.
*/
#define RTLD_BIAS 0x80000
 
/** Pathname of the file that will be loaded */
static char *pathname = NULL;
 
229,16 → 223,13
{
int rc;
 
// printf("Load program '%s'\n", pathname);
 
rc = elf_load_file(pathname, 0, &prog_info);
if (rc < 0) {
printf("failed to load program\n");
printf("Failed to load executable '%s'.\n", pathname);
ipc_answer_0(rid, EINVAL);
return 1;
}
 
// printf("Create PCB\n");
elf_create_pcb(&prog_info, &pcb);
 
pcb.argc = argc;
246,27 → 237,18
 
if (prog_info.interp == NULL) {
/* Statically linked program */
// printf("Run statically linked program\n");
// printf("entry point: 0x%lx\n", prog_info.entry);
is_dyn_linked = false;
ipc_answer_0(rid, EOK);
return 0;
}
 
printf("Load dynamic linker '%s'\n", prog_info.interp);
rc = elf_load_file("/rtld.so", RTLD_BIAS, &interp_info);
rc = elf_load_file(prog_info.interp, 0, &interp_info);
if (rc < 0) {
printf("failed to load dynamic linker\n");
printf("Failed to load interpreter '%s.'\n", prog_info.interp);
ipc_answer_0(rid, EINVAL);
return 1;
}
 
/*
* Provide dynamic linker with some useful data
*/
pcb.rtld_dynamic = interp_info.dynamic;
pcb.rtld_bias = RTLD_BIAS;
 
is_dyn_linked = true;
ipc_answer_0(rid, EOK);
 
/branches/tracing/uspace/srv/fb/fb.c
521,8 → 521,9
*
*/
static bool
screen_init(void *addr, unsigned int xres, unsigned int yres,
unsigned int scan, unsigned int visual, bool invert_colors)
screen_init(void *addr, unsigned int offset, unsigned int xres,
unsigned int yres, unsigned int scan, unsigned int visual,
bool invert_colors)
{
switch (visual) {
case VISUAL_INDIRECT_8:
564,7 → 565,7
return false;
}
 
screen.fbaddress = (unsigned char *) addr;
screen.fbaddress = (unsigned char *) (((uintptr_t) addr) + offset);
screen.xres = xres;
screen.yres = yres;
screen.scanline = scan;
1353,6 → 1354,7
unsigned int fb_height;
unsigned int fb_scanline;
unsigned int fb_visual;
unsigned int fb_offset;
bool fb_invert_colors;
void *fb_addr;
size_t asz;
1360,6 → 1362,7
async_set_client_connection(fb_client_connection);
 
fb_ph_addr = (void *) sysinfo_value("fb.address.physical");
fb_offset = sysinfo_value("fb.offset");
fb_width = sysinfo_value("fb.width");
fb_height = sysinfo_value("fb.height");
fb_scanline = sysinfo_value("fb.scanline");
1369,10 → 1372,10
asz = fb_scanline * fb_height;
fb_addr = as_get_mappable_page(asz);
physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >>
physmem_map(fb_ph_addr + fb_offset, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >>
PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE);
 
if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual,
if (screen_init(fb_addr, fb_offset, fb_width, fb_height, fb_scanline, fb_visual,
fb_invert_colors))
return 0;
/branches/tracing/boot/genarch/ofw.h
123,6 → 123,7
extern int ofw_memmap(memmap_t *map);
extern int ofw_screen(screen_t *screen);
extern int ofw_keyboard(keyboard_t *keyboard);
extern int setup_palette(void);
extern void ofw_quiesce(void);
 
#endif
/branches/tracing/boot/genarch/ofw.c
373,7 → 373,49
return true;
}
 
/**
* Sets up the palette for the 8-bit color depth configuration so that the
* 3:2:3 color scheme can be used. Checks that setting the palette makes sense
* (appropriate nodes exist in the OBP tree and the color depth is not greater
* than 8).
*
* @return true if the palette has been set, false otherwise
*/
int setup_palette(void)
{
char device_name[BUF_SIZE];
/* resolve alias */
if (ofw_get_property(ofw_aliases, "screen", device_name,
sizeof(device_name)) <= 0)
return false;
 
/* for depth greater than 8 it makes no sense to set up the palette */
uint32_t depth;
phandle device = ofw_find_device(device_name);
if (device == -1)
return false;
if (ofw_get_property(device, "depth", &depth, sizeof(uint32_t)) <= 0)
return false;
if (depth != 8)
return false;
/* required in order to be able to make a method call */
ihandle screen = ofw_open(device_name);
if (screen == -1)
return false;
 
/* setup the palette so that the 3:2:3 scheme is usable */
unsigned int i;
for (i = 0; i < 256; i++)
if (ofw_call("call-method", 6, 1, NULL, "color!", screen,
i,
i << 5,
(i >> 3) << 6,
(i >> 5) << 5) != 0);
return true;
}
 
void ofw_quiesce(void)
{
ofw_call("quiesce", 0, 0, NULL);
/branches/tracing/boot/arch/sparc64/loader/main.c
267,6 → 267,8
printf("done.\n");
#endif
 
setup_palette();
 
printf("\nBooting the kernel...\n");
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS,
bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo,