From 901bf4bada7bbba17bc8f1dcf36334a5b615e62f Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sat, 27 Nov 2010 12:23:08 +0800 Subject: [PATCH] Build fixes - reworked usermode builds to merge libacess.so and ld-acess.so - Also fixed some compile errors/warnings in x86 MM --- Kernel/arch/x86/mm_virt.c | 4 ++-- Kernel/arch/x86/start.asm | 2 +- Makefile | 7 +++++-- Usermode/Applications/Makefile.tpl | 4 ++++ Usermode/Libraries/Makefile.cfg | 2 +- Usermode/Libraries/acess.ld_src/Makefile | 2 +- Usermode/Libraries/acess.ld_src/acess.ld.h | 4 ++-- Usermode/Libraries/ld-acess.so_src/main.c | 4 ++++ 8 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Kernel/arch/x86/mm_virt.c b/Kernel/arch/x86/mm_virt.c index 2a23d3f7..8882f38e 100644 --- a/Kernel/arch/x86/mm_virt.c +++ b/Kernel/arch/x86/mm_virt.c @@ -306,7 +306,7 @@ void MM_DumpTables(tVAddr Start, tVAddr End) rangeStart, curPos - 1, gaPageTable[rangeStart>>12] & ~0xFFF, (expected & ~0xFFF) - 1, - (expected & PF_PAGED ? "p" : "-"), + (expected & PF_NOPAGE ? "P" : "-"), (expected & PF_COW ? "C" : "-"), (expected & PF_USER ? "U" : "-"), (expected & PF_WRITE ? "W" : "-") @@ -327,7 +327,7 @@ void MM_DumpTables(tVAddr Start, tVAddr End) rangeStart, curPos - 1, gaPageTable[rangeStart>>12] & ~0xFFF, (expected & ~0xFFF) - 1, - (expected & PF_PAGED ? "p" : "-"), + (expected & PF_NOPAGE ? "p" : "-"), (expected & PF_COW ? "C" : "-"), (expected & PF_USER ? "U" : "-"), (expected & PF_WRITE ? "W" : "-") diff --git a/Kernel/arch/x86/start.asm b/Kernel/arch/x86/start.asm index 0988a773..d161e699 100644 --- a/Kernel/arch/x86/start.asm +++ b/Kernel/arch/x86/start.asm @@ -22,7 +22,7 @@ mboot: dd MULTIBOOT_HEADER_MAGIC dd MULTIBOOT_HEADER_FLAGS dd MULTIBOOT_CHECKSUM - dd mboot - KERNEL_BASE ;Location of Multiboot Header + dd mboot; - KERNEL_BASE ;Location of Multiboot Header ; Multiboot 2 Header ;mboot2: diff --git a/Makefile b/Makefile index bc4f1483..f67dd3cd 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,12 @@ SUBMAKE = $(MAKE) --no-print-directory -USRLIBS := crt0.o acess.ld ld-acess.so libacess.so libgcc.so libc.so libnet.so +USRLIBS := crt0.o acess.ld ld-acess.so libgcc.so libc.so +USRLIBS += libreadline.so libnet.so liburi.so + USRAPPS := init login CLIShell cat ls mount -USRAPPS += ifconfig ping +USRAPPS += bomb pcidump +USRAPPS += ifconfig ping irc ALL_DYNMODS = $(addprefix all-,$(DYNMODS)) ALL_MODULES := $(addprefix all-,$(MODULES)) diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl index aadfbdba..b82e7ac1 100644 --- a/Usermode/Applications/Makefile.tpl +++ b/Usermode/Applications/Makefile.tpl @@ -19,7 +19,11 @@ install: $(BIN) $(BIN): $(OBJ) @echo --- $(LD) -o $@ +ifneq ($(_DBGMAKEFILE),) + $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map Map.txt +else @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map Map.txt +endif @objdump -d -S $(BIN) > $(BIN).dsm $(OBJ): %.o: %.c diff --git a/Usermode/Libraries/Makefile.cfg b/Usermode/Libraries/Makefile.cfg index 78e39fb9..159ab1ef 100644 --- a/Usermode/Libraries/Makefile.cfg +++ b/Usermode/Libraries/Makefile.cfg @@ -8,4 +8,4 @@ MAKEDEP = $(CC) -M ASFLAGS = -felf CPPFLAGS = -I$(ACESSDIR)/Usermode/include/ CFLAGS = -g -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS) -LDFLAGS = -g -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L.. -lacess +LDFLAGS = -g -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L.. diff --git a/Usermode/Libraries/acess.ld_src/Makefile b/Usermode/Libraries/acess.ld_src/Makefile index 405ec203..fa819fa8 100644 --- a/Usermode/Libraries/acess.ld_src/Makefile +++ b/Usermode/Libraries/acess.ld_src/Makefile @@ -13,4 +13,4 @@ clean: install: ../acess.ld ../acess.ld: acess.ld.h - cpp -nostdinc -U i386 -P -C $< -o $@ -DACESSDIR=$(ACESSDIR) + cpp -nostdinc -U i386 -P -C $< -o $@ -D__LIBDIR=$(ACESSDIR)/Usermode/Libraries diff --git a/Usermode/Libraries/acess.ld_src/acess.ld.h b/Usermode/Libraries/acess.ld_src/acess.ld.h index 54e56f1b..c059c79d 100644 --- a/Usermode/Libraries/acess.ld_src/acess.ld.h +++ b/Usermode/Libraries/acess.ld_src/acess.ld.h @@ -1,8 +1,8 @@ OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) ENTRY(start) -SEARCH_DIR(ACESSDIR/Usermode/Libraries) -INPUT(crt0.o) +SEARCH_DIR(__LIBDIR) +INPUT(crt0.o ld-acess.so) SECTIONS { /* Read-only sections, merged into text segment: */ diff --git a/Usermode/Libraries/ld-acess.so_src/main.c b/Usermode/Libraries/ld-acess.so_src/main.c index c3a7c278..4f2ef88b 100644 --- a/Usermode/Libraries/ld-acess.so_src/main.c +++ b/Usermode/Libraries/ld-acess.so_src/main.c @@ -12,6 +12,7 @@ // === Imports === extern void gLinkedBase; +extern tLoadedLib gLoadedLibraries[]; // === CODE === /** @@ -35,6 +36,9 @@ int SoMain(Uint base, int arg1) _exit(1); for(;;); } + + gLoadedLibraries[0].Base = (Uint)&gLinkedBase; + gLoadedLibraries[0].Name = "ld-acess.so"; // Otherwise do relocations //ret = DoRelocate( base, envp, "Executable" ); -- 2.20.1