Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2356 → Rev 2357

/branches/arm/kernel/arch/arm32/_link.ld.in
25,7 → 25,7
hardcoded_kdata_size = .;
LONG(kdata_end - kdata_start);
hardcoded_load_address = .;
LONG(KERNEL_LOAD_ADDRESS); /* TODO */
LONG(KERNEL_LOAD_ADDRESS);
*(.bss); /* uninitialized static variables */
*(COMMON); /* global variables */
 
35,9 → 35,6
symbol_table = .;
*(symtab.*);
}
_gp = . + 0x8000;
.lit8 : { *(.lit8) }
.lit4 : { *(.lit4) }
.sbss : {
*(.sbss);
*(.scommon);
/branches/arm/kernel/arch/arm32/include/asm/boot.h
30,7 → 30,7
* @{
*/
/** @file
* @brief Included in assembly boot source.
* @brief Initial kernel start.
*/
 
#ifndef KERN_arm32_ASM_BOOT_H_
37,10 → 37,27
#define KERN_arm32_ASM_BOOT_H_
 
 
/** Size of a temporary stack used for boot process. */
/** Size of a temporary stack used for initial kernel start. */
#define TEMP_STACK_SIZE 0x100
 
#ifndef __ASM__
 
/** Kernel entry point.
*
* Implemented in assembly. Copies boot_bootinfo (declared as bootinfo in
* boot/arch/arm32/loader/main.c) to #bootinfo struct. Then jumps to
* #arch_pre_main and #main_bsp.
*
* @param entry Entry point address (not used).
* @param boot_bootinfo Struct holding information about loaded tasks.
* @param bootinfo_size Size of the bootinfo structure.
*/
void kernel_image_start(void *entry, void *boot_bootinfo, unsigned int bootinfo_size);
 
 
#endif
 
#endif
 
/** @}
*/
/branches/arm/kernel/arch/arm32/include/byteorder.h
29,7 → 29,8
/** @addtogroup arm32
* @{
*/
/** @file Endianness definitions.
/** @file
* @brief Endianness definitions.
*/
 
#ifndef KERN_arm32_BYTEORDER_H_
/branches/arm/kernel/arch/arm32/include/debug/print.h
30,6 → 30,7
* @{
*/
/** @file
* @brief Debug printing functions.
*/
 
#ifndef KERN_arm32_DEBUG_PRINT_H_
41,7 → 42,6
extern void debug_puts(const char *str);
extern void debug_printf(const char *fmt, ...);
 
 
#ifdef CONFIG_DEBUG
# define dprintf(arg1...) debug_printf(arg1)
# define dputs(arg1) debug_puts(arg1)
/branches/arm/kernel/arch/arm32/include/console.h
30,11 → 30,17
* @{
*/
/** @file
* @brief Console.
*/
 
#ifndef KERN_arm32_CONSOLE_H_
#define KERN_arm32_CONSOLE_H_
 
 
/** Initializes console.
*
* @param devno Console device number.
*/
extern void console_init(devno_t devno);
 
#endif
/branches/arm/kernel/arch/arm32/include/boot.h
29,9 → 29,10
/** @addtogroup arm32
* @{
*/
/** @file Bootinfo declarations.
/** @file
* @brief Bootinfo declarations.
*
* Reflects boot/arch/arm32/loader/mm.h.
* Reflects boot/arch/arm32/loader/main.h.
*/
 
#ifndef KERN_arm32_BOOT_H_
/branches/arm/kernel/arch/arm32/include/machine.h
40,15 → 40,51
#include <arch/types.h>
#include <arch/exception.h>
 
 
/** Initializes console.
*
* @param devno Console device number.
*/
extern void machine_console_init(devno_t devno);
 
/** Acquire console back for kernel. */
extern void machine_grab_console(void);
 
/** Return console to userspace. */
extern void machine_release_console(void);
 
/** Maps HW devices to the kernel address space using #hw_map. */
extern void machine_hw_map_init(void);
 
/** Starts timer. */
extern void machine_timer_irq_start(void);
 
/** Halts CPU. */
extern void machine_cpu_halt(void);
 
 
/** Returns size of available memory.
*
* @return Size of available memory.
*/
extern size_t machine_get_memory_size(void);
 
 
/** Prints a character.
*
* @param ch Character to be printed.
*/
extern void machine_debug_putc(char ch);
extern void machine_cpu_halt(void);
 
 
/** Interrupt exception handler.
*
* @param exc_no Interrupt exception number.
* @param istate Saved processor state.
*/
extern void machine_irq_exception(int exc_no, istate_t *istate);
 
 
extern uintptr_t machine_get_fb_address(void);
 
#endif
/branches/arm/kernel/arch/arm32/include/faddr.h
30,6 → 30,7
* @{
*/
/** @file
* @brief Function address conversion.
*/
 
#ifndef KERN_arm32_FADDR_H_
37,6 → 38,10
 
#include <arch/types.h>
 
/** Calculate absolute address of function referenced by fptr pointer.
*
* @param f Function pointer.
*/
#define FADDR(fptr) ((uintptr_t) (fptr))
 
#endif
/branches/arm/kernel/arch/arm32/include/context.h
46,7 → 46,7
 
#include <arch/types.h>
 
/* Struct containing registers that must be preserved across function calls. */
/** Thread context containing registers that must be preserved across function calls. */
typedef struct {
uint32_t cpu_mode;
uintptr_t sp;
/branches/arm/kernel/arch/arm32/include/drivers/gxemul.h
53,6 → 53,7
uintptr_t irqc;
uintptr_t irqc_mask;
uintptr_t irqc_unmask;
uintptr_t fb;
} gxemul_hw_map_t;
 
 
/branches/arm/kernel/arch/arm32/src/ddi/ddi.c
30,6 → 30,7
* @{
*/
/** @file
* @brief DDI, not used on ARM.
*/
 
#include <ddi/ddi.h>
36,7 → 37,7
#include <proc/task.h>
#include <arch/types.h>
 
/** Enable I/O space range for task.
/** Enable I/O space range for task. Not used on ARM.
*
* Interrupts are disabled and task is locked.
*
/branches/arm/kernel/arch/arm32/src/console.c
29,7 → 29,8
/** @addtogroup arm32
* @{
*/
/** @file
/** @file
* @brief Console.
*/
 
 
/branches/arm/kernel/arch/arm32/src/arm32.c
49,6 → 49,7
#include <arch/machine.h>
#include <userspace.h>
 
 
bootinfo_t bootinfo;
extern uintptr_t supervisor_sp;
 
/branches/arm/kernel/arch/arm32/src/context.S
46,7 → 46,6
 
 
context_restore_arch:
 
ldmia r0!, {r4}
mrs r5, cpsr
bic r5, r5, #0x1f
/branches/arm/kernel/arch/arm32/src/debug/print.c
30,6 → 30,7
* @{
*/
/** @file
* @brief Debug print functions.
*/
 
 
83,7 → 84,7
 
/** Prints a string.
*
* @param str String to print
* @param str String to print.
*/
void debug_puts(const char *str)
{
/branches/arm/kernel/arch/arm32/src/cpu/cpu.c
30,6 → 30,7
* @{
*/
/** @file
* @brief CPU identification.
*/
 
#include <arch/cpu.h>
93,11 → 94,13
}
 
 
/** Does nothing on ARM. */
void cpu_arch_init(void)
{
}
 
 
/** Retrieves processor identification and stores it to #CPU.arch */
void cpu_identify(void)
{
arch_cpu_identify(&CPU->arch);
104,6 → 107,7
}
 
 
/** Prints CPU identification. */
void cpu_print_report(cpu_t *m)
{
char * vendor = imp_data[0];
/branches/arm/kernel/arch/arm32/src/dummy.S
1,5 → 1,5
#
# Copyright (c) 2003-2004 Jakub Jermar
# Copyright (c) 2007 Michal Kebry, Pavel Jancik, Petr Stepan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
30,7 → 30,6
 
.global calibrate_delay_loop
.global asm_delay_loop
.global dummy
 
.global fpu_context_restore
.global fpu_context_save
37,8 → 36,8
.global fpu_enable
.global fpu_init
 
.global symbol_table
.global sys_tls_set
.global dummy
 
calibrate_delay_loop:
mov pc, lr
58,14 → 57,8
fpu_init:
mov pc, lr
symbol_table:
bkpt
 
# not used on ARM
sys_tls_set:
bkpt
 
dummy:
 
0:
bkpt
 
mov pc, lr
/branches/arm/kernel/arch/arm32/src/drivers/gxemul.c
83,6 → 83,7
.read = gxemul_do_read,
};
 
 
/** Returns the mask of active interrupts. */
static inline uint32_t gxemul_irqc_get_sources(void)
{
89,6 → 90,7
return *(uint32_t*) gxemul_hw_map.irqc;
}
 
 
/** Masks interrupt.
*
* @param irq interrupt number
98,6 → 100,7
*(uint32_t*) gxemul_hw_map.irqc_mask = irq;
}
 
 
/** Unmasks interrupt.
*
* @param irq interrupt number
107,6 → 110,7
*(uint32_t*) gxemul_hw_map.irqc_unmask = irq;
}
 
 
/** Initializes #gxemul_hw_map. */
void machine_hw_map_init(void)
{
114,6 → 118,7
gxemul_hw_map.kbd = hw_map(GXEMUL_KBD, PAGE_SIZE);
gxemul_hw_map.rtc = hw_map(GXEMUL_RTC, PAGE_SIZE);
gxemul_hw_map.irqc = hw_map(GXEMUL_IRQC, PAGE_SIZE);
gxemul_hw_map.fb = hw_map(GXEMUL_FB, PAGE_SIZE);
 
gxemul_hw_map.rtc_freq = gxemul_hw_map.rtc + GXEMUL_RTC_FREQ_OFFSET;
gxemul_hw_map.rtc_ack = gxemul_hw_map.rtc + GXEMUL_RTC_ACK_OFFSET;
123,6 → 128,7
hw_map_init_called = true;
}
 
 
/** Putchar that works with gxemul */
static void gxemul_write(chardev_t *dev, const char ch)
{
129,6 → 135,7
*((char *) gxemul_hw_map.videoram) = ch;
}
 
 
/* Called from getc(). */
static void gxemul_enable(chardev_t *dev)
{
135,6 → 142,7
gxemul_irqc_unmask(GXEMUL_KBD_IRQ);
}
 
 
/* Called from getc(). */
static void gxemul_disable(chardev_t *dev)
{
141,7 → 149,11
gxemul_irqc_mask(GXEMUL_KBD_IRQ);
}
 
/** Read character using polling, assume interrupts disabled */
 
/** Read character using polling, assume interrupts disabled.
*
* @param dev Not used.
*/
static char gxemul_do_read(chardev_t *dev)
{
char ch;
158,28 → 170,33
}
}
 
 
/** Process keyboard interrupt. */
static void gxemul_irq_handler(irq_t *irq, void *arg, ...)
{
if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox))
if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) {
ipc_irq_send_notif(irq);
else {
} else {
char ch = 0;
ch = *((char *) gxemul_hw_map.kbd);
if (ch =='\r')
ch = '\n';
if (ch == 0x7f)
ch = '\b';
chardev_push_character(&console, ch);
ch = *((char *) gxemul_hw_map.kbd);
if (ch == '\r') {
ch = '\n';
}
if (ch == 0x7f) {
ch = '\b';
}
chardev_push_character(&console, ch);
}
}
 
 
static irq_ownership_t gxemul_claim(void)
{
return IRQ_ACCEPT;
}
 
 
void machine_grab_console(void)
{
ipl_t ipl = interrupts_disable();
189,18 → 206,23
interrupts_restore(ipl);
}
 
 
void machine_release_console(void)
{
ipl_t ipl = interrupts_disable();
spinlock_lock(&gxemul_irq.lock);
if (gxemul_irq.notif_cfg.answerbox)
if (gxemul_irq.notif_cfg.answerbox) {
gxemul_irq.notif_cfg.notify = true;
}
spinlock_unlock(&gxemul_irq.lock);
interrupts_restore(ipl);
}
 
 
/** Return console object representing gxemul console */
/** Initializes console object representing gxemul console.
*
* @param Console device number.
*/
void machine_console_init(devno_t devno)
{
chardev_initialize("gxemul_console", &console, &gxemul_ops);
226,7 → 248,7
 
/** Starts gxemul Real Time Clock device, which asserts regular interrupts.
*
* @param frequency interrupts frequency (0 disables RTC)
* @param frequency Interrupts frequency (0 disables RTC).
*/
static void gxemul_timer_start(uint32_t frequency)
{
233,14 → 255,17
*(uint32_t*) gxemul_hw_map.rtc_freq = frequency;
}
 
 
static irq_ownership_t gxemul_timer_claim(void)
{
return IRQ_ACCEPT;
}
 
 
/** Timer interrupt handler.
*
* @param irq interrupt information
* @param irq Interrupt information.
* @param arg Not used.
*/
static void gxemul_timer_irq_handler(irq_t *irq, void *arg, ...)
{
273,8 → 298,8
*/
}
 
/** Initializes and registers timer interrupt handler.
*/
 
/** Initializes and registers timer interrupt handler. */
static void gxemul_timer_irq_init()
{
irq_initialize(&gxemul_timer_irq);
286,6 → 311,7
irq_register(&gxemul_timer_irq);
}
 
 
/** Starts timer.
*
* Initiates regular timer interrupts after initializing
297,9 → 323,10
gxemul_timer_start(GXEMUL_TIMER_FREQ);
}
 
 
/** Returns the size of emulated memory.
*
* @return size in bytes
* @return Size in bytes.
*/
size_t machine_get_memory_size(void)
{
306,6 → 333,7
return *((int*)(GXEMUL_MP + GXEMUL_MP_MEMSIZE_OFFSET));
}
 
 
void machine_debug_putc(char ch)
{
char * addr = 0;
318,6 → 346,7
*(addr) = ch;
}
 
 
/** Stops gxemul. */
void machine_cpu_halt(void)
{
331,13 → 360,14
*(addr + GXEMUL_HALT_OFFSET) = '\0';
}
 
 
/** Gxemul specific interrupt exception handler.
*
* Determines sources of the interrupt from interrupt controller and
* calls high-level handlers for them.
*
* @param exc_no interrupt exception number
* @param istate saved processor state
* @param exc_no Interrupt exception number.
* @param istate Saved processor state.
*/
void machine_irq_exception(int exc_no, istate_t *istate)
{
359,5 → 389,10
}
 
 
uintptr_t machine_get_fb_address(void)
{
return gxemul_hw_map.fb;
}
 
/** @}
*/