- Timestamp:
- 2009-11-03T21:36:54Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1647323
- Parents:
- bbddafb (diff), b1c21c2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- kernel
- Files:
-
- 3 added
- 6 deleted
- 18 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
rbbddafb r4f5dc18 27 27 # 28 28 29 include Makefile.common 29 30 30 ## Include configuration 31 # 31 .PHONY: all clean 32 32 33 include ../version 34 -include ../Makefile.config 35 -include ../config.defs 36 37 INCLUDES = generic/include 38 OPTIMIZATION = 3 39 40 ifndef CROSS_PREFIX 41 CROSS_PREFIX = /usr/local 42 endif 43 44 ## Common compiler flags 45 # 46 47 DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__ 48 49 GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \ 50 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \ 51 -finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \ 52 -Wmissing-prototypes -Werror -nostdlib -nostdinc -pipe 53 54 ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \ 55 -fno-builtin -Wall -Wmissing-prototypes -Werror \ 56 -nostdlib -nostdinc -wd170 57 58 SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \ 59 -xnolib -xc99=all -features=extensions \ 60 -erroff=E_ZERO_SIZED_STRUCT_UNION 61 62 CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \ 63 -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \ 64 -finput-charset=UTF-8 -fno-builtin -Wall -Wextra -Wno-unused-parameter \ 65 -Wmissing-prototypes -nostdlib -nostdinc -pipe 66 67 LFLAGS = -M 68 AFLAGS = 69 70 -include arch/$(KARCH)/Makefile.inc 71 -include genarch/Makefile.inc 72 73 ## The at-sign 74 # 75 # The $(ATSIGN) variable holds the ASCII character representing the at-sign 76 # ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that 77 # don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on 78 # those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be 79 # defined as the percentile-sign ('%') in the architecture-dependent 80 # Makefile.inc. 81 # 82 ATSIGN ?= @ 83 84 ## Cross-platform assembly to start a symtab.data section 85 # 86 SYMTAB_SECTION=".section symtab.data, \"a\", $(ATSIGN)progbits;" 87 88 ## Simple detection for the type of the host system 89 # 90 HOST = $(shell uname) 91 92 ## On Solaris, some utilities have slightly different names 93 # 94 ifeq ($(HOST),SunOS) 95 BINUTILS_PREFIX = "g" 96 else 97 BINUTILS_PREFIX = "" 98 endif 99 100 ## Toolchain configuration 101 # 102 103 ifeq ($(COMPILER),gcc_native) 104 CC = gcc 105 GCC = gcc 106 AS = $(BINUTILS_PREFIX)as 107 LD = $(BINUTILS_PREFIX)ld 108 OBJCOPY = $(BINUTILS_PREFIX)objcopy 109 OBJDUMP = $(BINUTILS_PREFIX)objdump 110 LIBDIR = /usr/lib 111 CFLAGS = $(GCC_CFLAGS) 112 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 113 endif 114 115 ifeq ($(COMPILER),gcc_cross) 116 CC = $(TOOLCHAIN_DIR)/bin/$(TARGET)-gcc 117 GCC = $(CC) 118 AS = $(TOOLCHAIN_DIR)/bin/$(TARGET)-as 119 LD = $(TOOLCHAIN_DIR)/bin/$(TARGET)-ld 120 OBJCOPY = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objcopy 121 OBJDUMP = $(TOOLCHAIN_DIR)/bin/$(TARGET)-objdump 122 LIBDIR = $(TOOLCHAIN_DIR)/lib 123 CFLAGS = $(GCC_CFLAGS) 124 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 125 endif 126 127 ifeq ($(COMPILER),icc) 128 CC = icc 129 GCC = gcc 130 AS = as 131 LD = ld 132 OBJCOPY = objcopy 133 OBJDUMP = objdump 134 LIBDIR = /usr/lib 135 CFLAGS = $(ICC_CFLAGS) 136 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 137 endif 138 139 ifeq ($(COMPILER),suncc) 140 CC = suncc 141 GCC = gcc 142 AS = $(BINUTILS_PREFIX)as 143 LD = $(BINUTILS_PREFIX)ld 144 OBJCOPY = $(BINUTILS_PREFIX)objcopy 145 OBJDUMP = $(BINUTILS_PREFIX)objdump 146 LIBDIR = /usr/lib 147 CFLAGS = $(SUNCC_CFLAGS) 148 DEFS += $(CONFIG_DEFS) 149 DEPEND_DEFS = $(DEFS) 150 endif 151 152 ifeq ($(COMPILER),clang) 153 CC = clang 154 GCC = gcc 155 AS = $(BINUTILS_PREFIX)as 156 LD = $(BINUTILS_PREFIX)ld 157 OBJCOPY = $(BINUTILS_PREFIX)objcopy 158 OBJDUMP = $(BINUTILS_PREFIX)objdump 159 LIBDIR = /usr/lib 160 CFLAGS = $(CLANG_CFLAGS) 161 DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS) 162 endif 163 164 ## Generic kernel sources 165 # 166 167 GENERIC_SOURCES = \ 168 generic/src/adt/avl.c \ 169 generic/src/adt/bitmap.c \ 170 generic/src/adt/btree.c \ 171 generic/src/adt/hash_table.c \ 172 generic/src/adt/list.c \ 173 generic/src/console/chardev.c \ 174 generic/src/console/console.c \ 175 generic/src/cpu/cpu.c \ 176 generic/src/ddi/ddi.c \ 177 generic/src/ddi/irq.c \ 178 generic/src/ddi/device.c \ 179 generic/src/debug/symtab.c \ 180 generic/src/interrupt/interrupt.c \ 181 generic/src/main/main.c \ 182 generic/src/main/kinit.c \ 183 generic/src/main/uinit.c \ 184 generic/src/main/version.c \ 185 generic/src/main/shutdown.c \ 186 generic/src/proc/program.c \ 187 generic/src/proc/scheduler.c \ 188 generic/src/proc/thread.c \ 189 generic/src/proc/task.c \ 190 generic/src/proc/the.c \ 191 generic/src/proc/tasklet.c \ 192 generic/src/syscall/syscall.c \ 193 generic/src/syscall/copy.c \ 194 generic/src/mm/buddy.c \ 195 generic/src/mm/frame.c \ 196 generic/src/mm/page.c \ 197 generic/src/mm/tlb.c \ 198 generic/src/mm/as.c \ 199 generic/src/mm/backend_anon.c \ 200 generic/src/mm/backend_elf.c \ 201 generic/src/mm/backend_phys.c \ 202 generic/src/mm/slab.c \ 203 generic/src/lib/func.c \ 204 generic/src/lib/memstr.c \ 205 generic/src/lib/sort.c \ 206 generic/src/lib/string.c \ 207 generic/src/lib/elf.c \ 208 generic/src/lib/rd.c \ 209 generic/src/printf/printf_core.c \ 210 generic/src/printf/printf.c \ 211 generic/src/printf/snprintf.c \ 212 generic/src/printf/vprintf.c \ 213 generic/src/printf/vsnprintf.c \ 214 generic/src/time/clock.c \ 215 generic/src/time/timeout.c \ 216 generic/src/time/delay.c \ 217 generic/src/preempt/preemption.c \ 218 generic/src/synch/spinlock.c \ 219 generic/src/synch/condvar.c \ 220 generic/src/synch/rwlock.c \ 221 generic/src/synch/mutex.c \ 222 generic/src/synch/semaphore.c \ 223 generic/src/synch/smc.c \ 224 generic/src/synch/waitq.c \ 225 generic/src/synch/futex.c \ 226 generic/src/smp/ipi.c \ 227 generic/src/smp/smp.c \ 228 generic/src/ipc/ipc.c \ 229 generic/src/ipc/sysipc.c \ 230 generic/src/ipc/ipcrsc.c \ 231 generic/src/ipc/irq.c \ 232 generic/src/ipc/event.c \ 233 generic/src/security/cap.c \ 234 generic/src/sysinfo/sysinfo.c 235 236 ## Kernel console support 237 # 238 239 ifeq ($(CONFIG_KCONSOLE),y) 240 GENERIC_SOURCES += \ 241 generic/src/console/kconsole.c \ 242 generic/src/console/cmd.c 243 endif 244 245 ## Udebug interface sources 246 # 247 248 ifeq ($(CONFIG_UDEBUG),y) 249 GENERIC_SOURCES += \ 250 generic/src/ipc/kbox.c \ 251 generic/src/udebug/udebug.c \ 252 generic/src/udebug/udebug_ops.c \ 253 generic/src/udebug/udebug_ipc.c 254 endif 255 256 ## Test sources 257 # 258 259 ifeq ($(CONFIG_TEST),y) 260 CFLAGS += -Itest/ 261 GENERIC_SOURCES += \ 262 test/test.c \ 263 test/atomic/atomic1.c \ 264 test/btree/btree1.c \ 265 test/avltree/avltree1.c \ 266 test/fault/fault1.c \ 267 test/mm/falloc1.c \ 268 test/mm/falloc2.c \ 269 test/mm/mapping1.c \ 270 test/mm/slab1.c \ 271 test/mm/slab2.c \ 272 test/synch/rwlock1.c \ 273 test/synch/rwlock2.c \ 274 test/synch/rwlock3.c \ 275 test/synch/rwlock4.c \ 276 test/synch/rwlock5.c \ 277 test/synch/semaphore1.c \ 278 test/synch/semaphore2.c \ 279 test/print/print1.c \ 280 test/print/print2.c \ 281 test/print/print3.c \ 282 test/print/print4.c \ 283 test/thread/thread1.c \ 284 test/sysinfo/sysinfo1.c 285 286 ifeq ($(KARCH),mips32) 287 GENERIC_SOURCES += test/debug/mips1.c 288 else 289 GENERIC_SOURCES += test/debug/mips1_skip.c 290 endif 291 292 ifeq ($(KARCH),ia64) 293 GENERIC_SOURCES += test/mm/purge1.c 294 else 295 GENERIC_SOURCES += test/mm/purge1_skip.c 296 endif 297 298 ifeq ($(CONFIG_FPU),y) 299 ifeq ($(KARCH),ia32) 300 TEST_FPU1 = y 301 TEST_SSE1 = y 302 GENERIC_SOURCES += test/fpu/fpu1_x86.c 303 endif 304 305 ifeq ($(KARCH),amd64) 306 TEST_FPU1 = y 307 TEST_SSE1 = y 308 GENERIC_SOURCES += test/fpu/fpu1_x86.c 309 endif 310 311 ifeq ($(KARCH),ia64) 312 TEST_FPU1 = y 313 GENERIC_SOURCES += test/fpu/fpu1_ia64.c 314 endif 315 316 ifeq ($(KARCH),mips32) 317 TEST_MIPS2 = y 318 endif 319 endif 320 321 ifneq ($(TEST_FPU1),y) 322 GENERIC_SOURCES += test/fpu/fpu1_skip.c 323 endif 324 325 ifeq ($(TEST_SSE1),y) 326 GENERIC_SOURCES += test/fpu/sse1.c 327 else 328 GENERIC_SOURCES += test/fpu/sse1_skip.c 329 endif 330 331 ifeq ($(TEST_MIPS2),y) 332 GENERIC_SOURCES += test/fpu/mips2.c 333 else 334 GENERIC_SOURCES += test/fpu/mips2_skip.c 335 endif 336 337 endif 338 339 GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES))) 340 ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES))) 341 GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES))) 342 343 ifeq ($(CONFIG_SYMTAB),y) 344 SYMTAB_OBJECTS := generic/src/debug/real_map.o 345 else 346 SYMTAB_OBJECTS := 347 endif 348 349 .PHONY: all build clean archlinks depend disasm 350 351 all: ../Makefile.config ../config.h ../config.defs 352 -rm Makefile.depend 353 $(MAKE) -C . build 354 355 build: kernel.bin disasm 356 357 -include Makefile.depend 33 all: ../version ../Makefile.config ../config.h ../config.defs 34 -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV) 35 $(MAKE) -f Makefile.build 358 36 359 37 clean: 360 -rm -f kernel.bin kernel.raw kernel.map kernel.map.pre kernel.objdump kernel.disasm generic/src/debug/real_map.bin Makefile.depend* generic/include/arch generic/include/genarch arch/$(KARCH)/_link.ld38 rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld 361 39 find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \; 362 for arch in arch/* ; do \363 [ -e $$arch/_link.ld ] && rm $$arch/_link.ld 2>/dev/null ; \364 done ; exit 0365 366 archlinks:367 ln -sfn ../../arch/$(KARCH)/include/ generic/include/arch368 ln -sfn ../../genarch/include/ generic/include/genarch369 370 depend: archlinks371 -makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > Makefile.depend 2> /dev/null372 373 arch/$(KARCH)/_link.ld: arch/$(KARCH)/_link.ld.in374 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@375 376 generic/src/debug/real_map.bin: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)377 echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o generic/src/debug/empty_map.o378 $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/empty_map.o -o $@ -Map kernel.map.pre379 $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump380 tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin381 # Do it once again, this time to get correct even the symbols382 # on architectures, that have bss after symtab383 echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o generic/src/debug/sizeok_map.o384 $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) generic/src/debug/sizeok_map.o -o $@ -Map kernel.map.pre385 $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > kernel.objdump386 tools/genmap.py kernel.map.pre kernel.objdump generic/src/debug/real_map.bin387 388 generic/src/debug/real_map.o: generic/src/debug/real_map.bin389 echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@390 391 kernel.raw: depend arch/$(KARCH)/_link.ld $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)392 $(LD) -T arch/$(KARCH)/_link.ld $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map kernel.map393 394 kernel.bin: kernel.raw395 $(OBJCOPY) -O $(BFD) kernel.raw kernel.bin396 397 disasm: kernel.raw398 $(OBJDUMP) -d kernel.raw > kernel.disasm399 400 %.o: %.S401 $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@402 403 %.o: %.s404 $(AS) $(AFLAGS) $< -o $@405 406 #407 # The FPU tests are the only objects for which we allow the compiler to generate408 # FPU instructions.409 #410 test/fpu/%.o: test/fpu/%.c411 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@412 413 #414 # Ordinary objects.415 #416 %.o: %.c417 $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@ -
kernel/arch/amd64/Makefile.inc
rbbddafb r4f5dc18 34 34 BFD = binary 35 35 TARGET = amd64-linux-gnu 36 CLANG_ARCH = x86_64 36 37 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64 37 38 -
kernel/arch/amd64/src/cpu/cpu.c
rbbddafb r4f5dc18 130 130 CPU->arch.vendor = VendorUnknown; 131 131 if (has_cpuid()) { 132 cpuid( 0, &info);132 cpuid(INTEL_CPUID_LEVEL, &info); 133 133 134 134 /* … … 150 150 } 151 151 152 cpuid( 1, &info);152 cpuid(INTEL_CPUID_STANDARD, &info); 153 153 CPU->arch.family = (info.cpuid_eax >> 8) & 0xf; 154 154 CPU->arch.model = (info.cpuid_eax >> 4) & 0xf; -
kernel/arch/ia32/Makefile.inc
rbbddafb r4f5dc18 34 34 BFD = binary 35 35 TARGET = i686-pc-linux-gnu 36 CLANG_ARCH = i386 36 37 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia32 37 38 -
kernel/arch/ia32/include/cpu.h
rbbddafb r4f5dc18 50 50 #include <arch/pm.h> 51 51 #include <arch/asm.h> 52 #include <arch/cpuid.h> 52 53 53 54 typedef struct { … … 56 57 unsigned int model; 57 58 unsigned int stepping; 59 cpuid_feature_info fi; 60 58 61 tss_t *tss; 59 62 -
kernel/arch/ia32/include/cpuid.h
rbbddafb r4f5dc18 63 63 64 64 struct __cpuid_feature_info { 65 unsigned : 23; 65 unsigned : 11; 66 unsigned sep : 1; 67 unsigned : 11; 66 68 unsigned mmx : 1; 67 69 unsigned fxsr : 1; -
kernel/arch/ia32/src/boot/boot.S
rbbddafb r4f5dc18 85 85 pse_supported: 86 86 87 bt $(INTEL_SEP), %edx88 jc sep_supported89 90 movl $sep_msg, %esi91 jmp error_halt92 93 sep_supported:94 95 87 #include "vesa_prot.inc" 96 88 … … 225 217 .asciz "Page Size Extension not supported. System halted." 226 218 227 sep_msg:228 .asciz "SYSENTER/SYSEXIT not supported. System halted." -
kernel/arch/ia32/src/cpu/cpu.c
rbbddafb r4f5dc18 92 92 void cpu_arch_init(void) 93 93 { 94 cpuid_feature_info fi;95 94 cpuid_extended_feature_info efi; 96 95 cpu_info_t info; … … 102 101 CPU->fpu_owner = NULL; 103 102 104 cpuid( 1, &info);103 cpuid(INTEL_CPUID_STANDARD, &info); 105 104 106 fi.word = info.cpuid_edx;105 CPU->arch.fi.word = info.cpuid_edx; 107 106 efi.word = info.cpuid_ecx; 108 107 109 if ( fi.bits.fxsr)108 if (CPU->arch.fi.bits.fxsr) 110 109 fpu_fxsr(); 111 110 else 112 111 fpu_fsr(); 113 112 114 if ( fi.bits.sse) {113 if (CPU->arch.fi.bits.sse) { 115 114 asm volatile ( 116 115 "mov %%cr4, %[help]\n" … … 122 121 } 123 122 124 /* Setup fast SYSENTER/SYSEXIT syscalls */ 125 syscall_setup_cpu(); 123 if (CPU->arch.fi.bits.sep) { 124 /* Setup fast SYSENTER/SYSEXIT syscalls */ 125 syscall_setup_cpu(); 126 } 126 127 } 127 128 … … 132 133 CPU->arch.vendor = VendorUnknown; 133 134 if (has_cpuid()) { 134 cpuid( 0, &info);135 cpuid(INTEL_CPUID_LEVEL, &info); 135 136 136 137 /* … … 150 151 CPU->arch.vendor = VendorIntel; 151 152 152 cpuid( 1, &info);153 cpuid(INTEL_CPUID_STANDARD, &info); 153 154 CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f; 154 155 CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f; -
kernel/arch/ia32/src/proc/scheduler.c
rbbddafb r4f5dc18 61 61 SP_DELTA]; 62 62 63 /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */ 64 write_msr(IA32_MSR_SYSENTER_ESP, kstk); 63 if (CPU->arch.fi.bits.sep) { 64 /* Set kernel stack for CP3 -> CPL0 switch via SYSENTER */ 65 write_msr(IA32_MSR_SYSENTER_ESP, kstk); 66 } 65 67 66 68 /* Set kernel stack for CPL3 -> CPL0 switch via interrupt */ -
kernel/arch/ia32/src/userspace.c
rbbddafb r4f5dc18 70 70 "movl %[uarg], %%eax\n" 71 71 72 /* %e bxis defined to hold pcb_ptr - set it to 0 */73 "xorl %%e bx, %%ebx\n"72 /* %edi is defined to hold pcb_ptr - set it to 0 */ 73 "xorl %%edi, %%edi\n" 74 74 75 75 "iret\n" -
kernel/genarch/Makefile.inc
rbbddafb r4f5dc18 59 59 ifeq ($(CONFIG_SOFTINT),y) 60 60 GENARCH_SOURCES += \ 61 genarch/src/softint/division.c 61 genarch/src/softint/division.c \ 62 genarch/src/softint/multiplication.c 62 63 endif 63 64 -
kernel/genarch/include/softint/multiplication.h
rbbddafb r4f5dc18 1 1 /* 2 * Copyright (c) 200 5 Ondrej Palkovsky2 * Copyright (c) 2009 Josef Cejka 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup amd6429 /** @addtogroup genarch 30 30 * @{ 31 */ 32 /** @file 31 */ 32 /** 33 * @file 33 34 */ 34 35 35 #ifndef KERN_amd64_ARG_H_36 #define KERN_amd64_ARG_H_36 #ifndef __SOFTINT_MULTIPLICATION_H__ 37 #define __SOFTINT_MULTIPLICATION_H__ 37 38 38 #include <stdarg.h> 39 /* 64 bit multiplication */ 40 long long __muldi3(long long a, long long b); 39 41 40 42 #endif … … 43 45 */ 44 46 47 -
kernel/generic/include/context.h
rbbddafb r4f5dc18 51 51 /** Save register context. 52 52 * 53 * Save current register context (including stack pointers) 54 * to context structure. 55 * 56 * Note that call to context_restore() will return at the same 53 * Save the current register context (including stack pointer) to a context 54 * structure. A subsequent call to context_restore() will return to the same 57 55 * address as the corresponding call to context_save(). 58 56 * 59 * This MUST be a macro, gcc -O0 does not inline functions even 60 * if they are marked inline and context_save_arch must be called 61 * from level <= that when context_restore is called. 57 * Note that context_save_arch() must reuse the stack frame of the function 58 * which called context_save(). We guarantee this by: 62 59 * 63 * @param c Context structure. 60 * a) implementing context_save_arch() in assembly so that it does not create 61 * its own stack frame, and by 62 * b) defining context_save() as a macro because the inline keyword is just a 63 * hint for the compiler, not a real constraint; the application of a macro 64 * will definitely not create a stack frame either. 64 65 * 65 * @return context_save() returns 1, context_restore() returns 0. 66 * To imagine what could happen if there were some extra stack frames created 67 * either by context_save() or context_save_arch(), we need to realize that the 68 * sp saved in the contex_t structure points to the current stack frame as it 69 * existed when context_save_arch() was executing. After the return from 70 * context_save_arch() and context_save(), any extra stack frames created by 71 * these functions will be destroyed and their contents sooner or later 72 * overwritten by functions called next. Any attempt to restore to a context 73 * saved like that would therefore lead to a disaster. 74 * 75 * @param c Context structure. 76 * 77 * @return context_save() returns 1, context_restore() returns 0. 66 78 */ 67 79 #define context_save(c) context_save_arch(c) … … 69 81 /** Restore register context. 70 82 * 71 * Restore previously saved register context (including stack pointers)72 * fromcontext structure.83 * Restore a previously saved register context (including stack pointer) from 84 * a context structure. 73 85 * 74 * Note that this function does not normally return. 75 * Instead, it returns at the same address as the 76 * corresponding call to context_save(), the only 77 * difference being return value. 86 * Note that this function does not normally return. Instead, it returns to the 87 * same address as the corresponding call to context_save(), the only difference 88 * being return value. 78 89 * 79 * @param c 90 * @param c Context structure. 80 91 */ 81 92 static inline void context_restore(context_t *c) -
kernel/generic/include/print.h
rbbddafb r4f5dc18 37 37 38 38 #include <arch/types.h> 39 #include < arch/arg.h>39 #include <stdarg.h> 40 40 41 41 #define EOF (-1) -
kernel/generic/include/printf/printf_core.h
rbbddafb r4f5dc18 37 37 38 38 #include <typedefs.h> 39 #include < arch/arg.h>39 #include <stdarg.h> 40 40 41 41 /** Structure for specifying output methods for different printf clones. */ -
kernel/generic/include/stdarg.h
rbbddafb r4f5dc18 27 27 */ 28 28 29 /** @addtogroup generic 29 /** @addtogroup generic 30 30 * @{ 31 31 */ … … 37 37 * for all architectures with compiler support for __builtin_va_*. 38 38 */ 39 39 40 40 #ifndef KERN_STDARG_H_ 41 41 #define KERN_STDARG_H_ … … 43 43 typedef __builtin_va_list va_list; 44 44 45 #define va_start(ap, last) 46 #define va_arg(ap, type) 47 #define va_end(ap) 48 #define va_copy(dst, src) 45 #define va_start(ap, last) __builtin_va_start(ap, last) 46 #define va_arg(ap, type) __builtin_va_arg(ap, type) 47 #define va_end(ap) __builtin_va_end(ap) 48 #define va_copy(dst, src) __builtin_va_copy(dst, src) 49 49 50 50 #endif -
kernel/generic/src/console/cmd.c
rbbddafb r4f5dc18 409 409 }; 410 410 411 /* Data and methods for 'kill' command */ 412 static int cmd_kill(cmd_arg_t *argv); 413 static cmd_arg_t kill_argv = { 414 .type = ARG_TYPE_INT, 415 }; 416 static cmd_info_t kill_info = { 417 .name = "kill", 418 .description = "kill <taskid> Kill a task.", 419 .func = cmd_kill, 420 .argc = 1, 421 .argv = &kill_argv 422 }; 423 411 424 /* Data and methods for 'zone' command */ 412 425 static int cmd_zone(cmd_arg_t *argv); … … 459 472 &help_info, 460 473 &ipc_info, 474 &kill_info, 461 475 &set4_info, 462 476 &slabs_info, … … 848 862 * @return Always 1 849 863 */ 850 int cmd_slabs(cmd_arg_t * argv) { 864 int cmd_slabs(cmd_arg_t * argv) 865 { 851 866 slab_print_list(); 852 867 return 1; … … 860 875 * @return Always 1 861 876 */ 862 int cmd_threads(cmd_arg_t * argv) { 877 int cmd_threads(cmd_arg_t * argv) 878 { 863 879 thread_print_list(); 864 880 return 1; … … 871 887 * @return Always 1 872 888 */ 873 int cmd_tasks(cmd_arg_t * argv) { 889 int cmd_tasks(cmd_arg_t * argv) 890 { 874 891 task_print_list(); 875 892 return 1; … … 882 899 * @return Always 1 883 900 */ 884 int cmd_sched(cmd_arg_t * argv) { 901 int cmd_sched(cmd_arg_t * argv) 902 { 885 903 sched_print_list(); 886 904 return 1; … … 893 911 * return Always 1 894 912 */ 895 int cmd_zones(cmd_arg_t * argv) { 913 int cmd_zones(cmd_arg_t * argv) 914 { 896 915 zone_print_list(); 897 916 return 1; … … 904 923 * return Always 1 905 924 */ 906 int cmd_zone(cmd_arg_t * argv) { 925 int cmd_zone(cmd_arg_t * argv) 926 { 907 927 zone_print_one(argv[0].intval); 908 928 return 1; … … 915 935 * return Always 1 916 936 */ 917 int cmd_ipc(cmd_arg_t * argv) { 937 int cmd_ipc(cmd_arg_t * argv) 938 { 918 939 ipc_print_task(argv[0].intval); 919 940 return 1; 920 941 } 921 942 943 /** Command for killing a task 944 * 945 * @param argv Integer argument from cmdline expected 946 * 947 * return 0 on failure, 1 on success. 948 */ 949 int cmd_kill(cmd_arg_t * argv) 950 { 951 if (task_kill(argv[0].intval) != EOK) 952 return 0; 953 954 return 1; 955 } 922 956 923 957 /** Command for listing processors. -
kernel/generic/src/ipc/kbox.c
rbbddafb r4f5dc18 137 137 /* Only detach kbox thread unless already terminating. */ 138 138 mutex_lock(&TASK->kb.cleanup_lock); 139 if ( &TASK->kb.finished == false) {139 if (TASK->kb.finished == false) { 140 140 /* Detach kbox thread so it gets freed from memory. */ 141 141 thread_detach(TASK->kb.thread); -
kernel/generic/src/printf/printf_core.c
rbbddafb r4f5dc18 39 39 #include <printf/printf_core.h> 40 40 #include <print.h> 41 #include < arch/arg.h>41 #include <stdarg.h> 42 42 #include <macros.h> 43 43 #include <string.h>
Note:
See TracChangeset
for help on using the changeset viewer.