/branches/tracing/kernel/genarch/include/fb/visuals.h |
---|
44,6 → 44,7 |
#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,6 → 191,26 |
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(). |
446,6 → 466,11 |
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; |
480,11 → 505,10 |
panic("Unsupported visual.\n"); |
} |
unsigned int fbsize = props->scan * props->y; |
unsigned int fbsize = props->scan * props->y + props->offset; |
/* Map the framebuffer */ |
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr + props->offset, |
fbsize); |
fbaddress = (uint8_t *) hw_map((uintptr_t) props->addr, fbsize); |
fbaddress += props->offset; |
xres = props->x; |
507,7 → 531,6 |
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 |
---|
217,7 → 217,7 |
udebug_event_t cur_event; |
bool go; /**< thread is GO */ |
bool stoppable; /**< thread is stoppable */ |
bool active; /**< thread is in a debugging session */ |
bool debug_active; /**< thread is in a debugging session */ |
} udebug_thread_t; |
struct task; |
/branches/tracing/kernel/generic/src/udebug/udebug.c |
---|
72,7 → 72,7 |
ut->uspace_state = NULL; |
ut->go = false; |
ut->stoppable = true; |
ut->active = false; |
ut->debug_active = false; |
ut->cur_event = 0; /* none */ |
} |
112,7 → 112,7 |
bool res; |
mutex_lock(&THREAD->udebug.lock); |
res = THREAD->udebug.active; |
res = THREAD->udebug.debug_active; |
mutex_unlock(&THREAD->udebug.lock); |
return res; |
170,7 → 170,7 |
* Active debugging session |
*/ |
if (THREAD->udebug.active == true && |
if (THREAD->udebug.debug_active == true && |
THREAD->udebug.go == false) { |
/* |
* Thread was requested to stop - answer go call |
210,7 → 210,8 |
mutex_lock(&TASK->udebug.lock); |
mutex_lock(&THREAD->udebug.lock); |
if (THREAD->udebug.active && THREAD->udebug.go == false) { |
if (THREAD->udebug.debug_active && |
THREAD->udebug.go == false) { |
TASK->udebug.begin_call = NULL; |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
263,7 → 264,8 |
mutex_lock(&THREAD->udebug.lock); |
/* Must only generate events when in debugging session and is go. */ |
if (THREAD->udebug.active != true || THREAD->udebug.go == false || |
if (THREAD->udebug.debug_active != true || |
THREAD->udebug.go == false || |
(TASK->udebug.evmask & UDEBUG_EVMASK(etype)) == 0) { |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
332,9 → 334,9 |
LOG("- check state\n"); |
/* Must only generate events when in debugging session */ |
if (THREAD->udebug.active != true) { |
LOG("- udebug.active: %s, udebug.go: %s\n", |
THREAD->udebug.active ? "yes(+)" : "no(-)", |
if (THREAD->udebug.debug_active != true) { |
LOG("- debug_active: %s, udebug.go: %s\n", |
THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
THREAD->udebug.go ? "yes(-)" : "no(+)"); |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
382,9 → 384,9 |
LOG("- check state\n"); |
/* Must only generate events when in debugging session. */ |
if (THREAD->udebug.active != true) { |
/* printf("- udebug.active: %s, udebug.go: %s\n", |
THREAD->udebug.active ? "yes(+)" : "no(-)", |
if (THREAD->udebug.debug_active != true) { |
/* printf("- debug_active: %s, udebug.go: %s\n", |
THREAD->udebug.debug_active ? "yes(+)" : "no(-)", |
THREAD->udebug.go ? "yes(-)" : "no(+)");*/ |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
399,7 → 401,7 |
IPC_SET_ARG1(call->data, UDEBUG_EVENT_THREAD_E); |
/* Prevent any further debug activity in thread. */ |
THREAD->udebug.active = false; |
THREAD->udebug.debug_active = false; |
THREAD->udebug.cur_event = 0; /* none */ |
THREAD->udebug.go = false; /* set to initial value */ |
422,7 → 424,8 |
mutex_lock(&THREAD->udebug.lock); |
/* Must only generate events when in debugging session and have go. */ |
if (THREAD->udebug.active != true || THREAD->udebug.go == false) { |
if (THREAD->udebug.debug_active != true || |
THREAD->udebug.go == false) { |
mutex_unlock(&THREAD->udebug.lock); |
mutex_unlock(&TASK->udebug.lock); |
return; |
513,13 → 516,13 |
/* Only process userspace threads. */ |
if ((flags & THREAD_FLAG_USPACE) != 0) { |
/* Prevent any further debug activity in thread. */ |
t->udebug.active = false; |
t->udebug.debug_active = false; |
t->udebug.cur_event = 0; /* none */ |
/* Is the thread still go? */ |
if (t->udebug.go == true) { |
/* |
* Yes, so clear go. As active == false, |
* Yes, so clear go. As debug_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.active |
* It also locks t->udebug.lock, making sure that t->udebug.debug_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.active != true) { |
if (t->udebug.debug_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 active == true, TASK->udebug.lock |
* is enough to ensure its existence and that active remains |
* Since the thread has debug_active == true, TASK->udebug.lock |
* is enough to ensure its existence and that debug_active remains |
* true. |
*/ |
spinlock_unlock(&t->lock); |
204,7 → 204,7 |
reply = 0; /* no reply */ |
} |
/* Set udebug.active on all of the task's userspace threads. */ |
/* Set udebug.debug_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.active = true; |
t->udebug.debug_active = true; |
mutex_unlock(&t->udebug.lock); |
} |
/branches/tracing/kernel/generic/src/time/clock.c |
---|
191,18 → 191,15 |
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 userspace code. |
* before it begins executing. |
*/ |
istate = THREAD->udebug.uspace_state; |
if (istate && istate_from_uspace(istate)) |
if (istate_from_uspace(THREAD->udebug.uspace_state)) |
udebug_before_thread_runs(); |
#endif |
} |
/branches/tracing/kernel/arch/sparc64/src/drivers/scr.c |
---|
78,7 → 78,6 |
} |
uintptr_t fb_addr; |
unsigned int fb_offset = 0; |
uint32_t fb_width = 0; |
uint32_t fb_height = 0; |
uint32_t fb_depth = 0; |
168,12 → 167,10 |
return; |
} |
fb_offset = 4 * 0x2000; |
switch (fb_depth) { |
case 8: |
fb_scanline = fb_linebytes * (fb_depth >> 3); |
visual = VISUAL_INDIRECT_8; |
visual = VISUAL_SB1500_PALETTE; |
break; |
case 16: |
fb_scanline = fb_linebytes * (fb_depth >> 3); |
228,7 → 225,7 |
fb_properties_t props = { |
.addr = fb_addr, |
.offset = fb_offset, |
.offset = 0, |
.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/fb/fb.c |
---|
521,9 → 521,8 |
* |
*/ |
static bool |
screen_init(void *addr, unsigned int offset, unsigned int xres, |
unsigned int yres, unsigned int scan, unsigned int visual, |
bool invert_colors) |
screen_init(void *addr, unsigned int xres, unsigned int yres, |
unsigned int scan, unsigned int visual, bool invert_colors) |
{ |
switch (visual) { |
case VISUAL_INDIRECT_8: |
565,7 → 564,7 |
return false; |
} |
screen.fbaddress = (unsigned char *) (((uintptr_t) addr) + offset); |
screen.fbaddress = (unsigned char *) addr; |
screen.xres = xres; |
screen.yres = yres; |
screen.scanline = scan; |
1354,7 → 1353,6 |
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; |
1362,7 → 1360,6 |
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"); |
1372,10 → 1369,10 |
asz = fb_scanline * fb_height; |
fb_addr = as_get_mappable_page(asz); |
physmem_map(fb_ph_addr + fb_offset, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >> |
physmem_map(fb_ph_addr, fb_addr, ALIGN_UP(asz, PAGE_SIZE) >> |
PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); |
if (screen_init(fb_addr, fb_offset, fb_width, fb_height, fb_scanline, fb_visual, |
if (screen_init(fb_addr, fb_width, fb_height, fb_scanline, fb_visual, |
fb_invert_colors)) |
return 0; |
/branches/tracing/uspace/srv/loader/main.c |
---|
59,6 → 59,12 |
#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; |
223,13 → 229,16 |
{ |
int rc; |
// printf("Load program '%s'\n", pathname); |
rc = elf_load_file(pathname, 0, &prog_info); |
if (rc < 0) { |
printf("Failed to load executable '%s'.\n", pathname); |
printf("failed to load program\n"); |
ipc_answer_0(rid, EINVAL); |
return 1; |
} |
// printf("Create PCB\n"); |
elf_create_pcb(&prog_info, &pcb); |
pcb.argc = argc; |
237,18 → 246,27 |
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; |
} |
rc = elf_load_file(prog_info.interp, 0, &interp_info); |
printf("Load dynamic linker '%s'\n", prog_info.interp); |
rc = elf_load_file("/rtld.so", RTLD_BIAS, &interp_info); |
if (rc < 0) { |
printf("Failed to load interpreter '%s.'\n", prog_info.interp); |
printf("failed to load dynamic linker\n"); |
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/boot/genarch/ofw.c |
---|
373,49 → 373,7 |
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/genarch/ofw.h |
---|
123,7 → 123,6 |
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/arch/sparc64/loader/main.c |
---|
267,8 → 267,6 |
printf("done.\n"); |
#endif |
setup_palette(); |
printf("\nBooting the kernel...\n"); |
jump_to_kernel((void *) KERNEL_VIRTUAL_ADDRESS, |
bootinfo.physmem_start | BSP_PROCESSOR, &bootinfo, |