Changes in / [571addd:1720cf9] in mainline
- Files:
-
- 1 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r571addd r1720cf9 498 498 @ "1152x720" 499 499 @ "1152x864" 500 @ "1280x720"501 @ "1280x800"502 500 @ "1280x960" 503 501 @ "1280x1024" … … 546 544 ! CONFIG_BAREBONE (n/y) 547 545 548 % Line debugging information549 ! [CONFIG_STRIP_BINARIES!=y] CONFIG_LINE_DEBUG (n/y) -
boot/Makefile.build
r571addd r1720cf9 61 61 GCC_CFLAGS += -Werror 62 62 ICC_CFLAGS += -Werror 63 endif64 65 ifeq ($(CONFIG_LINE_DEBUG),y)66 GCC_CFLAGS += -g67 ICC_CFLAGS += -g68 SUNCC_CFLAGS += -g69 CLANG_CFLAGS += -g70 63 endif 71 64 -
boot/arch/arm32/Makefile.inc
r571addd r1720cf9 54 54 $(COMPS_C) \ 55 55 genarch/src/division.c \ 56 generic/src/memstr.c \57 56 generic/src/printf_core.c \ 58 57 generic/src/vprintf.c \ -
boot/arch/arm32/src/asm.S
r571addd r1720cf9 35 35 .global boot_stack 36 36 .global halt 37 .global memcpy 37 38 .global jump_to_kernel 38 39 … … 54 55 b halt 55 56 57 memcpy: 58 add r3, r1, #3 59 bic r3, r3, #3 60 cmp r1, r3 61 stmdb sp!, {r4, r5, lr} 62 mov r5, r0 63 beq 4f 64 65 1: 66 cmp r2, #0 67 movne ip, #0 68 beq 3f 69 70 2: 71 ldrb r3, [ip, r1] 72 strb r3, [ip, r0] 73 add ip, ip, #1 74 cmp ip, r2 75 bne 2b 76 77 3: 78 mov r0, r5 79 ldmia sp!, {r4, r5, pc} 80 81 4: 82 add r3, r0, #3 83 bic r3, r3, #3 84 cmp r0, r3 85 bne 1b 86 movs r4, r2, lsr #2 87 moveq lr, r4 88 beq 6f 89 mov lr, #0 90 mov ip, lr 91 92 5: 93 ldr r3, [ip, r1] 94 add lr, lr, #1 95 cmp lr, r4 96 str r3, [ip, r0] 97 add ip, ip, #4 98 bne 5b 99 100 6: 101 ands r4, r2, #3 102 beq 3b 103 mov r3, lr, lsl #2 104 add r0, r3, r0 105 add ip, r3, r1 106 mov r2, #0 107 108 7: 109 ldrb r3, [r2, ip] 110 strb r3, [r2, r0] 111 add r2, r2, #1 112 cmp r2, r4 113 bne 7b 114 b 3b 115 56 116 jump_to_kernel: 57 117 # -
boot/arch/ia64/Makefile.inc
r571addd r1720cf9 49 49 genarch/src/division.c \ 50 50 generic/src/balloc.c \ 51 generic/src/memstr.c \52 51 generic/src/printf_core.c \ 53 52 generic/src/vprintf.c \ -
boot/arch/ia64/src/asm.S
r571addd r1720cf9 1 1 # 2 2 # Copyright (c) 2006 Martin Decky 3 # Copyright (c) 2006 Jakub Jermar 3 # Copyright (c) 2006 Jakub Jermar 4 4 # All rights reserved. 5 5 # … … 39 39 br halt 40 40 41 memcpy: 42 alloc loc0 = ar.pfs, 3, 1, 0, 0 43 44 adds r14 = 7, in1 45 mov r2 = ar.lc 46 mov r8 = in0 ;; 47 and r14 = -8, r14 ;; 48 cmp.ne p6, p7 = r14, in1 49 (p7) br.cond.dpnt 3f ;; 50 0: 51 cmp.ne p6, p7 = 0, in2 52 (p7) br.cond.dpnt 2f ;; 53 (p6) adds r14 = -1, in2 54 (p6) mov r16 = r0 55 (p6) mov r17 = r0 ;; 56 (p6) mov ar.lc = r14 57 1: 58 add r14 = r16, in1 59 add r15 = r16, in0 60 adds r17 = 1, r17 ;; 61 ld1 r14 = [r14] 62 mov r16 = r17 ;; 63 st1 [r15] = r14 64 br.cloop.sptk.few 1b ;; 65 2: 66 mov ar.lc = r2 67 mov ar.pfs = loc0 68 br.ret.sptk.many rp 69 3: 70 adds r14 = 7, in0 ;; 71 and r14 = -8, r14 ;; 72 cmp.eq p6, p7 = r14, in0 73 (p7) br.cond.dptk 0b 74 shr.u r18 = in2, 3 ;; 75 cmp.ne p6, p7 = 0, r18 76 (p7) br.cond.dpnt 5f ;; 77 (p6) adds r14 = -1, r18 78 (p6) mov r16 = r0 79 (p6) mov r17 = r0 ;; 80 (p6) mov ar.lc = r14 81 4: 82 shladd r14 = r16, 3, r0 83 adds r16 = 1, r17 ;; 84 add r15 = in1, r14 85 add r14 = in0, r14 86 mov r17 = r16 ;; 87 ld8 r15 = [r15] ;; 88 st8 [r14] = r15 89 br.cloop.sptk.few 4b 90 5: 91 and r15 = 7, in2 92 shladd r14 = r18, 3, r0 93 mov r16 = r0 94 mov r18 = r0 ;; 95 cmp.eq p6, p7 = 0, r15 96 add in0 = r14, in0 97 adds r15 = -1, r15 98 add r17 = r14, in1 99 (p6) br.cond.dpnt 2b ;; 100 mov ar.lc = r15 101 6: 102 add r14 = r16, r17 103 add r15 = r16, in0 104 adds r16 = 1, r18 ;; 105 ld1 r14 = [r14] 106 mov r18 = r16 ;; 107 st1 [r15] = r14 108 br.cloop.sptk.few 6b ;; 109 mov ar.lc = r2 110 mov ar.pfs = loc0 111 br.ret.sptk.many rp 112 41 113 jump_to_kernel: 42 114 alloc loc0 = ar.pfs, 1, 1, 0, 0 -
boot/arch/mips32/Makefile.inc
r571addd r1720cf9 61 61 genarch/src/division.c \ 62 62 genarch/src/multiplication.c \ 63 generic/src/memstr.c \64 63 generic/src/printf_core.c \ 65 64 generic/src/vprintf.c \ -
boot/arch/mips32/src/asm.S
r571addd r1720cf9 36 36 .global start 37 37 .global halt 38 .global memcpy 38 39 .global jump_to_kernel 39 40 … … 125 126 j halt 126 127 nop 128 129 memcpy: 130 addiu $v0, $a1, 3 131 li $v1, -4 132 and $v0, $v0, $v1 133 beq $a1, $v0, 3f 134 move $t0, $a0 135 move $t2, $a0 136 137 0: 138 beq $a2, $zero, 2f 139 move $a3, $zero 140 141 1: 142 addu $v0, $a1, $a3 143 lbu $a0, 0($v0) 144 addu $v1, $t0, $a3 145 addiu $a3, $a3, 1 146 bne $a3, $a2, 1b 147 sb $a0, 0($v1) 148 149 2: 150 jr $ra 151 move $v0, $t2 152 153 3: 154 addiu $v0, $a0, 3 155 and $v0, $v0, $v1 156 bne $a0, $v0, 0b 157 srl $t1, $a2, 2 158 159 beq $t1, $zero, 5f 160 move $a3, $zero 161 162 move $a3, $zero 163 move $a0, $zero 164 165 4: 166 addu $v0, $a1, $a0 167 lw $v1, 0($v0) 168 addiu $a3, $a3, 1 169 addu $v0, $t0, $a0 170 sw $v1, 0($v0) 171 bne $a3, $t1, 4b 172 addiu $a0, $a0, 4 173 174 5: 175 andi $a2, $a2, 0x3 176 beq $a2, $zero, 2b 177 nop 178 179 sll $v0, $a3, 2 180 addu $t1, $v0, $t0 181 move $a3, $zero 182 addu $t0, $v0, $a1 183 184 6: 185 addu $v0, $t0, $a3 186 lbu $a0, 0($v0) 187 addu $v1, $t1, $a3 188 addiu $a3, $a3, 1 189 bne $a3, $a2, 6b 190 sb $a0, 0($v1) 191 192 jr $ra 193 move $v0, $t2 127 194 128 195 jump_to_kernel: -
boot/arch/ppc32/Makefile.inc
r571addd r1720cf9 56 56 genarch/src/multiplication.c \ 57 57 generic/src/balloc.c \ 58 generic/src/memstr.c \59 58 generic/src/printf_core.c \ 60 59 generic/src/vprintf.c \ -
boot/arch/ppc32/src/asm.S
r571addd r1720cf9 60 60 .global start 61 61 .global halt 62 .global memcpy 62 63 .global jump_to_kernel 63 64 .global real_mode … … 77 78 halt: 78 79 b halt 80 81 memcpy: 82 srwi. r7, r5, 3 83 addi r6, r3, -4 84 addi r4, r4, -4 85 beq 2f 86 87 andi. r0, r6, 3 88 mtctr r7 89 bne 5f 90 91 1: 92 lwz r7, 4(r4) 93 lwzu r8, 8(r4) 94 stw r7, 4(r6) 95 stwu r8, 8(r6) 96 bdnz 1b 97 98 andi. r5, r5, 7 99 100 2: 101 cmplwi 0, r5, 4 102 blt 3f 103 104 lwzu r0, 4(r4) 105 addi r5, r5, -4 106 stwu r0, 4(r6) 107 108 3: 109 cmpwi 0, r5, 0 110 beqlr 111 mtctr r5 112 addi r4, r4, 3 113 addi r6, r6, 3 114 115 4: 116 lbzu r0, 1(r4) 117 stbu r0, 1(r6) 118 bdnz 4b 119 blr 120 121 5: 122 subfic r0, r0, 4 123 mtctr r0 124 125 6: 126 lbz r7, 4(r4) 127 addi r4, r4, 1 128 stb r7, 4(r6) 129 addi r6, r6, 1 130 bdnz 6b 131 subf r5, r0, r5 132 rlwinm. r7, r5, 32-3, 3, 31 133 beq 2b 134 mtctr r7 135 b 1b 79 136 80 137 jump_to_kernel: -
boot/arch/sparc64/Makefile.inc
r571addd r1720cf9 54 54 genarch/src/ofw_tree.c \ 55 55 generic/src/balloc.c \ 56 generic/src/memstr.c \57 56 generic/src/printf_core.c \ 58 57 generic/src/vprintf.c \ -
boot/arch/sparc64/src/asm.S
r571addd r1720cf9 42 42 .global start 43 43 .global halt 44 .global memcpy 44 45 .global jump_to_kernel 45 46 … … 97 98 ba %xcc, halt 98 99 nop 100 101 memcpy: 102 ! Save dst 103 104 mov %o0, %o3 105 add %o1, 7, %g1 106 and %g1, -8, %g1 107 cmp %o1, %g1 108 be,pn %xcc, 3f 109 add %o0, 7, %g1 110 mov 0, %g3 111 112 0: 113 brz,pn %o2, 2f 114 mov 0, %g2 115 116 1: 117 ldub [%g3 + %o1], %g1 118 add %g2, 1, %g2 119 cmp %o2, %g2 120 stb %g1, [%g3 + %o0] 121 bne,pt %xcc, 1b 122 mov %g2, %g3 123 124 2: 125 ! Exit point 126 127 jmp %o7 + 8 128 mov %o3, %o0 129 130 3: 131 and %g1, -8, %g1 132 cmp %o0, %g1 133 bne,pt %xcc, 0b 134 mov 0, %g3 135 srlx %o2, 3, %g4 136 brz,pn %g4, 5f 137 mov 0, %g5 138 139 4: 140 sllx %g3, 3, %g2 141 add %g5, 1, %g3 142 ldx [%o1 + %g2], %g1 143 mov %g3, %g5 144 cmp %g4, %g3 145 bne,pt %xcc, 4b 146 stx %g1, [%o0 + %g2] 147 148 5: 149 and %o2, 7, %o2 150 brz,pn %o2, 2b 151 sllx %g4, 3, %g1 152 mov 0, %g2 153 add %g1, %o0, %o0 154 add %g1, %o1, %g4 155 mov 0, %g3 156 157 6: 158 ldub [%g2 + %g4], %g1 159 stb %g1, [%g2 + %o0] 160 add %g3, 1, %g2 161 cmp %o2, %g2 162 bne,pt %xcc, 6b 163 mov %g2, %g3 164 165 ! Exit point 166 167 jmp %o7 + 8 168 mov %o3, %o0 99 169 100 170 jump_to_kernel: -
kernel/Makefile
r571addd r1720cf9 120 120 ifeq ($(CONFIG_LTO),y) 121 121 GCC_CFLAGS += -flto 122 endif123 124 ifeq ($(CONFIG_LINE_DEBUG),y)125 GCC_CFLAGS += -g126 ICC_CFLAGS += -g127 SUNCC_CFLAGS += -g128 CLANG_CFLAGS += -g129 122 endif 130 123 … … 408 401 409 402 $(DISASM): $(RAW) 410 ifeq ($(CONFIG_LINE_DEBUG),y)411 $(OBJDUMP) -d -S $< > $@412 else413 403 $(OBJDUMP) -d $< > $@ 414 endif415 404 416 405 $(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS) -
kernel/arch/abs32le/src/debug/stacktrace.c
r571addd r1720cf9 37 37 #include <typedefs.h> 38 38 39 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)39 bool kernel_frame_pointer_validate(uintptr_t fp) 40 40 { 41 41 return true; 42 42 } 43 43 44 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)44 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 45 45 { 46 46 return true; 47 47 } 48 48 49 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)49 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 50 50 { 51 51 return true; 52 52 } 53 53 54 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)54 bool uspace_frame_pointer_validate(uintptr_t fp) 55 55 { 56 56 return true; 57 57 } 58 58 59 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)59 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 60 60 { 61 61 return true; 62 62 } 63 63 64 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)64 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 65 65 { 66 66 return true; -
kernel/arch/amd64/_link.ld.in
r571addd r1720cf9 53 53 } 54 54 55 #ifdef CONFIG_LINE_DEBUG56 .comment 0 : { *(.comment); }57 .debug_abbrev 0 : { *(.debug_abbrev); }58 .debug_aranges 0 : { *(.debug_aranges); }59 .debug_info 0 : { *(.debug_info); }60 .debug_line 0 : { *(.debug_line); }61 .debug_loc 0 : { *(.debug_loc); }62 .debug_pubnames 0 : { *(.debug_pubnames); }63 .debug_pubtypes 0 : { *(.debug_pubtypes); }64 .debug_ranges 0 : { *(.debug_ranges); }65 .debug_str 0 : { *(.debug_str); }66 #endif67 68 55 /DISCARD/ : { 69 56 *(*); -
kernel/arch/amd64/src/debug/stacktrace.c
r571addd r1720cf9 40 40 #define FRAME_OFFSET_RA 1 41 41 42 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)42 bool kernel_frame_pointer_validate(uintptr_t fp) 43 43 { 44 return ctx->fp != 0;44 return fp != 0; 45 45 } 46 46 47 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)47 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 48 48 { 49 uint64_t *stack = (void *) ctx->fp;49 uint64_t *stack = (void *) fp; 50 50 *prev = stack[FRAME_OFFSET_FP_PREV]; 51 51 … … 53 53 } 54 54 55 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)55 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 56 56 { 57 uint64_t *stack = (void *) ctx->fp;57 uint64_t *stack = (void *) fp; 58 58 *ra = stack[FRAME_OFFSET_RA]; 59 59 … … 61 61 } 62 62 63 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)63 bool uspace_frame_pointer_validate(uintptr_t fp) 64 64 { 65 return ctx->fp != 0;65 return fp != 0; 66 66 } 67 67 68 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)68 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 69 69 { 70 70 return !copy_from_uspace((void *) prev, 71 (uint64_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));71 (uint64_t *) fp + FRAME_OFFSET_FP_PREV, sizeof(*prev)); 72 72 } 73 73 74 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)74 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 75 75 { 76 return !copy_from_uspace((void *) ra, 77 (uint64_t *) ctx->fp + FRAME_OFFSET_RA,sizeof(*ra));76 return !copy_from_uspace((void *) ra, (uint64_t *) fp + FRAME_OFFSET_RA, 77 sizeof(*ra)); 78 78 } 79 79 -
kernel/arch/arm32/src/debug/stacktrace.c
r571addd r1720cf9 40 40 #define FRAME_OFFSET_RA -1 41 41 42 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)42 bool kernel_frame_pointer_validate(uintptr_t fp) 43 43 { 44 return ctx->fp != 0;44 return fp != 0; 45 45 } 46 46 47 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)47 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 48 48 { 49 uint32_t *stack = (void *) ctx->fp;49 uint32_t *stack = (void *) fp; 50 50 51 51 *prev = stack[FRAME_OFFSET_FP_PREV]; … … 53 53 } 54 54 55 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)55 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 56 56 { 57 uint32_t *stack = (void *) ctx->fp;57 uint32_t *stack = (void *) fp; 58 58 59 59 *ra = stack[FRAME_OFFSET_RA]; … … 61 61 } 62 62 63 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)63 bool uspace_frame_pointer_validate(uintptr_t fp) 64 64 { 65 return ctx->fp != 0;65 return fp != 0; 66 66 } 67 67 68 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)68 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 69 69 { 70 70 return !copy_from_uspace((void *) prev, 71 (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));71 (uint32_t *) fp + FRAME_OFFSET_FP_PREV, sizeof(*prev)); 72 72 } 73 73 74 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)74 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 75 75 { 76 return !copy_from_uspace((void *) ra, 77 (uint32_t *) ctx->fp + FRAME_OFFSET_RA,sizeof(*ra));76 return !copy_from_uspace((void *) ra, (uint32_t *) fp + FRAME_OFFSET_RA, 77 sizeof(*ra)); 78 78 } 79 79 -
kernel/arch/ia32/src/debug/stacktrace.c
r571addd r1720cf9 40 40 #define FRAME_OFFSET_RA 1 41 41 42 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)42 bool kernel_frame_pointer_validate(uintptr_t fp) 43 43 { 44 return ctx->fp != 0;44 return fp != 0; 45 45 } 46 46 47 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)47 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 48 48 { 49 uint32_t *stack = (void *) ctx->fp;49 uint32_t *stack = (void *) fp; 50 50 *prev = stack[FRAME_OFFSET_FP_PREV]; 51 51 return true; 52 52 } 53 53 54 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)54 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 55 55 { 56 uint32_t *stack = (void *) ctx->fp;56 uint32_t *stack = (void *) fp; 57 57 *ra = stack[FRAME_OFFSET_RA]; 58 58 return true; 59 59 } 60 60 61 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)61 bool uspace_frame_pointer_validate(uintptr_t fp) 62 62 { 63 return ctx->fp != 0;63 return fp != 0; 64 64 } 65 65 66 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)66 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 67 67 { 68 68 return !copy_from_uspace((void *) prev, 69 (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));69 (uint32_t *) fp + FRAME_OFFSET_FP_PREV, sizeof(*prev)); 70 70 } 71 71 72 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)72 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 73 73 { 74 return !copy_from_uspace((void *) ra, 75 (uint32_t *) ctx->fp + FRAME_OFFSET_RA,sizeof(*ra));74 return !copy_from_uspace((void *) ra, (uint32_t *) fp + FRAME_OFFSET_RA, 75 sizeof(*ra)); 76 76 } 77 77 -
kernel/arch/ia32/src/mm/frame.c
r571addd r1720cf9 131 131 if (last_frame < ALIGN_UP(new_base + new_size, FRAME_SIZE)) 132 132 last_frame = ALIGN_UP(new_base + new_size, FRAME_SIZE); 133 } else if ((e820table[i].type == MEMMAP_MEMORY_ACPI) || 134 (e820table[i].type == MEMMAP_MEMORY_NVS)) { 133 } 134 135 if (e820table[i].type == MEMMAP_MEMORY_RESERVED) { 136 /* To be safe, make the reserved zone possibly larger */ 137 uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE); 138 uint64_t new_size = ALIGN_UP(size + (base - new_base), 139 FRAME_SIZE); 140 141 zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0, 142 ZONE_RESERVED); 143 } 144 145 if (e820table[i].type == MEMMAP_MEMORY_ACPI) { 135 146 /* To be safe, make the firmware zone possibly larger */ 136 147 uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE); … … 140 151 zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0, 141 152 ZONE_FIRMWARE); 142 } else {143 /* To be safe, make the reserved zone possibly larger */144 uint64_t new_base = ALIGN_DOWN(base, FRAME_SIZE);145 uint64_t new_size = ALIGN_UP(size + (base - new_base),146 FRAME_SIZE);147 148 zone_create(ADDR2PFN(new_base), SIZE2FRAMES(new_size), 0,149 ZONE_RESERVED);150 153 } 151 154 } … … 200 203 #ifdef CONFIG_SMP 201 204 /* Reserve AP real mode bootstrap memory */ 202 frame_mark_unavailable(AP_BOOT_OFFSET >> FRAME_WIDTH, 205 frame_mark_unavailable(AP_BOOT_OFFSET >> FRAME_WIDTH, 203 206 (hardcoded_unmapped_ktext_size + 204 207 hardcoded_unmapped_kdata_size) >> FRAME_WIDTH); -
kernel/arch/ia64/src/debug/stacktrace.c
r571addd r1720cf9 37 37 #include <typedefs.h> 38 38 39 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)39 bool kernel_frame_pointer_validate(uintptr_t fp) 40 40 { 41 41 return false; 42 42 } 43 43 44 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)44 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 45 45 { 46 46 return false; 47 47 } 48 48 49 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)49 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 50 50 { 51 51 return false; 52 52 } 53 53 54 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)54 bool uspace_frame_pointer_validate(uintptr_t fp) 55 55 { 56 56 return false; 57 57 } 58 58 59 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)59 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 60 60 { 61 61 return false; 62 62 } 63 63 64 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)64 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 65 65 { 66 66 return false; -
kernel/arch/mips32/include/debugger.h
r571addd r1720cf9 68 68 extern bpinfo_t breakpoints[BKPOINTS_MAX]; 69 69 70 extern bool is_jump(unative_t);71 72 70 extern void debugger_init(void); 73 71 extern void debugger_bpoint(istate_t *); -
kernel/arch/mips32/src/debug/stacktrace.c
r571addd r1720cf9 36 36 #include <syscall/copy.h> 37 37 #include <typedefs.h> 38 #include <arch/debugger.h>39 #include <print.h>40 38 41 #define R0 0U 42 #define SP 29U 43 #define RA 31U 44 45 #define OP_SHIFT 26 46 #define RS_SHIFT 21 47 #define RT_SHIFT 16 48 #define RD_SHIFT 11 49 50 #define HINT_SHIFT 6 51 #define BASE_SHIFT RS_SHIFT 52 #define IMM_SHIFT 0 53 #define OFFSET_SHIFT IMM_SHIFT 54 55 #define RS_MASK (0x1f << RS_SHIFT) 56 #define RT_MASK (0x1f << RT_SHIFT) 57 #define RD_MASK (0x1f << RD_SHIFT) 58 #define HINT_MASK (0x1f << HINT_SHIFT) 59 #define BASE_MASK RS_MASK 60 #define IMM_MASK (0xffff << IMM_SHIFT) 61 #define OFFSET_MASK IMM_MASK 62 63 #define RS_GET(inst) (((inst) & RS_MASK) >> RS_SHIFT) 64 #define RD_GET(inst) (((inst) & RD_MASK) >> RD_SHIFT) 65 #define IMM_GET(inst) (int16_t)(((inst) & IMM_MASK) >> IMM_SHIFT) 66 #define BASE_GET(inst) RS_GET(inst) 67 #define OFFSET_GET(inst) IMM_GET(inst) 68 69 #define ADDU_R_SP_R0_TEMPL \ 70 ((0x0 << OP_SHIFT) | (SP << RS_SHIFT) | (R0 << RT_SHIFT) | 0x21) 71 #define ADDU_SP_R_R0_TEMPL \ 72 ((0x0 << OP_SHIFT) | (SP << RD_SHIFT) | (R0 << RT_SHIFT) | 0x21) 73 #define ADDI_SP_SP_IMM_TEMPL \ 74 ((0x8 << OP_SHIFT) | (SP << RS_SHIFT) | (SP << RT_SHIFT)) 75 #define ADDIU_SP_SP_IMM_TEMPL \ 76 ((0x9 << OP_SHIFT) | (SP << RS_SHIFT) | (SP << RT_SHIFT)) 77 #define JR_RA_TEMPL \ 78 ((0x0 << OP_SHIFT) | (RA << RS_SHIFT) | (0x0 << HINT_SHIFT) | 0x8) 79 #define SW_RA_TEMPL \ 80 ((0x2b << OP_SHIFT) | (RA << RT_SHIFT)) 81 82 #define IS_ADDU_R_SP_R0(inst) \ 83 (((inst) & ~RD_MASK) == ADDU_R_SP_R0_TEMPL) 84 #define IS_ADDU_SP_R_R0(inst) \ 85 (((inst) & ~RS_MASK) == ADDU_SP_R_R0_TEMPL) 86 #define IS_ADDI_SP_SP_IMM(inst) \ 87 (((inst) & ~IMM_MASK) == ADDI_SP_SP_IMM_TEMPL) 88 #define IS_ADDIU_SP_SP_IMM(inst) \ 89 (((inst) & ~IMM_MASK) == ADDIU_SP_SP_IMM_TEMPL) 90 #define IS_JR_RA(inst) \ 91 (((inst) & ~HINT_MASK) == JR_RA_TEMPL) 92 #define IS_SW_RA(inst) \ 93 (((inst) & ~(BASE_MASK | OFFSET_MASK)) == SW_RA_TEMPL) 94 95 extern char ktext_start; 96 extern char ktext_end; 97 98 static bool 99 scan(stack_trace_context_t *ctx, uintptr_t *prev_fp, uintptr_t *prev_ra) 100 { 101 uint32_t *inst = (void *) ctx->pc; 102 bool has_fp = false; 103 size_t frame_size; 104 unsigned int fp = SP; 105 106 do { 107 inst--; 108 #if 0 109 /* 110 * This is one of the situations in which the theory (ABI) does 111 * not meet the practice (GCC). GCC simply does not place the 112 * JR $ra instruction as dictated by the ABI, rendering the 113 * official stack tracing algorithm somewhat unapplicable. 114 */ 115 116 if (IS_ADDU_R_SP_R0(*inst)) { 117 uint32_t *cur; 118 fp = RD_GET(*inst); 119 /* 120 * We have a candidate for frame pointer. 121 */ 122 123 /* Seek to the end of this function. */ 124 for (cur = inst + 1; !IS_JR_RA(*cur); cur++) 125 ; 126 /* Scan the last basic block */ 127 for (cur--; !is_jump(*(cur - 1)); cur--) { 128 if (IS_ADDU_SP_R_R0(*cur) && 129 (fp == RS_GET(*cur))) { 130 has_fp = true; 131 } 132 } 133 continue; 134 } 135 136 if (IS_JR_RA(*inst)) { 137 if (!ctx->istate) 138 return false; 139 /* 140 * No stack frame has been allocated yet. 141 * Use the values stored in istate. 142 */ 143 if (prev_fp) 144 *prev_fp = ctx->istate->sp; 145 if (prev_ra) 146 *prev_ra = ctx->istate->ra - 8; 147 ctx->istate = NULL; 148 return true; 149 } 150 #endif 151 152 } while ((!IS_ADDIU_SP_SP_IMM(*inst) && !IS_ADDI_SP_SP_IMM(*inst)) || 153 (IMM_GET(*inst) >= 0)); 154 155 /* 156 * We are at the instruction which allocates the space for the current 157 * stack frame. 158 */ 159 frame_size = -IMM_GET(*inst); 160 if (prev_fp) 161 *prev_fp = ctx->fp + frame_size; 162 163 /* 164 * Scan the first basic block for the occurrence of 165 * SW $ra, OFFSET($base). 166 */ 167 for (inst++; !is_jump(*(inst - 1)) && (uintptr_t) inst < ctx->pc; 168 inst++) { 169 if (IS_SW_RA(*inst)) { 170 unsigned int base = BASE_GET(*inst); 171 int16_t offset = OFFSET_GET(*inst); 172 173 if (base == SP || (has_fp && base == fp)) { 174 uint32_t *addr = (void *) (ctx->fp + offset); 175 176 if (offset % 4 != 0) 177 return false; 178 /* cannot store below current stack pointer */ 179 if (offset < 0) 180 return false; 181 /* too big offsets are suspicious */ 182 if (offset > 32 * 4) 183 return false; 184 185 if (prev_ra) 186 *prev_ra = *addr; 187 return true; 188 } 189 } 190 } 191 192 /* 193 * The first basic block does not save the return address or saves it 194 * after ctx->pc, which means that the correct value is in istate. 195 */ 196 if (prev_ra) { 197 if (!ctx->istate) 198 return false; 199 *prev_ra = ctx->istate->ra - 8; 200 ctx->istate = NULL; 201 } 202 return true; 203 } 204 205 206 bool kernel_stack_trace_context_validate(stack_trace_context_t *ctx) 207 { 208 return !((ctx->fp == 0) || ((ctx->fp % 8) != 0) || 209 (ctx->pc % 4 != 0) || (ctx->pc < (uintptr_t) &ktext_start) || 210 (ctx->pc >= (uintptr_t) &ktext_end)); 211 } 212 213 bool kernel_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev) 214 { 215 return scan(ctx, prev, NULL); 216 } 217 218 bool kernel_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra) 219 { 220 return scan(ctx, NULL, ra); 221 } 222 223 bool uspace_stack_trace_context_validate(stack_trace_context_t *ctx) 39 bool kernel_frame_pointer_validate(uintptr_t fp) 224 40 { 225 41 return false; 226 42 } 227 43 228 bool uspace_frame_pointer_prev(stack_trace_context_t *ctx, uintptr_t *prev)44 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 229 45 { 230 46 return false; 231 47 } 232 48 233 bool uspace_return_address_get(stack_trace_context_t *ctx, uintptr_t *ra) 49 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 50 { 51 return false; 52 } 53 54 bool uspace_frame_pointer_validate(uintptr_t fp) 55 { 56 return false; 57 } 58 59 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 60 { 61 return false; 62 } 63 64 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 234 65 { 235 66 return false; -
kernel/arch/mips32/src/debug/stacktrace_asm.S
r571addd r1720cf9 37 37 frame_pointer_get: 38 38 j $ra 39 move $v0, $sp39 xor $v0, $v0 40 40 41 41 program_counter_get: 42 42 j $ra 43 move $v0, $ra43 xor $v0, $v0 -
kernel/arch/mips32/src/debugger.c
r571addd r1720cf9 134 134 * 135 135 */ 136 bool is_jump(unative_t instr)136 static bool is_jump(unative_t instr) 137 137 { 138 138 unsigned int i; -
kernel/arch/ppc32/src/debug/stacktrace.c
r571addd r1720cf9 40 40 #define FRAME_OFFSET_RA 1 41 41 42 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)42 bool kernel_frame_pointer_validate(uintptr_t fp) 43 43 { 44 return ctx->fp != 0;44 return fp != 0; 45 45 } 46 46 47 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)47 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 48 48 { 49 uint32_t *stack = (void *) ctx->fp;49 uint32_t *stack = (void *) fp; 50 50 *prev = stack[FRAME_OFFSET_FP_PREV]; 51 51 return true; 52 52 } 53 53 54 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)54 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 55 55 { 56 uint32_t *stack = (void *) ctx->fp;56 uint32_t *stack = (void *) fp; 57 57 *ra = stack[FRAME_OFFSET_RA]; 58 58 return true; 59 59 } 60 60 61 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)61 bool uspace_frame_pointer_validate(uintptr_t fp) 62 62 { 63 return ctx->fp != 0;63 return fp != 0; 64 64 } 65 65 66 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)66 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 67 67 { 68 68 return !copy_from_uspace((void *) prev, 69 (uint32_t *) ctx->fp + FRAME_OFFSET_FP_PREV, sizeof(*prev));69 (uint32_t *) fp + FRAME_OFFSET_FP_PREV, sizeof(*prev)); 70 70 } 71 71 72 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)72 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 73 73 { 74 return !copy_from_uspace((void *) ra, 75 (uint32_t *) ctx->fp + FRAME_OFFSET_RA,sizeof(*ra));74 return !copy_from_uspace((void *) ra, (uint32_t *) fp + FRAME_OFFSET_RA, 75 sizeof(*ra)); 76 76 } 77 77 -
kernel/arch/sparc64/src/debug/stacktrace.c
r571addd r1720cf9 50 50 extern void alloc_window_and_flush(void); 51 51 52 bool kernel_ stack_trace_context_validate(stack_trace_context_t *ctx)52 bool kernel_frame_pointer_validate(uintptr_t fp) 53 53 { 54 54 uintptr_t kstack; … … 63 63 kstack -= PREEMPTIBLE_HANDLER_STACK_FRAME_SIZE; 64 64 65 if (THREAD && ( ctx->fp == kstack))65 if (THREAD && (fp == kstack)) 66 66 return false; 67 return ctx->fp != 0;67 return fp != 0; 68 68 } 69 69 70 bool kernel_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)70 bool kernel_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 71 71 { 72 uint64_t *stack = (void *) ctx->fp;72 uint64_t *stack = (void *) fp; 73 73 alloc_window_and_flush(); 74 74 *prev = stack[FRAME_OFFSET_FP_PREV] + STACK_BIAS; … … 76 76 } 77 77 78 bool kernel_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)78 bool kernel_return_address_get(uintptr_t fp, uintptr_t *ra) 79 79 { 80 uint64_t *stack = (void *) ctx->fp;80 uint64_t *stack = (void *) fp; 81 81 alloc_window_and_flush(); 82 82 *ra = stack[FRAME_OFFSET_RA]; … … 84 84 } 85 85 86 bool uspace_ stack_trace_context_validate(stack_trace_context_t *ctx)86 bool uspace_frame_pointer_validate(uintptr_t fp) 87 87 { 88 88 return false; 89 89 } 90 90 91 bool uspace_frame_pointer_prev( stack_trace_context_t *ctx, uintptr_t *prev)91 bool uspace_frame_pointer_prev(uintptr_t fp, uintptr_t *prev) 92 92 { 93 93 return false; 94 94 } 95 95 96 bool uspace_return_address_get( stack_trace_context_t *ctx, uintptr_t *ra)96 bool uspace_return_address_get(uintptr_t fp, uintptr_t *ra) 97 97 { 98 98 return false; -
kernel/generic/include/macros.h
r571addd r1720cf9 47 47 * @param s2 Start address of the second interval. 48 48 * @param sz2 Size of the second interval. 49 *50 49 */ 51 NO_TRACE static inline int overlaps(uint 64_t s1, uint64_t sz1, uint64_t s2,52 uint64_t sz2)50 NO_TRACE static inline int overlaps(uintptr_t s1, size_t sz1, uintptr_t s2, 51 size_t sz2) 53 52 { 54 uint 64_t e1 = s1 + sz1;55 uint 64_t e2 = s2 + sz2;53 uintptr_t e1 = s1 + sz1; 54 uintptr_t e2 = s2 + sz2; 56 55 57 56 return ((s1 < e2) && (s2 < e1)); 58 }59 60 /** Return true if the second interval is within the first interval.61 *62 * @param s1 Start address of the first interval.63 * @param sz1 Size of the first interval.64 * @param s2 Start address of the second interval.65 * @param sz2 Size of the second interval.66 *67 */68 NO_TRACE static inline int iswithin(uint64_t s1, uint64_t sz1, uint64_t s2,69 uint64_t sz2)70 {71 uint64_t e1 = s1 + sz1;72 uint64_t e2 = s2 + sz2;73 74 return ((s1 <= s2) && (e1 >= e2));75 57 } 76 58 … … 92 74 93 75 /* Compute overlapping of physical addresses */ 94 #define PA_ OVERLAPS(x, szx, y, szy) \76 #define PA_overlaps(x, szx, y, szy) \ 95 77 overlaps(KA2PA((x)), (szx), KA2PA((y)), (szy)) 96 78 -
kernel/generic/include/stacktrace.h
r571addd r1720cf9 42 42 43 43 typedef struct { 44 uintptr_t fp; 45 uintptr_t pc; 46 struct istate *istate; 47 } stack_trace_context_t; 48 49 typedef struct { 50 bool (* stack_trace_context_validate)(stack_trace_context_t *); 51 bool (* frame_pointer_prev)(stack_trace_context_t *, uintptr_t *); 52 bool (* return_address_get)(stack_trace_context_t *, uintptr_t *); 44 bool (* frame_pointer_validate)(uintptr_t); 45 bool (* frame_pointer_prev)(uintptr_t, uintptr_t *); 46 bool (* return_address_get)(uintptr_t, uintptr_t *); 53 47 bool (* symbol_resolve)(uintptr_t, const char **, uintptr_t *); 54 48 } stack_trace_ops_t; … … 59 53 extern void stack_trace(void); 60 54 extern void stack_trace_istate(struct istate *); 61 extern void stack_trace_ ctx(stack_trace_ops_t *, stack_trace_context_t *);55 extern void stack_trace_fp_pc(stack_trace_ops_t *, uintptr_t, uintptr_t); 62 56 63 57 /* … … 67 61 extern uintptr_t program_counter_get(void); 68 62 69 extern bool kernel_ stack_trace_context_validate(stack_trace_context_t *);70 extern bool kernel_frame_pointer_prev( stack_trace_context_t *, uintptr_t *);71 extern bool kernel_return_address_get( stack_trace_context_t *, uintptr_t *);63 extern bool kernel_frame_pointer_validate(uintptr_t); 64 extern bool kernel_frame_pointer_prev(uintptr_t, uintptr_t *); 65 extern bool kernel_return_address_get(uintptr_t, uintptr_t *); 72 66 73 extern bool uspace_ stack_trace_context_validate(stack_trace_context_t *);74 extern bool uspace_frame_pointer_prev( stack_trace_context_t *, uintptr_t *);75 extern bool uspace_return_address_get( stack_trace_context_t *, uintptr_t *);67 extern bool uspace_frame_pointer_validate(uintptr_t); 68 extern bool uspace_frame_pointer_prev(uintptr_t, uintptr_t *); 69 extern bool uspace_return_address_get(uintptr_t, uintptr_t *); 76 70 77 71 #endif -
kernel/generic/src/debug/stacktrace.c
r571addd r1720cf9 27 27 */ 28 28 29 /** @addtogroup genericdebug 29 /** @addtogroup genericdebug 30 30 * @{ 31 31 */ … … 42 42 43 43 void 44 stack_trace_ ctx(stack_trace_ops_t *ops, stack_trace_context_t *ctx)44 stack_trace_fp_pc(stack_trace_ops_t *ops, uintptr_t fp, uintptr_t pc) 45 45 { 46 46 int cnt = 0; 47 47 const char *symbol; 48 48 uintptr_t offset; 49 uintptr_t fp;50 uintptr_t pc;51 49 52 while (cnt++ < STACK_FRAMES_MAX && 53 ops->stack_trace_context_validate(ctx)) { 50 while (cnt++ < STACK_FRAMES_MAX && ops->frame_pointer_validate(fp)) { 54 51 if (ops->symbol_resolve && 55 ops->symbol_resolve( ctx->pc, &symbol, &offset)) {52 ops->symbol_resolve(pc, &symbol, &offset)) { 56 53 if (offset) 57 printf("%p: %s+%" PRIp "()\n", 58 ctx->fp, symbol, offset); 54 printf("%p: %s+%" PRIp "()\n", fp, symbol, offset); 59 55 else 60 printf("%p: %s()\n", 61 ctx->fp, symbol); 56 printf("%p: %s()\n", fp, symbol); 62 57 } else { 63 printf("%p: %p()\n", ctx->fp, ctx->pc);58 printf("%p: %p()\n", fp, pc); 64 59 } 65 if (!ops->return_address_get( ctx, &pc))60 if (!ops->return_address_get(fp, &pc)) 66 61 break; 67 if (!ops->frame_pointer_prev( ctx, &fp))62 if (!ops->frame_pointer_prev(fp, &fp)) 68 63 break; 69 ctx->fp = fp;70 ctx->pc = pc;71 64 } 72 65 } … … 74 67 void stack_trace(void) 75 68 { 76 stack_trace_context_t ctx = { 77 .fp = frame_pointer_get(), 78 .pc = program_counter_get(), 79 .istate = NULL 80 }; 81 82 stack_trace_ctx(&kst_ops, &ctx); 69 stack_trace_fp_pc(&kst_ops, frame_pointer_get(), program_counter_get()); 83 70 84 71 /* … … 91 78 void stack_trace_istate(istate_t *istate) 92 79 { 93 stack_trace_context_t ctx = {94 .fp = istate_get_fp(istate),95 .pc = istate_get_pc(istate),96 .istate = istate97 };98 99 80 if (istate_from_uspace(istate)) 100 stack_trace_ctx(&ust_ops, &ctx); 81 stack_trace_fp_pc(&ust_ops, istate_get_fp(istate), 82 istate_get_pc(istate)); 101 83 else 102 stack_trace_ctx(&kst_ops, &ctx); 84 stack_trace_fp_pc(&kst_ops, istate_get_fp(istate), 85 istate_get_pc(istate)); 103 86 } 104 87 105 static bool 106 kernel_symbol_resolve(uintptr_t addr, const char **sp, uintptr_t *op) 88 static bool kernel_symbol_resolve(uintptr_t addr, const char **sp, uintptr_t *op) 107 89 { 108 90 return (symtab_name_lookup(addr, sp, op) == 0); … … 110 92 111 93 stack_trace_ops_t kst_ops = { 112 . stack_trace_context_validate = kernel_stack_trace_context_validate,94 .frame_pointer_validate = kernel_frame_pointer_validate, 113 95 .frame_pointer_prev = kernel_frame_pointer_prev, 114 96 .return_address_get = kernel_return_address_get, … … 117 99 118 100 stack_trace_ops_t ust_ops = { 119 . stack_trace_context_validate = uspace_stack_trace_context_validate,101 .frame_pointer_validate = uspace_frame_pointer_validate, 120 102 .frame_pointer_prev = uspace_frame_pointer_prev, 121 103 .return_address_get = uspace_return_address_get, -
kernel/generic/src/main/main.c
r571addd r1720cf9 147 147 size_t i; 148 148 for (i = 0; i < init.cnt; i++) { 149 if (PA_ OVERLAPS(config.stack_base, config.stack_size,149 if (PA_overlaps(config.stack_base, config.stack_size, 150 150 init.tasks[i].addr, init.tasks[i].size)) 151 151 config.stack_base = ALIGN_UP(init.tasks[i].addr + … … 155 155 /* Avoid placing stack on top of boot allocations. */ 156 156 if (ballocs.size) { 157 if (PA_ OVERLAPS(config.stack_base, config.stack_size,157 if (PA_overlaps(config.stack_base, config.stack_size, 158 158 ballocs.base, ballocs.size)) 159 159 config.stack_base = ALIGN_UP(ballocs.base + -
kernel/generic/src/mm/frame.c
r571addd r1720cf9 121 121 * 122 122 */ 123 NO_TRACE static size_t zones_insert_zone(pfn_t base, size_t count, 124 zone_flags_t flags) 123 NO_TRACE static size_t zones_insert_zone(pfn_t base, size_t count) 125 124 { 126 125 if (zones.count + 1 == ZONES_MAX) { … … 132 131 for (i = 0; i < zones.count; i++) { 133 132 /* Check for overlap */ 134 if (overlaps(zones.info[i].base, zones.info[i].count, 135 base, count)) { 136 137 /* 138 * If the overlaping zones are of the same type 139 * and the new zone is completely within the previous 140 * one, then quietly ignore the new zone. 141 * 142 */ 143 144 if ((zones.info[i].flags != flags) || 145 (!iswithin(zones.info[i].base, zones.info[i].count, 146 base, count))) { 147 printf("Zone (%p, %p) overlaps with previous zone (%p, %p)!\n", 148 PFN2ADDR(base), PFN2ADDR(count), 149 PFN2ADDR(zones.info[i].base), 150 PFN2ADDR(zones.info[i].count)); 151 } 152 133 if (overlaps(base, count, 134 zones.info[i].base, zones.info[i].count)) { 135 printf("Zone (%p, %p) overlaps with zone (%p, %p)!\n", 136 PFN2ADDR(base), PFN2ADDR(base + count), 137 PFN2ADDR(zones.info[i].base), 138 PFN2ADDR(zones.info[i].base + zones.info[i].count)); 153 139 return (size_t) -1; 154 140 } … … 161 147 for (j = zones.count; j > i; j--) { 162 148 zones.info[j] = zones.info[j - 1]; 163 if (zones.info[j].buddy_system != NULL) 164 zones.info[j].buddy_system->data = 165 (void *) &zones.info[j]; 149 zones.info[j].buddy_system->data = 150 (void *) &zones.info[j - 1]; 166 151 } 167 152 … … 763 748 for (i = z2 + 1; i < zones.count; i++) { 764 749 zones.info[i - 1] = zones.info[i]; 765 if (zones.info[i - 1].buddy_system != NULL) 766 zones.info[i - 1].buddy_system->data = 767 (void *) &zones.info[i - 1]; 750 zones.info[i - 1].buddy_system->data = 751 (void *) &zones.info[i - 1]; 768 752 } 769 753 … … 914 898 } 915 899 916 size_t znum = zones_insert_zone(start, count , flags);900 size_t znum = zones_insert_zone(start, count); 917 901 if (znum == (size_t) -1) { 918 902 irq_spinlock_unlock(&zones.lock, true); … … 937 921 938 922 /* Non-available zone */ 939 size_t znum = zones_insert_zone(start, count , flags);923 size_t znum = zones_insert_zone(start, count); 940 924 if (znum == (size_t) -1) { 941 925 irq_spinlock_unlock(&zones.lock, true); -
uspace/Makefile.common
r571addd r1720cf9 172 172 ifneq ($(BINARY),) 173 173 %.disasm: $(BINARY) 174 ifeq ($(CONFIG_LINE_DEBUG),y)175 $(OBJDUMP) -d -S $< > $@176 else177 174 $(OBJDUMP) -d $< > $@ 178 endif179 175 180 176 $(BINARY): $(LINKER_SCRIPT) $(OBJECTS) $(LIBS) $(BASE_LIBS) -
uspace/app/klog/klog.c
r571addd r1720cf9 43 43 #include <event.h> 44 44 #include <errno.h> 45 #include <str_error.h>46 45 #include <io/klog.h> 47 46 48 #define NAME "klog" 49 #define LOG_FNAME "/log/klog" 47 #define NAME "klog" 50 48 51 49 /* Pointer to klog area */ 52 50 static wchar_t *klog; 53 51 static size_t klog_length; 54 55 static FILE *log;56 52 57 53 static void interrupt_received(ipc_callid_t callid, ipc_call_t *call) … … 62 58 size_t i; 63 59 64 for (i = klog_len - klog_stored; i < klog_len; i++) { 65 wchar_t ch = klog[(klog_start + i) % klog_length]; 66 67 putchar(ch); 68 69 if (log != NULL) 70 fprintf(log, "%lc", ch); 71 } 72 73 if (log != NULL) { 74 fflush(log); 75 fsync(fileno(log)); 76 } 60 for (i = klog_len - klog_stored; i < klog_len; i++) 61 putchar(klog[(klog_start + i) % klog_length]); 77 62 } 78 63 … … 106 91 } 107 92 108 /*109 * Mode "a" would be definitively much better here, but it is110 * not well supported by the FAT driver.111 *112 */113 log = fopen(LOG_FNAME, "w");114 if (log == NULL)115 printf("%s: Unable to create log file %s (%s)\n", NAME, LOG_FNAME,116 str_error(errno));117 118 93 async_set_interrupt_received(interrupt_received); 119 94 klog_update(); -
uspace/lib/c/generic/io/io.c
r571addd r1720cf9 757 757 } 758 758 759 int fileno(FILE *stream)760 {761 if (stream->klog) {762 errno = EBADF;763 return -1;764 }765 766 return stream->fd;767 }768 769 759 int fphone(FILE *stream) 770 760 { -
uspace/lib/c/include/stdio.h
r571addd r1720cf9 171 171 extern off64_t ftell(FILE *); 172 172 extern int feof(FILE *); 173 extern int fileno(FILE *);174 173 175 174 extern int fflush(FILE *);
Note:
See TracChangeset
for help on using the changeset viewer.