/trunk/kernel/genarch/src/ofw/ebus.c |
---|
127,7 → 127,7 |
if (!controller) |
return false; |
if (strcmp(ofw_tree_node_name(controller), "pci") != 0) { |
if (str_cmp(ofw_tree_node_name(controller), "pci") != 0) { |
/* |
* This is not a PCI node. |
*/ |
/trunk/kernel/genarch/src/ofw/fhc.c |
---|
66,7 → 66,7 |
*pa = addr; |
return true; |
} |
if (strcmp(ofw_tree_node_name(node->parent), "central") != 0) |
if (str_cmp(ofw_tree_node_name(node->parent), "central") != 0) |
panic("Unexpected parent node: %s.", ofw_tree_node_name(node->parent)); |
ofw_central_reg_t central_reg; |
/trunk/kernel/genarch/src/ofw/ofw_tree.c |
---|
66,7 → 66,7 |
unsigned int i; |
for (i = 0; i < node->properties; i++) { |
if (strcmp(node->property[i].name, name) == 0) |
if (str_cmp(node->property[i].name, name) == 0) |
return &node->property[i]; |
} |
109,7 → 109,7 |
* Try to find the disambigued name. |
*/ |
for (cur = node->child; cur; cur = cur->peer) { |
if (strcmp(cur->da_name, name) == 0) |
if (str_cmp(cur->da_name, name) == 0) |
return cur; |
} |
121,7 → 121,7 |
* are not always fully-qualified. |
*/ |
for (cur = node->child; cur; cur = cur->peer) { |
if (strcmp(ofw_tree_node_name(cur), name) == 0) |
if (str_cmp(ofw_tree_node_name(cur), name) == 0) |
return cur; |
} |
146,7 → 146,7 |
prop = ofw_tree_getprop(cur, "device_type"); |
if (!prop || !prop->value) |
continue; |
if (strcmp(prop->value, name) == 0) |
if (str_cmp(prop->value, name) == 0) |
return cur; |
} |
203,7 → 203,7 |
prop = ofw_tree_getprop(cur, "device_type"); |
if (!prop || !prop->value) |
continue; |
if (strcmp(prop->value, name) == 0) |
if (str_cmp(prop->value, name) == 0) |
return cur; |
} |
229,7 → 229,7 |
prop = ofw_tree_getprop(cur, "name"); |
if (!prop || !prop->value) |
continue; |
if (strcmp(prop->value, name) == 0) |
if (str_cmp(prop->value, name) == 0) |
return cur; |
} |
252,14 → 252,15 |
if (path[0] != '/') |
return NULL; |
for (i = 1; i < str_size(path) && node; i = j + 1) { |
for (j = i; j < str_size(path) && path[j] != '/'; j++) |
; |
if (i == j) /* skip extra slashes */ |
for (i = 1; (i < str_size(path)) && (node); i = j + 1) { |
for (j = i; (j < str_size(path)) && (path[j] != '/'); j++); |
/* Skip extra slashes */ |
if (i == j) |
continue; |
memcpy(buf, &path[i], j - i); |
buf[j - i] = '\0'; |
buf[j - i] = 0; |
node = ofw_tree_find_child(node, buf); |
} |
/trunk/kernel/genarch/src/ofw/pci.c |
---|
58,7 → 58,7 |
prop = ofw_tree_getprop(node, "ranges"); |
if (!prop) { |
if (strcmp(ofw_tree_node_name(node->parent), "pci") == 0) |
if (str_cmp(ofw_tree_node_name(node->parent), "pci") == 0) |
return ofw_pci_apply_ranges(node->parent, reg, pa); |
return false; |
} |
/trunk/kernel/genarch/src/drivers/dsrln/dsrlnout.c |
---|
40,13 → 40,18 |
#include <arch/asm.h> |
#include <console/console.h> |
#include <sysinfo/sysinfo.h> |
#include <string.h> |
static ioport8_t *dsrlnout_base; |
static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const char ch, bool silent) |
static void dsrlnout_putchar(outdev_t *dev __attribute__((unused)), const wchar_t ch, bool silent) |
{ |
if (!silent) |
pio_write_8(dsrlnout_base, ch); |
if (!silent) { |
if (ascii_check(ch)) |
pio_write_8(dsrlnout_base, ch); |
else |
pio_write_8(dsrlnout_base, invalch); |
} |
} |
static outdev_t dsrlnout_console; |
/trunk/kernel/genarch/src/multiboot/multiboot.c |
---|
41,18 → 41,15 |
/** Extract command name from the multiboot module command line. |
* |
* @param buf Destination buffer (will always null-terminate). |
* @param n Size of destination buffer. |
* @param buf Destination buffer (will always NULL-terminate). |
* @param sz Size of destination buffer (in bytes). |
* @param cmd_line Input string (the command line). |
* |
*/ |
static void extract_command(char *buf, size_t n, const char *cmd_line) |
static void extract_command(char *buf, size_t sz, const char *cmd_line) |
{ |
const char *start, *end, *cp; |
size_t max_len; |
/* Find the first space. */ |
end = strchr(cmd_line, ' '); |
const char *end = str_chr(cmd_line, ' '); |
if (end == NULL) |
end = cmd_line + str_size(cmd_line); |
60,20 → 57,19 |
* Find last occurence of '/' before 'end'. If found, place start at |
* next character. Otherwise, place start at beginning of buffer. |
*/ |
cp = end; |
start = buf; |
const char *cp = end; |
const char *start = buf; |
while (cp != start) { |
if (*cp == '/') { |
start = cp + 1; |
break; |
} |
--cp; |
cp--; |
} |
/* Copy the command and null-terminate the string. */ |
max_len = min(n - 1, (size_t) (end - start)); |
strncpy(buf, start, max_len + 1); |
buf[max_len] = '\0'; |
/* Copy the command. */ |
str_ncpy(buf, start, min(sz, (size_t) (end - start) + 1)); |
} |
/** Parse multiboot information structure. |
87,8 → 83,6 |
void multiboot_info_parse(uint32_t signature, const multiboot_info_t *mi) |
{ |
uint32_t flags; |
multiboot_mod_t *mods; |
uint32_t i; |
if (signature == MULTIBOOT_LOADER_MAGIC) |
flags = mi->flags; |
98,10 → 92,11 |
} |
/* Copy module information. */ |
uint32_t i; |
if ((flags & MBINFO_FLAGS_MODS) != 0) { |
init.cnt = min(mi->mods_count, CONFIG_INIT_TASKS); |
mods = (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr); |
multiboot_mod_t *mods |
= (multiboot_mod_t *) MULTIBOOT_PTR(mi->mods_addr); |
for (i = 0; i < init.cnt; i++) { |
init.tasks[i].addr = PA2KA(mods[i].start); |
113,7 → 108,7 |
CONFIG_TASK_NAME_BUFLEN, |
MULTIBOOT_PTR(mods[i].string)); |
} else |
init.tasks[i].name[0] = '\0'; |
init.tasks[i].name[0] = 0; |
} |
} else |
init.cnt = 0; |
120,13 → 115,9 |
/* Copy memory map. */ |
int32_t mmap_length; |
multiboot_mmap_t *mme; |
uint32_t size; |
if ((flags & MBINFO_FLAGS_MMAP) != 0) { |
mmap_length = mi->mmap_length; |
mme = MULTIBOOT_PTR(mi->mmap_addr); |
int32_t mmap_length = mi->mmap_length; |
multiboot_mmap_t *mme = MULTIBOOT_PTR(mi->mmap_addr); |
e820counter = 0; |
i = 0; |
134,7 → 125,7 |
e820table[i++] = mme->mm_info; |
/* Compute address of next structure. */ |
size = sizeof(mme->size) + mme->size; |
uint32_t size = sizeof(mme->size) + mme->size; |
mme = ((void *) mme) + size; |
mmap_length -= size; |
} |
/trunk/kernel/generic/src/main/kinit.c |
---|
186,12 → 186,12 |
char *name; |
name = init.tasks[i].name; |
if (name[0] == '\0') |
if (name[0] == 0) |
name = "<unknown>"; |
ASSERT(TASK_NAME_BUFLEN >= INIT_PREFIX_LEN); |
strncpy(namebuf, INIT_PREFIX, TASK_NAME_BUFLEN); |
strncpy(namebuf + INIT_PREFIX_LEN, name, |
str_ncpy(namebuf, INIT_PREFIX, TASK_NAME_BUFLEN); |
str_ncpy(namebuf + INIT_PREFIX_LEN, name, |
TASK_NAME_BUFLEN - INIT_PREFIX_LEN); |
int rc = program_create_from_image((void *) init.tasks[i].addr, |
/trunk/kernel/generic/src/synch/spinlock.c |
---|
32,9 → 32,9 |
/** |
* @file |
* @brief Spinlocks. |
* @brief Spinlocks. |
*/ |
#include <synch/spinlock.h> |
#include <atomic.h> |
#include <arch/barrier.h> |
/trunk/kernel/generic/src/proc/task.c |
---|
151,7 → 151,7 |
ta->as = as; |
memcpy(ta->name, name, TASK_NAME_BUFLEN); |
ta->name[TASK_NAME_BUFLEN - 1] = '\0'; |
ta->name[TASK_NAME_BUFLEN - 1] = 0; |
atomic_set(&ta->refcount, 0); |
atomic_set(&ta->lifecount, 0); |
273,8 → 273,8 |
if (rc != 0) |
return (unative_t) rc; |
namebuf[name_len] = '\0'; |
strncpy(TASK->name, namebuf, TASK_NAME_BUFLEN); |
namebuf[name_len] = 0; |
str_ncpy(TASK->name, namebuf, TASK_NAME_BUFLEN); |
return EOK; |
} |
/trunk/kernel/generic/src/proc/program.c |
---|
213,7 → 213,7 |
if (rc != 0) |
return (unative_t) rc; |
namebuf[name_len] = '\0'; |
namebuf[name_len] = 0; |
/* Spawn the new task. */ |
/trunk/kernel/generic/src/proc/thread.c |
---|
316,7 → 316,7 |
interrupts_restore(ipl); |
memcpy(t->name, name, THREAD_NAME_BUFLEN); |
t->name[THREAD_NAME_BUFLEN - 1] = '\0'; |
t->name[THREAD_NAME_BUFLEN - 1] = 0; |
t->thread_code = func; |
t->thread_arg = arg; |
723,7 → 723,7 |
if (rc != 0) |
return (unative_t) rc; |
namebuf[name_len] = '\0'; |
namebuf[name_len] = 0; |
/* |
* In case of failure, kernel_uarg will be deallocated in this function. |
/trunk/kernel/arch/sparc64/include/drivers/sgcn.h |
---|
38,16 → 38,16 |
#include <arch/types.h> |
#include <console/chardev.h> |
/* number of bytes in the TOC magic, including the terminating '\0' */ |
/* number of bytes in the TOC magic, including the NULL-terminator */ |
#define TOC_MAGIC_BYTES 8 |
/* number of bytes in the TOC key, including the terminating '\0' */ |
/* number of bytes in the TOC key, including the NULL-terminator */ |
#define TOC_KEY_SIZE 8 |
/* maximum number of entries in the SRAM table of contents */ |
#define MAX_TOC_ENTRIES 32 |
/* number of bytes in the SGCN buffer magic, including the terminating '\0' */ |
/* number of bytes in the SGCN buffer magic, including the NULL-terminator */ |
#define SGCN_MAGIC_BYTES 4 |
/** |
/trunk/kernel/arch/sparc64/src/console.c |
---|
118,7 → 118,7 |
/* "def-cn" = "default console" */ |
prop = ofw_tree_getprop(aliases, "def-cn"); |
if ((!prop) || (!prop->value) || (strcmp(prop->value, "/sgcn") != 0)) { |
if ((!prop) || (!prop->value) || (str_cmp(prop->value, "/sgcn") != 0)) { |
standard_console_init(aliases); |
} else { |
serengeti_init(); |
/trunk/kernel/arch/sparc64/src/sparc64.c |
---|
61,7 → 61,7 |
for (i = 0; i < bootinfo.taskmap.count; i++) { |
init.tasks[i].addr = (uintptr_t) bootinfo.taskmap.tasks[i].addr; |
init.tasks[i].size = bootinfo.taskmap.tasks[i].size; |
strncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, |
str_ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, |
CONFIG_TASK_NAME_BUFLEN); |
} |
/trunk/kernel/arch/sparc64/src/mm/page.c |
---|
62,7 → 62,19 |
*/ |
uintptr_t hw_map(uintptr_t physaddr, size_t size) |
{ |
return PA2KA(physaddr); |
if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) |
panic("Unable to map physical memory %p (%d bytes).", physaddr, size) |
uintptr_t virtaddr = PA2KA(last_frame); |
pfn_t i; |
for (i = 0; i < ADDR2PFN(ALIGN_UP(size, PAGE_SIZE)); i++) { |
uintptr_t addr = PFN2ADDR(i); |
page_mapping_insert(AS_KERNEL, virtaddr + addr, physaddr + addr, PAGE_NOT_CACHEABLE | PAGE_WRITE); |
} |
last_frame = ALIGN_UP(last_frame + size, FRAME_SIZE); |
return virtaddr; |
} |
/** @} |
/trunk/kernel/arch/sparc64/src/drivers/kbd.c |
---|
86,9 → 86,9 |
/* |
* Determine keyboard serial controller type. |
*/ |
if (strcmp(name, "zs") == 0) |
if (str_cmp(name, "zs") == 0) |
kbd_type = KBD_Z8530; |
else if (strcmp(name, "su") == 0) |
else if (str_cmp(name, "su") == 0) |
kbd_type = KBD_NS16550; |
if (kbd_type == KBD_UNKNOWN) { |
/trunk/kernel/arch/sparc64/src/drivers/scr.c |
---|
63,13 → 63,13 |
name = ofw_tree_node_name(node); |
if (strcmp(name, "SUNW,m64B") == 0) |
if (str_cmp(name, "SUNW,m64B") == 0) |
scr_type = SCR_ATYFB; |
else if (strcmp(name, "SUNW,XVR-100") == 0) |
else if (str_cmp(name, "SUNW,XVR-100") == 0) |
scr_type = SCR_XVR; |
else if (strcmp(name, "SUNW,ffb") == 0) |
else if (str_cmp(name, "SUNW,ffb") == 0) |
scr_type = SCR_FFB; |
else if (strcmp(name, "cgsix") == 0) |
else if (str_cmp(name, "cgsix") == 0) |
scr_type = SCR_CGSIX; |
if (scr_type == SCR_UNKNOWN) { |
/trunk/kernel/arch/sparc64/src/drivers/sgcn.c |
---|
207,12 → 207,12 |
init_sram_begin(); |
ASSERT(strcmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0); |
ASSERT(str_cmp(SRAM_TOC->magic, SRAM_TOC_MAGIC) == 0); |
/* lookup TOC entry with the correct key */ |
uint32_t i; |
for (i = 0; i < MAX_TOC_ENTRIES; i++) { |
if (strcmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0) |
if (str_cmp(SRAM_TOC->keys[i].key, CONSOLE_KEY) == 0) |
break; |
} |
ASSERT(i < MAX_TOC_ENTRIES); |
/trunk/kernel/arch/sparc64/src/drivers/pci.c |
---|
183,7 → 183,7 |
/* |
* First, verify this is a PCI node. |
*/ |
ASSERT(strcmp(ofw_tree_node_name(node), "pci") == 0); |
ASSERT(str_cmp(ofw_tree_node_name(node), "pci") == 0); |
/* |
* Determine PCI controller model. |
192,13 → 192,13 |
if (!prop || !prop->value) |
return NULL; |
if (strcmp(prop->value, "SUNW,sabre") == 0) { |
if (str_cmp(prop->value, "SUNW,sabre") == 0) { |
/* |
* PCI controller Sabre. |
* This model is found on UltraSPARC IIi based machines. |
*/ |
return pci_sabre_init(node); |
} else if (strcmp(prop->value, "SUNW,psycho") == 0) { |
} else if (str_cmp(prop->value, "SUNW,psycho") == 0) { |
/* |
* PCI controller Psycho. |
* Used on UltraSPARC II based processors, for instance, |
/trunk/kernel/arch/ia64/src/ia64.c |
---|
87,7 → 87,7 |
((unsigned long) bootinfo->taskmap.tasks[i].addr) | |
VRN_MASK; |
init.tasks[i].size = bootinfo->taskmap.tasks[i].size; |
strncpy(init.tasks[i].name, bootinfo->taskmap.tasks[i].name, |
str_ncpy(init.tasks[i].name, bootinfo->taskmap.tasks[i].name, |
CONFIG_TASK_NAME_BUFLEN); |
} |
} |
/trunk/kernel/arch/ia64/src/ski/ski.c |
---|
41,6 → 41,7 |
#include <synch/spinlock.h> |
#include <arch/asm.h> |
#include <arch/drivers/kbd.h> |
#include <string.h> |
#include <arch.h> |
static indev_t skiin; /**< Ski input device. */ |
48,6 → 49,18 |
static bool kbd_disabled; |
static void ski_do_putchar(const wchar_t ch) |
{ |
asm volatile ( |
"mov r15 = %[cmd]\n" |
"mov r32 = %[ch]\n" /* r32 is in0 */ |
"break 0x80000\n" /* modifies r8 */ |
: |
: [cmd] "i" (SKI_PUTCHAR), [ch] "r" (ch) |
: "r15", "in0", "r8" |
); |
} |
/** Display character on debug console |
* |
* Use SSC (Simulator System Call) to |
56,20 → 69,16 |
* @param d Character device. |
* @param ch Character to be printed. |
*/ |
static void ski_putchar(outdev_t *d, const char ch, bool silent) |
static void ski_putchar(outdev_t *d, const wchar_t ch, bool silent) |
{ |
if (!silent) { |
asm volatile ( |
"mov r15 = %0\n" |
"mov r32 = %1\n" /* r32 is in0 */ |
"break 0x80000\n" /* modifies r8 */ |
: |
: "i" (SKI_PUTCHAR), "r" (ch) |
: "r15", "in0", "r8" |
); |
if (ch == '\n') |
ski_putchar(d, '\r', false); |
if (ascii_check(ch)) { |
if (ch == '\n') |
ski_do_putchar('\r'); |
ski_do_putchar(ch); |
} else |
ski_do_putchar(invalch); |
} |
} |
/trunk/kernel/arch/ia64/src/cpu/cpu.c |
---|
55,7 → 55,7 |
*((uint64_t *) &vendor[0 * sizeof(uint64_t)]) = CPU->arch.cpuid0; |
*((uint64_t *) &vendor[1 * sizeof(uint64_t)]) = CPU->arch.cpuid1; |
vendor[sizeof(vendor) - 1] = '\0'; |
vendor[sizeof(vendor) - 1] = 0; |
switch(m->arch.cpuid3.family) { |
case FAMILY_ITANIUM: |
/trunk/kernel/arch/ia64/src/interrupt.c |
---|
54,6 → 54,7 |
#include <synch/spinlock.h> |
#include <mm/tlb.h> |
#include <symtab.h> |
#include <putchar.h> |
#define VECTORS_64_BUNDLE 20 |
#define VECTORS_16_BUNDLE 48 |
/trunk/kernel/arch/arm32/src/asm.S |
---|
30,6 → 30,7 |
.text |
.global memsetb |
.global memsetw |
.global memcpy |
.global memcpy_from_uspace |
.global memcpy_to_uspace |
39,6 → 40,9 |
memsetb: |
b _memsetb |
memsetw: |
b _memsetw |
memcpy: |
memcpy_from_uspace: |
memcpy_to_uspace: |
/trunk/kernel/arch/arm32/src/arm32.c |
---|
62,7 → 62,7 |
for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); ++i) { |
init.tasks[i].addr = bootinfo->tasks[i].addr; |
init.tasks[i].size = bootinfo->tasks[i].size; |
strncpy(init.tasks[i].name, bootinfo->tasks[i].name, |
str_ncpy(init.tasks[i].name, bootinfo->tasks[i].name, |
CONFIG_TASK_NAME_BUFLEN); |
} |
} |
/trunk/kernel/arch/ppc32/src/asm.S |
---|
34,6 → 34,7 |
.global iret |
.global iret_syscall |
.global memsetb |
.global memsetw |
.global memcpy |
.global memcpy_from_uspace |
.global memcpy_to_uspace |
201,10 → 202,13 |
lwz sp, 160(sp) |
rfi |
memsetb: |
b _memsetb |
memsetw: |
b _memsetw |
memcpy: |
memcpy_from_uspace: |
memcpy_to_uspace: |
/trunk/kernel/arch/ppc32/src/ppc32.c |
---|
61,7 → 61,7 |
for (i = 0; i < min3(bootinfo.taskmap.count, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { |
init.tasks[i].addr = PA2KA(bootinfo.taskmap.tasks[i].addr); |
init.tasks[i].size = bootinfo.taskmap.tasks[i].size; |
strncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, |
str_ncpy(init.tasks[i].name, bootinfo.taskmap.tasks[i].name, |
CONFIG_TASK_NAME_BUFLEN); |
} |
} |
/trunk/kernel/arch/mips32/src/asm.S |
---|
63,6 → 63,12 |
nop |
.global memsetw |
memsetw: |
j _memsetw |
nop |
.global memcpy |
.global memcpy_from_uspace |
.global memcpy_to_uspace |
/trunk/kernel/arch/mips32/src/mips32.c |
---|
91,7 → 91,7 |
for (i = 0; i < min3(bootinfo->cnt, TASKMAP_MAX_RECORDS, CONFIG_INIT_TASKS); i++) { |
init.tasks[i].addr = bootinfo->tasks[i].addr; |
init.tasks[i].size = bootinfo->tasks[i].size; |
strncpy(init.tasks[i].name, bootinfo->tasks[i].name, |
str_ncpy(init.tasks[i].name, bootinfo->tasks[i].name, |
CONFIG_TASK_NAME_BUFLEN); |
} |