Added forgotten files

This commit is contained in:
Bahadir Balban
2010-04-06 20:05:35 +03:00
parent a02d08236b
commit aef14b55ec
4 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2010 B Labs
*
* Author: Bahadir Balban
*/
#include <l4lib/arch/arm/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)

View File

@@ -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 <l4/drivers/timer/sp804/timer.h>
#include <l4/generic/irq.h>
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__ */

25
src/arch/arm/v5/atomic.S Normal file
View File

@@ -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)

View File

@@ -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