Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 989 → Rev 990

/kernel/trunk/generic/src/console/chardev.c
55,15 → 55,15
*/
void chardev_push_character(chardev_t *chardev, __u8 ch)
{
spinlock_lock(&chardev->lock);
spinlock_lock(&chardev->lock);
chardev->counter++;
if (chardev->counter == CHARDEV_BUFLEN - 1) {
/* buffer full => disable device interrupt */
chardev->op->suspend(chardev);
}
 
chardev->buffer[chardev->index++] = ch;
chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */
waitq_wakeup(&chardev->wq, WAKEUP_FIRST);
spinlock_unlock(&chardev->lock);
chardev->buffer[chardev->index++] = ch;
chardev->index = chardev->index % CHARDEV_BUFLEN; /* index modulo size of buffer */
waitq_wakeup(&chardev->wq, WAKEUP_FIRST);
spinlock_unlock(&chardev->lock);
}
/kernel/trunk/arch/ppc32/include/atomic.h
33,17 → 33,32
 
typedef struct { volatile __u32 count; } atomic_t;
 
/*
* TODO: these are just placeholders for real implementations of atomic_inc and atomic_dec.
* WARNING: the following functions cause the code to be preemption-unsafe !!!
*/
static inline void atomic_inc(atomic_t *val) {
__u32 tmp;
 
static inline void atomic_inc(atomic_t *val) {
val->count++;
asm __volatile__ (
"1:\n"
"lwarx %0, 0, %2\n"
"addic %0, %0, 1\n"
"stwcx. %0, 0, %2\n"
"bne- 1b"
: "=&r" (tmp), "=m" (val->count)
: "r" (&val->count), "m" (val->count)
: "cc");
}
 
static inline void atomic_dec(atomic_t *val) {
val->count--;
__u32 tmp;
 
asm __volatile__(
"1:\n"
"lwarx %0, 0, %2\n"
"addic %0, %0, -1\n"
"stwcx. %0, 0, %2\n"
"bne- 1b"
: "=&r" (tmp), "=m" (val->count)
: "r" (&val->count), "m" (val->count)
: "cc");
}
 
static inline void atomic_set(atomic_t *val, __u32 i)
/kernel/trunk/arch/ppc32/include/boot/boot.h
31,4 → 31,7
 
#define BOOT_OFFSET 0x2000
 
/* Temporary stack size for boot process */
#define TEMP_STACK_SIZE 0x100
 
#endif
/kernel/trunk/arch/ppc32/include/context.h
33,7 → 33,7
# include <arch/types.h>
#endif
 
#define SP_DELTA 4
#define SP_DELTA 8
 
struct context {
__address sp;
/kernel/trunk/arch/ppc32/include/barrier.h
32,8 → 32,8
#define CS_ENTER_BARRIER() __asm__ volatile ("" ::: "memory")
#define CS_LEAVE_BARRIER() __asm__ volatile ("" ::: "memory")
 
#define memory_barrier()
#define read_barrier()
#define write_barrier()
#define memory_barrier() __asm__ volatile ("sync" ::: "memory")
#define read_barrier() __asm__ volatile ("sync" ::: "memory")
#define write_barrier() __asm__ volatile ("eieio" ::: "memory")
 
#endif
/kernel/trunk/arch/ppc32/include/drivers/cuda.h
30,4 → 30,7
#define __CUDA_H__
 
 
void cuda_init(void);
 
 
#endif
/kernel/trunk/arch/ppc32/src/exception.S
84,6 → 84,7
.org 0x900
.global exc_decrementer
exc_decrementer:
rfi
b exc_decrementer
 
.org 0xa00
/kernel/trunk/arch/ppc32/src/boot/boot.S
35,7 → 35,12
 
.global kernel_image_start
kernel_image_start:
 
# load temporary stack
lis sp, end_stack@ha
addi sp, sp, end_stack@l
# r10 contains physical address to memmap_t
# from boot loader
69,3 → 74,8
memmap_end:
b main_bsp
 
.section K_DATA_START, "aw", @progbits
.space TEMP_STACK_SIZE
end_stack:
/kernel/trunk/arch/ppc32/src/ppc32.c
28,12 → 28,13
 
#include <arch.h>
#include <arch/console.h>
 
#include <arch/drivers/cuda.h>
#include <arch/mm/memory_init.h>
 
void arch_pre_mm_init(void)
{
ppc32_console_init();
cuda_init();
}
 
void arch_post_mm_init(void)
/kernel/trunk/arch/ppc32/src/drivers/cuda.c
48,6 → 48,11
static volatile __u8 *cuda = (__u8 *) 0xf2000000;
 
 
void cuda_init(void)
{
}
 
 
static void cuda_packet(const __u8 data)
{
cuda[B] = cuda[B] | TIP;