mirror of
https://github.com/drasko/codezero.git
synced 2026-01-12 02:43:15 +01:00
Initial commit
This commit is contained in:
1
tasks/blkdev0/include/arch
Symbolic link
1
tasks/blkdev0/include/arch
Symbolic link
@@ -0,0 +1 @@
|
||||
arch-arm
|
||||
23
tasks/blkdev0/include/blkdev.h
Normal file
23
tasks/blkdev0/include/blkdev.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef __BLKDEV_H__
|
||||
#define __BLKDEV_H__
|
||||
|
||||
struct block_device;
|
||||
|
||||
struct block_device_ops {
|
||||
void (*open)(struct block_device *bdev);
|
||||
void (*read)(unsigned long offset, int size, void *buf);
|
||||
void (*write)(unsigned long offset, int size, void *buf);
|
||||
void (*read_page)(unsigned long pfn, void *buf);
|
||||
void (*write_page)(unsigned long pfn, void *buf);
|
||||
};
|
||||
|
||||
struct block_device {
|
||||
char *name;
|
||||
unsigned long size;
|
||||
struct block_device_ops ops;
|
||||
};
|
||||
|
||||
|
||||
void init_blkdev(void);
|
||||
|
||||
#endif /* __BLKDEV_H__ */
|
||||
43
tasks/blkdev0/include/linker.lds
Normal file
43
tasks/blkdev0/include/linker.lds
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Simple linker script for userspace or svc tasks.
|
||||
*
|
||||
* Copyright (C) 2007 Bahadir Balban
|
||||
*/
|
||||
|
||||
/*
|
||||
* The only catch with this linker script is that everything
|
||||
* is linked starting at virtual_base, and loaded starting
|
||||
* at physical_base. virtual_base is the predefined region
|
||||
* of virtual memory for userland applications. physical_base
|
||||
* is determined at build-time, it is one of the subsequent pages
|
||||
* that come after the kernel image's load area.
|
||||
*/
|
||||
/* USER_AREA_START, see memlayout.h */
|
||||
virtual_base = 0x10000000;
|
||||
__stack = 0x20000000;
|
||||
INCLUDE "include/physical_base.lds"
|
||||
|
||||
/* physical_base = 0x228000; */
|
||||
offset = virtual_base - physical_base;
|
||||
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = virtual_base;
|
||||
_start_text = .;
|
||||
.text : AT (ADDR(.text) - offset) { crt0.o(.text) *(.text) }
|
||||
/* rodata is needed else your strings will link at physical! */
|
||||
.rodata : AT (ADDR(.rodata) - offset) { *(.rodata) }
|
||||
.rodata1 : AT (ADDR(.rodata1) - offset) { *(.rodata1) }
|
||||
.data : AT (ADDR(.data) - offset)
|
||||
{
|
||||
. = ALIGN(4K);
|
||||
_start_ramdisk = .;
|
||||
*(.data.fs)
|
||||
_end_ramdisk = .;
|
||||
*(.data)
|
||||
}
|
||||
.bss : AT (ADDR(.bss) - offset) { *(.bss) }
|
||||
_end = .;
|
||||
}
|
||||
17
tasks/blkdev0/include/physical_base.lds
Normal file
17
tasks/blkdev0/include/physical_base.lds
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* The next free p_align'ed LMA base address
|
||||
*
|
||||
* p_align = 0x8000
|
||||
*
|
||||
* Recap from ELF spec: p_align: Loadable process segments must have
|
||||
* congruent values for p_vaddr and p_offset, modulo the page size.
|
||||
* This member gives the value to which the segments are aligned in
|
||||
* memory and in the file. Values 0 and 1 mean that no alignment is
|
||||
* required. Otherwise, p_align should be a positive, integral power
|
||||
* of 2, and p_addr should equal p_offset, modulo p_align.
|
||||
* This essentially means next available address must be aligned at
|
||||
* p_align, rather than the page_size, which one (well, I) would
|
||||
* normally expect.
|
||||
*/
|
||||
|
||||
physical_base = 0x3000;
|
||||
6
tasks/blkdev0/include/ramdisk.h
Normal file
6
tasks/blkdev0/include/ramdisk.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __RAMDISK_H__
|
||||
#define __RAMDISK_H__
|
||||
|
||||
extern struct block_device ramdisk;
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user