minix/kernel/arch/earm/include/arch_proto.h
Kees Jongenburger a0f912a9ff arm:no longer rely on a 1:1 phys mapping for device memory.
Change-Id: Ie3f61069f882c37dbb81dee813fdfd883e7468cf
2013-06-12 10:26:51 +02:00

100 lines
2.8 KiB
C

#ifndef _ARM_PROTO_H
#define _ARM_PROTO_H
#include <machine/vm.h>
#define K_STACK_SIZE ARM_PAGE_SIZE
#ifndef __ASSEMBLY__
#include "cpufunc.h"
/* klib */
__dead void reset(void);
phys_bytes vir2phys(void *);
vir_bytes phys_memset(phys_bytes ph, u32_t c, phys_bytes bytes);
void __switch_address_space(struct proc *p, struct proc **__ptproc);
#define switch_address_space(proc) \
__switch_address_space(proc, get_cpulocal_var_ptr(ptproc))
void __copy_msg_from_user_end(void);
void __copy_msg_to_user_end(void);
void __user_copy_msg_pointer_failure(void);
/* multiboot.c */
void multiboot_init(void);
/* protect.c */
struct tss_s {
reg_t sp0; /* stack pointer to use during interrupt */
} __attribute__((packed));
int tss_init(unsigned cpu, void * kernel_stack);
void add_memmap(kinfo_t *cbi, u64_t addr, u64_t len);
phys_bytes alloc_lowest(kinfo_t *cbi, phys_bytes len);
void vm_enable_paging(void);
void cut_memmap(kinfo_t *cbi, phys_bytes start, phys_bytes end);
phys_bytes pg_roundup(phys_bytes b);
void pg_info(reg_t *, u32_t **);
void pg_clear(void);
void pg_identity(kinfo_t *);
phys_bytes pg_load(void);
void pg_map(phys_bytes phys, vir_bytes vaddr, vir_bytes vaddr_end, kinfo_t *cbi);
int pg_mapkernel(void);
void pg_mapproc(struct proc *p, struct boot_image *ip, kinfo_t *cbi);
EXTERN void * k_stacks_start;
extern void * k_stacks;
#define get_k_stack_top(cpu) ((void *)(((char*)(k_stacks)) \
+ 2 * ((cpu) + 1) * K_STACK_SIZE))
/*
* Definition of a callback used when a memory map changes it's base address
*/
typedef int (*kern_phys_map_mapped)(vir_bytes id, vir_bytes new_addr );
/*
* struct used internally by memory.c to keep a list of
* items to map. These should be staticaly allocated
* in the individual files and passed as argument.
* The data doesn't need to be initialized. See omap_serial for
* and example usage.
*/
typedef struct kern_phys_map{
phys_bytes addr; /* The physical address to map */
vir_bytes size; /* The size of the mapping */
vir_bytes id; /* an id passed to the callback */
kern_phys_map_mapped cb; /* the callback itself */
phys_bytes vir; /* The virtual address once remapped */
int index; /* index */
struct kern_phys_map *next; /* pointer to the next */
} kern_phys_map ;
/*
* Request a physical mapping.
*/
int kern_req_phys_map( phys_bytes base_address, vir_bytes io_size,
kern_phys_map * priv, kern_phys_map_mapped cb,
vir_bytes id);
/*
* Request a physical mapping and put the result in the given prt
* Note that ptr will only be valid once the callback happend.
*/
int kern_phys_map_ptr( phys_bytes base_address, vir_bytes io_size,
kern_phys_map * priv, vir_bytes ptr);
/* functions defined in architecture-independent kernel source. */
#include "kernel/proto.h"
#endif /* __ASSEMBLY__ */
#endif