/trunk/kernel/genarch/src/kbd/ns16550.c |
---|
47,6 → 47,7 |
#include <console/chardev.h> |
#include <console/console.h> |
#include <interrupt.h> |
#include <sysinfo/sysinfo.h> |
#define LSR_DATA_READY 0x01 |
86,6 → 87,10 |
ns16550_grab(); |
chardev_initialize("ns16550_kbd", &kbrd, &ops); |
stdin = &kbrd; |
sysinfo_set_item_val("kbd", NULL, true); |
sysinfo_set_item_val("kbd.irq", NULL, 0); |
sysinfo_set_item_val("kbd.address.virtual", NULL, (uintptr_t) kbd_virt_address); |
} |
/** Process ns16550 interrupt. |
/trunk/kernel/generic/src/sysinfo/sysinfo.c |
---|
78,31 → 78,31 |
subtree = *psubtree; |
if (subtree == NULL) { |
sysinfo_item_t *item = malloc(sizeof(sysinfo_item_t), 0); |
int i = 0, j; |
sysinfo_item_t *item = malloc(sizeof(sysinfo_item_t), 0); |
int i = 0, j; |
ASSERT(item); |
*psubtree = item; |
item->next = NULL; |
item->val_type = SYSINFO_VAL_UNDEFINED; |
item->subinfo.table = NULL; |
ASSERT(item); |
*psubtree = item; |
item->next = NULL; |
item->val_type = SYSINFO_VAL_UNDEFINED; |
item->subinfo.table = NULL; |
while (name[i] && (name[i] != '.')) |
i++; |
while (name[i] && (name[i] != '.')) |
i++; |
item->name = malloc(i, 0); |
ASSERT(item->name); |
item->name = malloc(i, 0); |
ASSERT(item->name); |
for (j = 0; j < i; j++) |
item->name[j] = name[j]; |
item->name[j] = 0; |
for (j = 0; j < i; j++) |
item->name[j] = name[j]; |
item->name[j] = 0; |
if (name[i]) { /* =='.' */ |
item->subinfo_type = SYSINFO_SUBINFO_TABLE; |
return sysinfo_create_path(name + i + 1, &(item->subinfo.table)); |
} |
item->subinfo_type = SYSINFO_SUBINFO_NONE; |
return item; |
if (name[i]) { /* =='.' */ |
item->subinfo_type = SYSINFO_SUBINFO_TABLE; |
return sysinfo_create_path(name + i + 1, &(item->subinfo.table)); |
} |
item->subinfo_type = SYSINFO_SUBINFO_NONE; |
return item; |
} |
while (subtree != NULL) { |
/trunk/kernel/generic/src/printf/printf_core.c |
---|
392,7 → 392,7 |
* |
* FLAGS:@n |
* - "#" Force to print prefix. |
* For conversion \%o the prefix is 0, for %x and \%X prefixes are 0x and 0X |
* For conversion \%o the prefix is 0, for \%x and \%X prefixes are 0x and 0X |
* and for conversion \%b the prefix is 0b. |
* |
* - "-" Align to left. |
/trunk/kernel/generic/src/proc/task.c |
---|
67,7 → 67,7 |
* The task is guaranteed to exist after it was found in the tasks_btree as long as: |
* @li the tasks_lock is held, |
* @li the task's lock is held when task's lock is acquired before releasing tasks_lock or |
* @li the task's refcount is grater than 0 |
* @li the task's refcount is greater than 0 |
* |
*/ |
btree_t tasks_btree; |
435,7 → 435,7 |
* Now there are no other threads in this task |
* and no new threads can be created. |
*/ |
ipc_cleanup(); |
futex_cleanup(); |
klog_printf("Cleanup of task %lld completed.", TASK->taskid); |
/trunk/kernel/arch/sparc64/_link.ld.in |
---|
43,8 → 43,7 |
} |
/DISCARD/ : { |
*(.comment); |
*(.note*); |
*(*); |
} |
} |
/trunk/kernel/arch/sparc64/include/asm.h |
---|
222,7 → 222,7 |
{ |
uintptr_t v; |
__asm__ volatile ("and %%sp, %1, %0\n" : "=r" (v) : "r" (~(STACK_SIZE-1))); |
__asm__ volatile ("andn %%sp, %1, %0\n" : "=r" (v) : "r" (STACK_SIZE-1)); |
return v; |
} |
/trunk/kernel/arch/sparc64/include/trap/exception.h |
---|
50,6 → 50,8 |
#include <typedefs.h> |
extern void dump_istate(istate_t *istate); |
extern void instruction_access_exception(int n, istate_t *istate); |
extern void instruction_access_error(int n, istate_t *istate); |
extern void illegal_instruction(int n, istate_t *istate); |
/trunk/kernel/arch/sparc64/src/asm.S |
---|
227,23 → 227,17 |
.macro WRITE_ALTERNATE_REGISTER reg, bit |
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp |
rdpr %pstate, %l0 |
wrpr %l0, \bit, %pstate |
mov %i0, \reg |
wrpr %l0, 0, %pstate |
ret |
restore |
wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate |
mov %o0, \reg |
retl |
wrpr %g0, PSTATE_PRIV_BIT, %pstate |
.endm |
.macro READ_ALTERNATE_REGISTER reg, bit |
save %sp, -STACK_WINDOW_SAVE_AREA_SIZE, %sp |
rdpr %pstate, %l0 |
wrpr %l0, \bit, %pstate |
mov \reg, %i0 |
wrpr %l0, 0, %pstate |
ret |
restore |
wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate |
mov \reg, %o0 |
retl |
wrpr %g0, PSTATE_PRIV_BIT, %pstate |
.endm |
.global write_to_ag_g6 |
305,3 → 299,4 |
wrpr %g0, WSTATE_OTHER(0) | WSTATE_NORMAL(1), %wstate |
done ! jump to userspace |
/trunk/kernel/arch/sparc64/src/console.c |
---|
53,6 → 53,7 |
#include <proc/thread.h> |
#include <arch/mm/tlb.h> |
#include <arch/boot/boot.h> |
#include <arch.h> |
#define KEYBOARD_POLL_PAUSE 50000 /* 50ms */ |
79,6 → 80,8 |
*/ |
void kkbdpoll(void *arg) |
{ |
thread_detach(THREAD); |
if (!bootinfo.keyboard.addr) |
return; |
/trunk/kernel/arch/sparc64/src/trap/exception.c |
---|
39,12 → 39,22 |
#include <arch/asm.h> |
#include <debug.h> |
#include <typedefs.h> |
#include <symtab.h> |
#include <print.h> |
void dump_istate(istate_t *istate) |
{ |
printf("TSTATE=%#llx\n", istate->tstate); |
printf("TPC=%#llx (%s)\n", istate->tpc, get_symtab_entry(istate->tpc)); |
printf("TNPC=%#llx (%s)\n", istate->tnpc, get_symtab_entry(istate->tnpc)); |
} |
/** Handle instruction_access_exception. (0x8) */ |
void instruction_access_exception(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle instruction_access_error. (0xa) */ |
51,7 → 61,8 |
void instruction_access_error(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle illegal_instruction. (0x10) */ |
58,7 → 69,8 |
void illegal_instruction(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle privileged_opcode. (0x11) */ |
65,7 → 77,8 |
void privileged_opcode(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle division_by_zero. (0x28) */ |
72,7 → 85,8 |
void division_by_zero(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle data_access_exception. (0x30) */ |
79,7 → 93,8 |
void data_access_exception(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s from %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle data_access_error. (0x32) */ |
86,7 → 101,8 |
void data_access_error(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s from %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle mem_address_not_aligned. (0x34) */ |
93,7 → 109,8 |
void mem_address_not_aligned(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s from %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** Handle privileged_action. (0x37) */ |
100,7 → 117,8 |
void privileged_action(int n, istate_t *istate) |
{ |
fault_if_from_uspace(istate, "%s\n", __FUNCTION__); |
panic("%s at %p.\n", __FUNCTION__, istate->tpc); |
dump_istate(istate); |
panic("%s\n", __FUNCTION__); |
} |
/** @} |
/trunk/kernel/arch/sparc64/src/trap/trap_table.S |
---|
650,7 → 650,6 |
.if NOT(\is_syscall) |
ba 1f |
nop |
0: |
save %sp, -PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE, %sp |
781,7 → 780,7 |
/* |
* OTHERWIN != 0 or fall-through from the OTHERWIN == 0 case. |
* The CWP has already been restored to the value it had prior to the SAVE |
* The CWP has already been restored to the value it had after the SAVE |
* at the beginning of this function. |
*/ |
0: |
/trunk/kernel/arch/sparc64/src/mm/tlb.c |
---|
47,9 → 47,9 |
#include <typedefs.h> |
#include <config.h> |
#include <arch/trap/trap.h> |
#include <arch/trap/exception.h> |
#include <panic.h> |
#include <arch/asm.h> |
#include <symtab.h> |
static void dtlb_pte_copy(pte_t *t, bool ro); |
static void itlb_pte_copy(pte_t *t); |
307,10 → 307,8 |
void do_fast_instruction_access_mmu_miss_fault(istate_t *istate, const char *str) |
{ |
char *tpc_str = get_symtab_entry(istate->tpc); |
fault_if_from_uspace(istate, "%s\n", str); |
printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |
dump_istate(istate); |
panic("%s\n", str); |
} |
317,13 → 315,12 |
void do_fast_data_access_mmu_miss_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str) |
{ |
uintptr_t va; |
char *tpc_str = get_symtab_entry(istate->tpc); |
va = tag.vpn << PAGE_WIDTH; |
fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va, tag.context); |
dump_istate(istate); |
printf("Faulting page: %p, ASID=%d\n", va, tag.context); |
printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |
panic("%s\n", str); |
} |
330,13 → 327,12 |
void do_fast_data_access_protection_fault(istate_t *istate, tlb_tag_access_reg_t tag, const char *str) |
{ |
uintptr_t va; |
char *tpc_str = get_symtab_entry(istate->tpc); |
va = tag.vpn << PAGE_WIDTH; |
fault_if_from_uspace(istate, "%s, Page=%p (ASID=%d)\n", str, va, tag.context); |
printf("Faulting page: %p, ASID=%d\n", va, tag.context); |
printf("TPC=%p, (%s)\n", istate->tpc, tpc_str); |
dump_istate(istate); |
panic("%s\n", str); |
} |
/trunk/kernel/arch/sparc64/src/start.S |
---|
76,15 → 76,15 |
*/ |
mov %o1, %o2 |
mov %o0, %o1 |
set bootinfo, %o0 |
sethi %hi(bootinfo), %o0 |
call memcpy |
nop |
or %o0, %lo(bootinfo), %o0 |
/* |
* Switch to kernel trap table. |
*/ |
set trap_table, %g1 |
wrpr %g1, 0, %tba |
sethi %hi(trap_table), %g1 |
wrpr %g1, %lo(trap_table), %tba |
/* |
* Take over the DMMU by installing global locked |
120,7 → 120,7 |
set PAGESIZE_4M, %r2; \ |
sllx %r2, TTE_SIZE_SHIFT, %r2; \ |
or %r1, %r2, %r1; \ |
set 1, %r2; \ |
mov 1, %r2; \ |
sllx %r2, TTE_V_SHIFT, %r2; \ |
or %r1, %r2, %r1; |
172,7 → 172,7 |
! write ITLB tag of context 1 |
SET_TLB_TAG(g1, MEM_CONTEXT_TEMP) |
set VA_DMMU_TAG_ACCESS, %g2 |
mov VA_DMMU_TAG_ACCESS, %g2 |
stxa %g1, [%g2] ASI_IMMU |
flush %g5 |
182,7 → 182,7 |
flush %g5 |
! switch to context 1 |
set MEM_CONTEXT_TEMP, %g1 |
mov MEM_CONTEXT_TEMP, %g1 |
stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi ! ASI_DMMU is correct here !!! |
flush %g5 |
193,7 → 193,7 |
! write ITLB tag of context 0 |
SET_TLB_TAG(g1, MEM_CONTEXT_KERNEL) |
set VA_DMMU_TAG_ACCESS, %g2 |
mov VA_DMMU_TAG_ACCESS, %g2 |
stxa %g1, [%g2] ASI_IMMU |
flush %g5 |
210,7 → 210,7 |
wrpr %g0, 1, %tl |
! set context 1 in the primary context register |
set MEM_CONTEXT_TEMP, %g1 |
mov MEM_CONTEXT_TEMP, %g1 |
stxa %g1, [VA_PRIMARY_CONTEXT_REG] %asi ! ASI_DMMU is correct here !!! |
flush %g5 |
/trunk/uspace/ns/ns.c |
---|
83,7 → 83,7 |
static void *clockaddr = NULL; |
static void *klogaddr = NULL; |
static void get_as(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr) |
static void get_as_area(ipc_callid_t callid, ipc_call_t *call, char *name, void **addr) |
{ |
void *ph_addr; |
116,10 → 116,10 |
case IPC_M_AS_AREA_RECV: |
switch (IPC_GET_ARG3(call)) { |
case SERVICE_MEM_REALTIME: |
get_as(callid, &call, "clock.faddr", &clockaddr); |
get_as_area(callid, &call, "clock.faddr", &clockaddr); |
break; |
case SERVICE_MEM_KLOG: |
get_as(callid, &call, "klog.faddr", &klogaddr); |
get_as_area(callid, &call, "klog.faddr", &klogaddr); |
break; |
default: |
ipc_answer_fast(callid, ENOENT, 0, 0); |