forked from xuos/xiuos
Add some ipc related comments; Fix one dabort and iabort bug.
This commit is contained in:
parent
f6434bd573
commit
23d6224395
|
@ -31,7 +31,9 @@ MAKEFILES =$(KERNEL_ROOT)/.config
|
||||||
|
|
||||||
export BSP_ROOT ?= $(KERNEL_ROOT)/services/boards/$(BOARD)
|
export BSP_ROOT ?= $(KERNEL_ROOT)/services/boards/$(BOARD)
|
||||||
export UBIQUITOUS_ROOT ?= ..
|
export UBIQUITOUS_ROOT ?= ..
|
||||||
|
ifneq ($(findstring $(BOARD), imx6q-sabrelite zynq7000-zc702), )
|
||||||
include $(KERNEL_ROOT)/hardkernel/arch/arm/armv7-a/cortex-a9/preboot_for_$(BOARD)/config.mk
|
include $(KERNEL_ROOT)/hardkernel/arch/arm/armv7-a/cortex-a9/preboot_for_$(BOARD)/config.mk
|
||||||
|
endif
|
||||||
export BSP_BUILD_DIR := $(KERNEL_ROOT)
|
export BSP_BUILD_DIR := $(KERNEL_ROOT)
|
||||||
export HOSTTOOLS_DIR ?= $(KERNEL_ROOT)/services/tools/hosttools
|
export HOSTTOOLS_DIR ?= $(KERNEL_ROOT)/services/tools/hosttools
|
||||||
export CONFIG2H_EXE ?= $(HOSTTOOLS_DIR)/xsconfig.sh
|
export CONFIG2H_EXE ?= $(HOSTTOOLS_DIR)/xsconfig.sh
|
||||||
|
|
|
@ -91,6 +91,7 @@ void handle_undefined_instruction(struct trapframe* tf)
|
||||||
panic("");
|
panic("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void context_switch(struct context**, struct context*);
|
||||||
void dabort_handler(struct trapframe* r)
|
void dabort_handler(struct trapframe* r)
|
||||||
{
|
{
|
||||||
uint32_t dfs, dfa;
|
uint32_t dfs, dfa;
|
||||||
|
@ -100,15 +101,16 @@ void dabort_handler(struct trapframe* r)
|
||||||
|
|
||||||
if (r->pc < KERN_MEM_BASE) { // Exception occured in User space: exit
|
if (r->pc < KERN_MEM_BASE) { // Exception occured in User space: exit
|
||||||
ERROR("dabort in user space: %s\n", cur_cpu()->task->name);
|
ERROR("dabort in user space: %s\n", cur_cpu()->task->name);
|
||||||
LOG("program counter: 0x%x(%s) caused\n", r->pc, cur_cpu()->task);
|
LOG("program counter: 0x%x caused\n", r->pc);
|
||||||
LOG("data abort at 0x%x, status 0x%x\n", dfa, dfs);
|
LOG("data abort at 0x%x, status 0x%x\n", dfa, dfs);
|
||||||
_abort_reason(dfs);
|
_abort_reason(dfs);
|
||||||
dump_tf(r);
|
dump_tf(r);
|
||||||
}
|
}
|
||||||
if (cur_cpu()->task != NULL) {
|
if (cur_cpu()->task != NULL) {
|
||||||
sys_exit();
|
sys_exit();
|
||||||
|
context_switch(&cur_cpu()->task->main_thread.context, cur_cpu()->scheduler);
|
||||||
} else { // Exception occured in Kernel space: panic
|
} else { // Exception occured in Kernel space: panic
|
||||||
LOG("program counter: 0x%x(%s) caused\n", r->pc, cur_cpu()->task);
|
LOG("program counter: 0x%x caused\n", r->pc);
|
||||||
LOG("data abort at 0x%x, status 0x%x\n", dfa, dfs);
|
LOG("data abort at 0x%x, status 0x%x\n", dfa, dfs);
|
||||||
_abort_reason(dfs);
|
_abort_reason(dfs);
|
||||||
dump_tf(r);
|
dump_tf(r);
|
||||||
|
@ -132,6 +134,7 @@ void iabort_handler(struct trapframe* r)
|
||||||
}
|
}
|
||||||
if (cur_cpu()->task != NULL) {
|
if (cur_cpu()->task != NULL) {
|
||||||
sys_exit();
|
sys_exit();
|
||||||
|
context_switch(&cur_cpu()->task->main_thread.context, cur_cpu()->scheduler);
|
||||||
} else { // Exception occured in Kernel space: panic
|
} else { // Exception occured in Kernel space: panic
|
||||||
LOG("program counter: 0x%x(%s) caused\n", r->pc, cur_cpu()->task);
|
LOG("program counter: 0x%x(%s) caused\n", r->pc, cur_cpu()->task);
|
||||||
LOG("prefetch abort at 0x%x, status 0x%x\n", ifa, ifs);
|
LOG("prefetch abort at 0x%x, status 0x%x\n", ifa, ifs);
|
||||||
|
|
|
@ -23,7 +23,7 @@ INC_DIR = -I$(KERNEL_ROOT)/services/shell/letter-shell \
|
||||||
-I$(KERNEL_ROOT)/services/boards/$(BOARD) \
|
-I$(KERNEL_ROOT)/services/boards/$(BOARD) \
|
||||||
-I$(KERNEL_ROOT)/services/app
|
-I$(KERNEL_ROOT)/services/app
|
||||||
|
|
||||||
all: init simple_client simple_server shell fs_server test_priority readme.txt | bin
|
all: init test_fs simple_client simple_server shell fs_server test_priority readme.txt | bin
|
||||||
../tools/mkfs/mkfs ./fs.img $^
|
../tools/mkfs/mkfs ./fs.img $^
|
||||||
@mv $(filter-out readme.txt, $^) bin
|
@mv $(filter-out readme.txt, $^) bin
|
||||||
@mv *.o bin
|
@mv *.o bin
|
||||||
|
@ -40,6 +40,10 @@ init: init.o libfs_to_client.o libipc.o session.o libserial.o usyscall.o
|
||||||
@${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs}
|
@${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs}
|
||||||
@${objdump} -S $@ > $@.asm
|
@${objdump} -S $@ > $@.asm
|
||||||
|
|
||||||
|
test_fs: test_fs.o libfs_to_client.o libipc.o session.o libserial.o usyscall.o
|
||||||
|
@${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs}
|
||||||
|
@${objdump} -S $@ > $@.asm
|
||||||
|
|
||||||
simple_client: simple_client.o libserial.o libipc.o session.o simple_service.o libfs_to_client.o usyscall.o
|
simple_client: simple_client.o libserial.o libipc.o session.o simple_service.o libfs_to_client.o usyscall.o
|
||||||
@${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs}
|
@${ld} ${user_ldflags} -e main -o $@ $^ ${board_specs}
|
||||||
@${objdump} -S $@ > $@.asm
|
@${objdump} -S $@ > $@.asm
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
#include "simple_service.h"
|
#include "simple_service.h"
|
||||||
#include "usyscall.h"
|
#include "usyscall.h"
|
||||||
|
|
||||||
|
/// @warning all the parameters should in the form of pointers
|
||||||
|
/// for the true storing memory of parameters is session(shared memory between tasks)
|
||||||
int IPC_DO_SERVE_FUNC(Ipc_add)(int* a, int* b)
|
int IPC_DO_SERVE_FUNC(Ipc_add)(int* a, int* b)
|
||||||
{
|
{
|
||||||
return *a + *b;
|
return *a + *b;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "libfs_to_client.h"
|
#include "libfs_to_client.h"
|
||||||
#include "usyscall.h"
|
#include "usyscall.h"
|
||||||
|
|
||||||
|
#define BLOCK_SIZE 256
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
printf("file system test\n");
|
printf("file system test\n");
|
||||||
|
@ -26,8 +27,6 @@ int main(int argc, char* argv[])
|
||||||
struct Session session;
|
struct Session session;
|
||||||
connect_session(&session, "MemFS", 4096);
|
connect_session(&session, "MemFS", 4096);
|
||||||
|
|
||||||
register_server("TEST_FS");
|
|
||||||
|
|
||||||
int fd;
|
int fd;
|
||||||
char* fd_path = "/readme.txt";
|
char* fd_path = "/readme.txt";
|
||||||
fd = open(&session, fd_path);
|
fd = open(&session, fd_path);
|
||||||
|
@ -43,9 +42,12 @@ int main(int argc, char* argv[])
|
||||||
printf("file content: %s\n", buffer);
|
printf("file content: %s\n", buffer);
|
||||||
|
|
||||||
close(&session, fd);
|
close(&session, fd);
|
||||||
|
|
||||||
free_session(&session);
|
free_session(&session);
|
||||||
|
|
||||||
|
printf("file test done.\n");
|
||||||
|
printf("Test memry error %s.\n", 0x50000000);
|
||||||
|
printf("After error computing.\n");
|
||||||
|
|
||||||
exit();
|
exit();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,14 @@ void ipc_server_loop(struct IpcNode* ipc_node);
|
||||||
#define IPC_SERVE(ipc_name) ipc_serve_##ipc_name
|
#define IPC_SERVE(ipc_name) ipc_serve_##ipc_name
|
||||||
#define IPC_DO_SERVE_FUNC(ipc_name) ipc_do_serve_##ipc_name
|
#define IPC_DO_SERVE_FUNC(ipc_name) ipc_do_serve_##ipc_name
|
||||||
|
|
||||||
|
/// when defining a ipc server:
|
||||||
|
/// 1. requires a IPC_SERVICES(server_name, interface_name, ...) to announce the name and interfaces that the server will support
|
||||||
|
/// 2. implement IPC_DO_SERVE_FUNC(interface_name) for each interface
|
||||||
|
/// 3. use IPC_SERVER_INTERFACE(interface_name, argc) to generate necessary helper functions
|
||||||
|
/// 4. use IPC_SERVER_REGISTER_INTERFACES(server_name, nr_interfaces, interface_names, ...) to bind interfaces to server after implementations
|
||||||
|
/// 5. use ipc_server_loop in main()
|
||||||
|
/// Refer to simple_service.h, simple_service.c and simple_server.c for example
|
||||||
|
|
||||||
#define IPC_INTERFACE(ipc_name, argc, ...) \
|
#define IPC_INTERFACE(ipc_name, argc, ...) \
|
||||||
__always_inline static inline struct IpcMsg* IPC_CREATE_MSG_FUNC(ipc_name)(struct Session * session, _VA_FRONT_PTR_ARG##argc(__VA_ARGS__)) \
|
__always_inline static inline struct IpcMsg* IPC_CREATE_MSG_FUNC(ipc_name)(struct Session * session, _VA_FRONT_PTR_ARG##argc(__VA_ARGS__)) \
|
||||||
{ \
|
{ \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
SRC_DIR := init memory trap task syscall ipc
|
SRC_DIR := init memory trap task syscall
|
||||||
|
|
||||||
SRC_FILES := main.c load_apps.S
|
SRC_FILES := main.c load_apps.S
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
SRC_FILES := share_page.c
|
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
|
|
@ -1,3 +1,3 @@
|
||||||
SRC_FILES:= kalloc.c pagetable.c pagetable_level2.c buddy.c object_allocator.c
|
SRC_FILES:= kalloc.c pagetable.c pagetable_level2.c buddy.c object_allocator.c share_page.c
|
||||||
|
|
||||||
include $(KERNEL_ROOT)/compiler.mk
|
include $(KERNEL_ROOT)/compiler.mk
|
||||||
|
|
|
@ -60,7 +60,7 @@ void intr_irq_dispatch(struct trapframe* tf)
|
||||||
|
|
||||||
p_intr_driver->cpu_irq_disable();
|
p_intr_driver->cpu_irq_disable();
|
||||||
// enter irq
|
// enter irq
|
||||||
uint32_t int_info = 0;
|
uintptr_t int_info = 0;
|
||||||
if ((int_info = p_intr_driver->hw_before_irq()) == 0) {
|
if ((int_info = p_intr_driver->hw_before_irq()) == 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue