diff --git a/conts/libl4/src/arch/arm/v5/atomic.S b/conts/libl4/src/arch/arm/v5/atomic.S new file mode 100644 index 0000000..c9cefc3 --- /dev/null +++ b/conts/libl4/src/arch/arm/v5/atomic.S @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 B Labs + * + * Author: Bahadir Balban + */ + +#include + +/* + * Atomically and destructively reads a byte. E.g. + * byte is read and zero is written back. This is + * useful on reading irq counts + * + * @r0 = byte address + */ +BEGIN_PROC(l4_atomic_dest_readb) + mov r1, #0 + swpb r2, r1, [r0] + mov r0, r2 + mov pc, lr +END_PROC(l4_atomic_dest_readb) + + + + diff --git a/include/l4/platform/realview/irq.h b/include/l4/platform/realview/irq.h new file mode 100644 index 0000000..bb249de --- /dev/null +++ b/include/l4/platform/realview/irq.h @@ -0,0 +1,18 @@ +/* + * Platform encapsulation over timer driver. + * + * Copyright (C) 2007 Bahadir Balban + */ + +#ifndef __PLATFORM_REALVIEW_IRQ_H__ +#define __PLATFORM_REALVIEW_IRQ_H__ + +#include +#include + +int platform_timer_user_handler(struct irq_desc *desc); +int platform_keyboard_user_handler(struct irq_desc *desc); +int platform_mouse_user_handler(struct irq_desc *desc); +int platform_timer_handler(struct irq_desc *desc); + +#endif /* __PLATFORM_REALVIEW_IRQ_H__ */ diff --git a/src/arch/arm/v5/atomic.S b/src/arch/arm/v5/atomic.S new file mode 100644 index 0000000..4b2fdfb --- /dev/null +++ b/src/arch/arm/v5/atomic.S @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2010 B Labs + * + * Author: Bahadir Balban + */ + +#include INC_ARCH(asm.h) + +/* + * Atomically and destructively reads a byte. E.g. + * byte is read and zero is written back. This is + * useful on reading irq counts + * + * @r0 = byte address + */ +BEGIN_PROC(l4_atomic_dest_readb) + mov r1, #0 + swpb r2, r1, [r0] + mov r0, r2 + mov pc, lr +END_PROC(l4_atomic_dest_readb) + + + + diff --git a/tools/pyelf/elf_section_info.py b/tools/pyelf/elf_section_info.py new file mode 100644 index 0000000..5339488 --- /dev/null +++ b/tools/pyelf/elf_section_info.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import elf + +# Define section markers for various sections in elf +def elf_loadable_section_info(img): + elffile = elf.ElfFile.from_file(img) + + # Sections markers for RW sections + rw_sections_start = 0 + rw_sections_end = 0 + + # Section markers for RX and RO section combined + rx_sections_start = 0 + rx_sections_end = 0 + + # Flag encoding used by elf + sh_flag_write = 1 << 0 + sh_flag_load = 1 << 1 + sh_flag_execute = 1 << 2 + + for sheader in elffile.sheaders: + x = sheader.ai + + # Check for loadable sections + if x.sh_flags.get() & sh_flag_load: + start = x.sh_addr.get() + end = start + x.sh_size.get() + + # RW Section + if x.sh_flags.get() & sh_flag_write: + if (rw_sections_start == 0) or (rw_sections_start > start): + rw_sections_start = start + if (rw_sections_end == 0) or (rw_sections_end < end): + rw_sections_end = end + + # RX, RO Section + else: + if (rx_sections_start == 0) or (rx_sections_start > start): + rx_sections_start = start + if (rx_sections_end == 0) or (rx_sections_end < end): + rx_sections_end = end + + return rw_sections_start, rw_sections_end, \ + rx_sections_start, rx_sections_end +