Changes in / [52cdcbc:ed212f7] in mainline
- Files:
-
- 25 deleted
- 62 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile.common
r52cdcbc red212f7 60 60 $(USPACEDIR)/app/getterm/getterm \ 61 61 $(USPACEDIR)/app/klog/klog \ 62 $(USPACEDIR)/app/mkfat/mkfat \63 62 $(USPACEDIR)/app/redir/redir \ 64 63 $(USPACEDIR)/app/tester/tester \ -
kernel/Makefile.build
r52cdcbc red212f7 186 186 generic/src/ddi/device.c \ 187 187 generic/src/debug/symtab.c \ 188 generic/src/debug/stacktrace.c \189 188 generic/src/interrupt/interrupt.c \ 190 189 generic/src/main/main.c \ -
kernel/arch/amd64/Makefile.inc
r52cdcbc red212f7 38 38 39 39 FPU_NO_CFLAGS = -mno-sse -mno-sse2 40 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables -fno-omit-frame-pointer40 CMN1 = -m64 -mcmodel=kernel -mno-red-zone -fno-unwind-tables 41 41 GCC_CFLAGS += $(CMN1) 42 42 ICC_CFLAGS += $(CMN1) … … 60 60 arch/$(KARCH)/src/boot/boot.S \ 61 61 arch/$(KARCH)/src/boot/memmap.c \ 62 arch/$(KARCH)/src/debug/stacktrace.c \63 arch/$(KARCH)/src/debug/stacktrace_asm.S \64 62 arch/$(KARCH)/src/pm.c \ 65 63 arch/$(KARCH)/src/context.S \ -
kernel/arch/amd64/_link.ld.in
r52cdcbc red212f7 44 44 *(COMMON); /* global variables */ 45 45 46 . = ALIGN(8);47 46 symbol_table = .; 48 47 *(symtab.*); /* Symbol table, must be LAST symbol!*/ -
kernel/arch/amd64/include/context.h
r52cdcbc red212f7 46 46 #define SP_DELTA 16 47 47 48 #define context_set(c, _pc, stack, size) \49 do { \50 (c)->pc = (uintptr_t) (_pc); \51 (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \52 (c)->rbp = 0; \53 } while (0)54 55 48 #endif /* KERNEL */ 56 49 -
kernel/arch/amd64/include/interrupt.h
r52cdcbc red212f7 70 70 71 71 /** This is passed to interrupt handlers */ 72 typedef struct istate{72 typedef struct { 73 73 uint64_t rax; 74 74 uint64_t rcx; … … 80 80 uint64_t r10; 81 81 uint64_t r11; 82 uint64_t rbp;83 82 uint64_t error_word; 84 83 uint64_t rip; … … 102 101 return istate->rip; 103 102 } 104 static inline unative_t istate_get_fp(istate_t *istate)105 {106 return istate->rbp;107 }108 103 109 104 extern void (* disable_irqs_function)(uint16_t irqmask); -
kernel/arch/amd64/src/asm_utils.S
r52cdcbc red212f7 27 27 # 28 28 29 #define IREGISTER_SPACE 8029 #define IREGISTER_SPACE 72 30 30 31 31 #define IOFFSET_RAX 0x0 … … 38 38 #define IOFFSET_R10 0x38 39 39 #define IOFFSET_R11 0x40 40 #define IOFFSET_RBP 0x4841 40 42 41 # Mask for interrupts 0 - 31 (bits 0 - 31) where 0 means that int has no error word … … 180 179 movq %r10, IOFFSET_R10(%rsp) 181 180 movq %r11, IOFFSET_R11(%rsp) 182 movq %rbp, IOFFSET_RBP(%rsp)183 181 .endm 184 182 … … 193 191 movq IOFFSET_R10(%rsp), %r10 194 192 movq IOFFSET_R11(%rsp), %r11 195 movq IOFFSET_RBP(%rsp), %rbp196 193 .endm 197 194 … … 238 235 cld 239 236 240 # Stop stack traces here241 xorq %rbp, %rbp242 243 237 movq $(\i), %rdi # %rdi - first parameter 244 238 movq %rsp, %rsi # %rsi - pointer to istate -
kernel/arch/amd64/src/boot/boot.S
r52cdcbc red212f7 174 174 call arch_pre_main 175 175 176 # create the first stack frame177 pushq $0178 movq %rsp, %rbp179 180 176 call main_bsp 181 177 … … 333 329 334 330 extended_cpuid_msg: 335 .asciz "E rror: Extended CPUID not supported -- CPU is not 64-bit. System halted."331 .asciz "Extended CPUID not supported. System halted." 336 332 long_mode_msg: 337 .asciz " Error: 64-bit long mode not supported. System halted."333 .asciz "64 bit long mode not supported. System halted." 338 334 noexecute_msg: 339 .asciz " Error:No-execute pages not supported. System halted."335 .asciz "No-execute pages not supported. System halted." 340 336 fx_msg: 341 .asciz " Error:FXSAVE/FXRESTORE instructions not supported. System halted."337 .asciz "FXSAVE/FXRESTORE instructions not supported. System halted." 342 338 sse2_msg: 343 .asciz " Error:SSE2 instructions not supported. System halted."339 .asciz "SSE2 instructions not supported. System halted." -
kernel/arch/amd64/src/interrupt.c
r52cdcbc red212f7 53 53 #include <ddi/irq.h> 54 54 #include <symtab.h> 55 #include <stacktrace.h>56 55 57 56 /* … … 81 80 istate->r10, istate->r11); 82 81 printf("%%rsp=%#llx\n", &istate->stack[0]); 83 84 stack_trace_istate(istate);85 82 } 86 83 -
kernel/arch/amd64/src/mm/page.c
r52cdcbc red212f7 203 203 { 204 204 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 205 panic("Unable to map physical memory %p (%d bytes).", physaddr, 206 size); 205 panic("Unable to map physical memory %p (%d bytes).", physaddr, size) 207 206 208 207 uintptr_t virtaddr = PA2KA(last_frame); -
kernel/arch/amd64/src/smp/ap.S
r52cdcbc red212f7 99 99 start64: 100 100 movq (ctx), %rsp 101 pushq $0102 movq %rsp, %rbp103 101 call main_ap - AP_BOOT_OFFSET + BOOT_OFFSET # never returns 104 102 -
kernel/arch/arm32/Makefile.inc
r52cdcbc red212f7 57 57 arch/$(KARCH)/src/exception.c \ 58 58 arch/$(KARCH)/src/userspace.c \ 59 arch/$(KARCH)/src/debug/stacktrace.c \60 arch/$(KARCH)/src/debug/stacktrace_asm.S \61 59 arch/$(KARCH)/src/mm/as.c \ 62 60 arch/$(KARCH)/src/mm/frame.c \ -
kernel/arch/arm32/_link.ld.in
r52cdcbc red212f7 34 34 *(.sdata); 35 35 *(.reginfo); 36 . = ALIGN(8);37 36 symbol_table = .; 38 37 *(symtab.*); -
kernel/arch/arm32/include/exception.h
r52cdcbc red212f7 86 86 87 87 /** Struct representing CPU state saved when an exception occurs. */ 88 typedef struct istate{88 typedef struct { 89 89 uint32_t spsr; 90 90 uint32_t sp; … … 133 133 } 134 134 135 static inline unative_t istate_get_fp(istate_t *istate)136 {137 return istate->r11;138 }139 140 135 141 136 extern void install_exception_handlers(void); -
kernel/arch/arm32/src/mm/page.c
r52cdcbc red212f7 88 88 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) { 89 89 panic("Unable to map physical memory %p (%d bytes).", 90 physaddr, size) ;90 physaddr, size) 91 91 } 92 92 -
kernel/arch/ia32/Makefile.inc
r52cdcbc red212f7 78 78 arch/$(KARCH)/src/context.S \ 79 79 arch/$(KARCH)/src/debug/panic.s \ 80 arch/$(KARCH)/src/debug/stacktrace.c \81 arch/$(KARCH)/src/debug/stacktrace_asm.S \82 80 arch/$(KARCH)/src/delay.s \ 83 81 arch/$(KARCH)/src/asm.S \ -
kernel/arch/ia32/_link.ld.in
r52cdcbc red212f7 42 42 hardcoded_unmapped_kdata_size = .; 43 43 LONG(unmapped_kdata_end - unmapped_kdata_start); 44 . = ALIGN(8);45 44 symbol_table = .; 46 45 *(symtab.*); /* Symbol table, must be LAST symbol! */ -
kernel/arch/ia32/include/context.h
r52cdcbc red212f7 49 49 #define SP_DELTA (8 + STACK_ITEM_SIZE) 50 50 51 #define context_set(c, _pc, stack, size) \52 do { \53 (c)->pc = (uintptr_t) (_pc); \54 (c)->sp = ((uintptr_t) (stack)) + (size) - SP_DELTA; \55 (c)->ebp = 0; \56 } while (0)57 58 51 #endif /* KERNEL */ 59 52 -
kernel/arch/ia32/include/interrupt.h
r52cdcbc red212f7 69 69 #define VECTOR_DEBUG_IPI (IVT_FREEBASE + 2) 70 70 71 typedef struct istate{71 typedef struct { 72 72 uint32_t eax; 73 73 uint32_t ecx; 74 74 uint32_t edx; 75 uint32_t ebp;76 75 77 76 uint32_t gs; … … 103 102 } 104 103 105 static inline unative_t istate_get_fp(istate_t *istate)106 {107 return istate->ebp;108 }109 110 104 extern void (* disable_irqs_function)(uint16_t irqmask); 111 105 extern void (* enable_irqs_function)(uint16_t irqmask); -
kernel/arch/ia32/src/asm.S
r52cdcbc red212f7 269 269 pushl %gs 270 270 271 pushl %ebp272 271 pushl %edx 273 272 pushl %ecx … … 279 278 movw %ax, %es 280 279 281 # stop stack traces here 282 xorl %ebp, %ebp 280 cld 283 281 284 282 pushl %esp # *istate … … 292 290 popl %ecx 293 291 popl %edx 294 popl %ebp295 292 296 293 popl %gs -
kernel/arch/ia32/src/boot/boot.S
r52cdcbc red212f7 94 94 pushl grub_eax 95 95 call arch_pre_main 96 97 # Create the first stack frame98 pushl $099 movl %esp, %ebp100 96 101 97 call main_bsp -
kernel/arch/ia32/src/interrupt.c
r52cdcbc red212f7 53 53 #include <ddi/irq.h> 54 54 #include <symtab.h> 55 #include <stacktrace.h>56 55 57 56 /* … … 80 79 printf("stack: %#lx, %#lx, %#lx, %#lx\n", istate->stack[0], istate->stack[1], istate->stack[2], istate->stack[3]); 81 80 printf(" %#lx, %#lx, %#lx, %#lx\n", istate->stack[4], istate->stack[5], istate->stack[6], istate->stack[7]); 82 83 stack_trace_istate(istate);84 81 } 85 82 -
kernel/arch/ia32/src/mm/page.c
r52cdcbc red212f7 80 80 { 81 81 if (last_frame + ALIGN_UP(size, PAGE_SIZE) > KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 82 panic("Unable to map physical memory %p (%d bytes).", physaddr, size) ;82 panic("Unable to map physical memory %p (%d bytes).", physaddr, size) 83 83 84 84 uintptr_t virtaddr = PA2KA(last_frame); -
kernel/arch/ia32/src/smp/ap.S
r52cdcbc red212f7 78 78 addl $0x80000000, %esp # PA2KA(ctx.sp) 79 79 80 pushl $0 # create the first stack frame81 movl %esp, %ebp82 83 80 jmpl $KTEXT, $main_ap 84 81 -
kernel/arch/ia64/Makefile.inc
r52cdcbc red212f7 53 53 arch/$(KARCH)/src/context.S \ 54 54 arch/$(KARCH)/src/cpu/cpu.c \ 55 arch/$(KARCH)/src/debug/stacktrace.c \56 arch/$(KARCH)/src/debug/stacktrace_asm.S \57 55 arch/$(KARCH)/src/ivt.S \ 58 56 arch/$(KARCH)/src/interrupt.c \ -
kernel/arch/ia64/_link.ld.in
r52cdcbc red212f7 37 37 *(COMMON); 38 38 39 . = ALIGN(8);40 39 symbol_table = .; 41 40 *(symtab.*); /* Symbol table, must be LAST symbol!*/ -
kernel/arch/ia64/include/interrupt.h
r52cdcbc red212f7 72 72 #define EOI 0 /**< The actual value doesn't matter. */ 73 73 74 typedef struct istate{74 typedef struct { 75 75 uint128_t f2; 76 76 uint128_t f3; … … 143 143 } 144 144 145 static inline unative_t istate_get_fp(istate_t *istate)146 {147 return 0; /* FIXME */148 }149 150 145 static inline int istate_from_uspace(istate_t *istate) 151 146 { -
kernel/arch/ia64/include/mm/asid.h
r52cdcbc red212f7 50 50 * but those extra bits are not used by the kernel. 51 51 */ 52 #define RIDS_PER_ASID 852 #define RIDS_PER_ASID 7 53 53 54 54 #define RID_MAX 262143 /* 2^18 - 1 */ 55 #define RID_KERNEL7 7 55 #define RID_KERNEL 0 56 #define RID_INVALID 1 56 57 57 #define ASID2RID(asid, vrn) \58 ((asid) * RIDS_PER_ASID + (vrn))58 #define ASID2RID(asid, vrn) (((asid)>RIDS_PER_ASID)?(((asid)*RIDS_PER_ASID)+(vrn)):(asid)) 59 #define RID2ASID(rid) ((rid)/RIDS_PER_ASID) 59 60 60 #define RID2ASID(rid) \ 61 ((rid) / RIDS_PER_ASID) 62 63 #define ASID_MAX_ARCH (RID_MAX / RIDS_PER_ASID) 61 #define ASID_MAX_ARCH (RID_MAX/RIDS_PER_ASID) 64 62 65 63 #endif -
kernel/arch/ia64/src/mm/page.c
r52cdcbc red212f7 71 71 72 72 /* 73 * Set up kernel region registers. 74 * VRN_KERNEL has already been set in start.S. 75 * For paranoia reasons, we set it again. 73 * First set up kernel region register. 74 * This is redundant (see start.S) but we keep it here just for sure. 75 */ 76 rr.word = rr_read(VRN_KERNEL); 77 rr.map.ve = 0; /* disable VHPT walker */ 78 rr.map.ps = PAGE_WIDTH; 79 rr.map.rid = ASID2RID(ASID_KERNEL, VRN_KERNEL); 80 rr_write(VRN_KERNEL, rr.word); 81 srlz_i(); 82 srlz_d(); 83 84 /* 85 * And setup the rest of region register. 76 86 */ 77 87 for(i = 0; i < REGION_REGISTERS; i++) { 88 /* skip kernel rr */ 89 if (i == VRN_KERNEL) 90 continue; 91 78 92 rr.word = rr_read(i); 79 93 rr.map.ve = 0; /* disable VHPT walker */ 80 rr.map.rid = ASID2RID(ASID_KERNEL, i);94 rr.map.rid = RID_KERNEL; 81 95 rr.map.ps = PAGE_WIDTH; 82 96 rr_write(i, rr.word); -
kernel/arch/ia64/src/start.S
r52cdcbc red212f7 74 74 movl r10 = (RR_MASK) 75 75 and r9 = r10, r9 76 movl r10 = (( (RID_KERNEL7)<< RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT))76 movl r10 = ((RID_KERNEL << RID_SHIFT) | (KERNEL_PAGE_WIDTH << PS_SHIFT)) 77 77 or r9 = r10, r9 78 78 -
kernel/arch/mips32/Makefile.inc
r52cdcbc red212f7 70 70 arch/$(KARCH)/src/debugger.c \ 71 71 arch/$(KARCH)/src/cpu/cpu.c \ 72 arch/$(KARCH)/src/debug/stacktrace.c \73 arch/$(KARCH)/src/debug/stacktrace_asm.S \74 72 arch/$(KARCH)/src/mm/frame.c \ 75 73 arch/$(KARCH)/src/mm/page.c \ -
kernel/arch/mips32/_link.ld.in
r52cdcbc red212f7 38 38 *(.bss); /* uninitialized static variables */ 39 39 *(COMMON); /* global variables */ 40 . = ALIGN(8);41 40 symbol_table = .; 42 41 *(symtab.*); -
kernel/arch/mips32/include/exception.h
r52cdcbc red212f7 58 58 #define EXC_VCED 31 59 59 60 typedef struct istate{60 typedef struct { 61 61 uint32_t at; 62 62 uint32_t v0; … … 102 102 return istate->epc; 103 103 } 104 static inline unative_t istate_get_fp(istate_t *istate)105 {106 return 0; /* FIXME */107 }108 104 109 105 extern void exception(istate_t *istate); -
kernel/arch/ppc32/Makefile.inc
r52cdcbc red212f7 46 46 arch/$(KARCH)/src/context.S \ 47 47 arch/$(KARCH)/src/debug/panic.s \ 48 arch/$(KARCH)/src/debug/stacktrace.c \49 arch/$(KARCH)/src/debug/stacktrace_asm.S \50 48 arch/$(KARCH)/src/fpu_context.S \ 51 49 arch/$(KARCH)/src/boot/boot.S \ -
kernel/arch/ppc32/_link.ld.in
r52cdcbc red212f7 51 51 *(COMMON); /* global variables */ 52 52 53 . = ALIGN(8);54 53 symbol_table = .; 55 54 *(symtab.*); /* Symbol table, must be LAST symbol!*/ -
kernel/arch/ppc32/include/exception.h
r52cdcbc red212f7 39 39 #include <arch/regutils.h> 40 40 41 typedef struct istate{41 typedef struct { 42 42 uint32_t r0; 43 43 uint32_t r2; … … 98 98 } 99 99 100 static inline unative_t istate_get_fp(istate_t *istate)101 {102 return istate->sp;103 }104 105 100 #endif 106 101 -
kernel/arch/ppc32/src/mm/page.c
r52cdcbc red212f7 51 51 KA2PA(KERNEL_ADDRESS_SPACE_END_ARCH)) 52 52 panic("Unable to map physical memory %p (%" PRIs " bytes).", 53 physaddr, size) ;53 physaddr, size) 54 54 55 55 uintptr_t virtaddr = PA2KA(last_frame); -
kernel/arch/sparc64/Makefile.inc
r52cdcbc red212f7 54 54 ARCH_SOURCES = \ 55 55 arch/$(KARCH)/src/cpu/cpu.c \ 56 arch/$(KARCH)/src/debug/stacktrace.c \57 arch/$(KARCH)/src/debug/stacktrace_asm.S \58 56 arch/$(KARCH)/src/asm.S \ 59 57 arch/$(KARCH)/src/panic.S \ -
kernel/arch/sparc64/_link.ld.in
r52cdcbc red212f7 36 36 *(COMMON); /* global variables */ 37 37 38 . = ALIGN(8);39 38 symbol_table = .; 40 39 *(symtab.*); /* Symbol table, must be LAST symbol!*/ -
kernel/arch/sparc64/include/interrupt.h
r52cdcbc red212f7 50 50 }; 51 51 52 typedef struct istate{52 typedef struct { 53 53 uint64_t tnpc; 54 54 uint64_t tpc; … … 71 71 } 72 72 73 static inline unative_t istate_get_fp(istate_t *istate)74 {75 return 0; /* TODO */76 }77 78 73 #endif 79 74 -
kernel/generic/include/debug.h
r52cdcbc red212f7 75 75 # define LOG(format, ...) \ 76 76 printf("%s() at %s:%u: " format "\n", __func__, __FILE__, \ 77 77 __LINE__, ##__VA_ARGS__); 78 78 #else 79 79 # define LOG(format, ...) … … 92 92 { \ 93 93 printf("%s() at %s:%u: " #fnc "\n", __func__, __FILE__, \ 94 94 __LINE__); \ 95 95 fnc; \ 96 96 } -
kernel/generic/include/interrupt.h
r52cdcbc red212f7 42 42 #include <arch.h> 43 43 #include <ddi/irq.h> 44 #include <stacktrace.h>45 44 46 45 typedef void (* iroutine)(int n, istate_t *istate); … … 50 49 if (istate_from_uspace(istate)) { \ 51 50 task_t *task = TASK; \ 52 printf("Task %s (%" PRIu64 ") killed due to an exception at " \ 53 "program counter %p.\n", task->name, task->taskid, istate_get_pc(istate)); \ 54 stack_trace_istate(istate); \ 55 printf("Kill message: " fmt "\n", ##__VA_ARGS__); \ 51 printf("Task %s (%" PRIu64 ") killed due to an exception at %p: ", task->name, task->taskid, istate_get_pc(istate)); \ 52 printf(fmt "\n", ##__VA_ARGS__); \ 56 53 task_kill(task->taskid); \ 57 54 thread_exit(); \ -
kernel/generic/include/panic.h
r52cdcbc red212f7 36 36 #define KERN_PANIC_H_ 37 37 38 #include <stacktrace.h>39 #include <print.h>40 41 38 #ifdef CONFIG_DEBUG 42 39 # define panic(format, ...) \ 43 do { \ 44 printf("Kernel panic in %s() at %s:%u.\n", \ 45 __func__, __FILE__, __LINE__); \ 46 stack_trace(); \ 47 panic_printf("Panic message: " format "\n", \ 48 ##__VA_ARGS__);\ 49 } while (0) 40 panic_printf("Kernel panic in %s() at %s:%u: " format "\n", \ 41 __func__, __FILE__, __LINE__, ##__VA_ARGS__); 50 42 #else 51 43 # define panic(format, ...) \ -
kernel/generic/include/symtab.h
r52cdcbc red212f7 45 45 }; 46 46 47 extern int symtab_name_lookup(u intptr_t, char **, uintptr_t *);48 extern char *symtab_fmt_name_lookup(u intptr_t);49 extern int symtab_addr_lookup(const char * , uintptr_t *);50 extern void symtab_print_search(const char * );51 extern int symtab_compl(char * , size_t);47 extern int symtab_name_lookup(unative_t addr, char **name); 48 extern char *symtab_fmt_name_lookup(unative_t addr); 49 extern int symtab_addr_lookup(const char *name, uintptr_t *addr); 50 extern void symtab_print_search(const char *name); 51 extern int symtab_compl(char *input, size_t size); 52 52 53 53 #ifdef CONFIG_SYMTAB -
kernel/generic/src/debug/symtab.c
r52cdcbc red212f7 46 46 /** Get name of a symbol that seems most likely to correspond to address. 47 47 * 48 * @param addr Address. 49 * @param name Place to store pointer to the symbol name. 50 * @param offset Place to store offset from the symbol address. 48 * @param addr Address. 49 * @param name Place to store pointer to the symbol name. 51 50 * 52 51 * @return Zero on success or negative error code, ENOENT if not found, … … 54 53 * 55 54 */ 56 int symtab_name_lookup(u intptr_t addr, char **name, uintptr_t *offset)55 int symtab_name_lookup(unative_t addr, char **name) 57 56 { 58 57 #ifdef CONFIG_SYMTAB … … 66 65 if (addr >= uint64_t_le2host(symbol_table[i - 1].address_le)) { 67 66 *name = symbol_table[i - 1].symbol_name; 68 if (offset)69 *offset = addr -70 uint64_t_le2host(symbol_table[i - 1].address_le);71 67 return EOK; 72 68 } … … 92 88 * 93 89 */ 94 char *symtab_fmt_name_lookup(u intptr_t addr)90 char *symtab_fmt_name_lookup(unative_t addr) 95 91 { 96 92 char *name; 97 int rc = symtab_name_lookup(addr, &name , NULL);93 int rc = symtab_name_lookup(addr, &name); 98 94 99 95 switch (rc) { -
uspace/Makefile
r52cdcbc red212f7 38 38 app/init \ 39 39 app/klog \ 40 app/mkfat \41 40 app/redir \ 42 41 app/tester \ -
uspace/app/bdsh/Makefile.build
r52cdcbc red212f7 42 42 cmds/modules/help/help.c \ 43 43 cmds/modules/mkdir/mkdir.c \ 44 cmds/modules/mkfile/mkfile.c \45 44 cmds/modules/rm/rm.c \ 46 45 cmds/modules/bdd/bdd.c \ -
uspace/app/bdsh/cmds/modules/modules.h
r52cdcbc red212f7 20 20 #include "help/entry.h" 21 21 #include "mkdir/entry.h" 22 #include "mkfile/entry.h"23 22 #include "rm/entry.h" 24 23 #include "bdd/entry.h" … … 40 39 #include "help/help_def.h" 41 40 #include "mkdir/mkdir_def.h" 42 #include "mkfile/mkfile_def.h"43 41 #include "rm/rm_def.h" 44 42 #include "bdd/bdd_def.h" -
uspace/app/edit/edit.c
r52cdcbc red212f7 98 98 static bool done; 99 99 static pane_t pane; 100 static bool cursor_visible;101 100 102 101 static int scr_rows, scr_columns; … … 109 108 /** Maximum filename length that can be entered. */ 110 109 #define INFNAME_MAX_LEN 128 111 112 static void cursor_show(void);113 static void cursor_hide(void);114 static void cursor_setvis(bool visible);115 110 116 111 static void key_handle_unmod(console_event_t const *ev); … … 204 199 205 200 /* Initial display */ 206 cursor_visible = true;207 208 cursor_hide();209 201 console_clear(con); 210 202 pane_text_display(); … … 213 205 status_display("File not found. Starting empty file."); 214 206 pane_caret_display(); 215 cursor_show(); 207 216 208 217 209 done = false; … … 238 230 /* Redraw as necessary. */ 239 231 240 cursor_hide();241 242 232 if (pane.rflags & REDRAW_TEXT) 243 233 pane_text_display(); … … 248 238 if (pane.rflags & REDRAW_CARET) 249 239 pane_caret_display(); 250 251 cursor_show();252 240 } 253 241 … … 255 243 256 244 return 0; 257 }258 259 static void cursor_show(void)260 {261 cursor_setvis(true);262 }263 264 static void cursor_hide(void)265 {266 cursor_setvis(false);267 }268 269 static void cursor_setvis(bool visible)270 {271 if (cursor_visible != visible) {272 console_cursor_visibility(con, visible);273 cursor_visible = visible;274 }275 245 } 276 246 -
uspace/lib/libblock/libblock.c
r52cdcbc red212f7 87 87 static int write_blocks(devcon_t *devcon, bn_t ba, size_t cnt); 88 88 static int get_block_size(int dev_phone, size_t *bsize); 89 static int get_num_blocks(int dev_phone, bn_t *nblocks);90 89 91 90 static devcon_t *devcon_search(dev_handle_t dev_handle) … … 715 714 716 715 memcpy(devcon->comm_area, data, devcon->pblock_size * cnt); 717 rc = write_blocks(devcon, ba, cnt);716 rc = read_blocks(devcon, ba, cnt); 718 717 719 718 fibril_mutex_unlock(&devcon->comm_area_lock); … … 737 736 738 737 return get_block_size(devcon->dev_phone, bsize); 739 }740 741 /** Get number of blocks on device.742 *743 * @param dev_handle Device handle of the block device.744 * @param nblocks Output number of blocks.745 *746 * @return EOK on success or negative error code on failure.747 */748 int block_get_nblocks(dev_handle_t dev_handle, bn_t *nblocks)749 {750 devcon_t *devcon;751 752 devcon = devcon_search(dev_handle);753 assert(devcon);754 755 return get_num_blocks(devcon->dev_phone, nblocks);756 738 } 757 739 … … 807 789 } 808 790 809 /** Get total number of blocks on block device. */810 static int get_num_blocks(int dev_phone, bn_t *nblocks)811 {812 ipcarg_t nb_l, nb_h;813 int rc;814 815 rc = async_req_0_2(dev_phone, BD_GET_NUM_BLOCKS, &nb_l, &nb_h);816 if (rc == EOK) {817 *nblocks = (bn_t) MERGE_LOUP32(nb_l, nb_h);818 }819 820 return rc;821 }822 823 791 /** @} 824 792 */ -
uspace/lib/libblock/libblock.h
r52cdcbc red212f7 60 60 #define BLOCK_FLAGS_NOREAD 1 61 61 62 typedef uint64_t bn_t; /**< Block number type. */ 63 62 64 typedef struct block { 63 65 /** Mutex protecting the reference count. */ … … 108 110 109 111 extern int block_get_bsize(dev_handle_t, size_t *); 110 extern int block_get_nblocks(dev_handle_t, bn_t *);111 112 extern int block_read_direct(dev_handle_t, bn_t, size_t, void *); 112 113 extern int block_write_direct(dev_handle_t, bn_t, size_t, const void *); -
uspace/lib/libc/generic/io/io.c
r52cdcbc red212f7 554 554 } 555 555 556 int ftell(FILE *stream)557 {558 off_t rc = lseek(stream->fd, 0, SEEK_CUR);559 if (rc == (off_t) (-1)) {560 /* errno has been set by lseek. */561 return -1;562 }563 564 return rc;565 }566 567 556 void rewind(FILE *stream) 568 557 { … … 595 584 } 596 585 597 void clearerr(FILE *stream)598 {599 stream->eof = false;600 stream->error = false;601 }602 603 586 int fphone(FILE *stream) 604 587 { -
uspace/lib/libc/generic/stacktrace.c
r52cdcbc red212f7 39 39 void stack_trace_fp_pc(uintptr_t fp, uintptr_t pc) 40 40 { 41 printf("Printing stack trace:\n"); 42 printf("=====================\n"); 41 43 while (frame_pointer_validate(fp)) { 42 44 printf("%p: %p()\n", fp, pc); … … 44 46 fp = frame_pointer_prev(fp); 45 47 } 48 printf("=====================\n"); 46 49 } 47 50 -
uspace/lib/libc/include/assert.h
r52cdcbc red212f7 51 51 52 52 #ifndef NDEBUG 53 # define assert(expr) \ 54 do { \ 55 if (!(expr)) { \ 56 printf("Assertion failed (%s) at file '%s', " \ 57 "line %d.\n", #expr, __FILE__, __LINE__); \ 58 abort(); \ 59 } \ 60 } while (0) 53 # define assert(expr) if (!(expr)) { printf("Assertion failed (%s) at file '%s', line %d.\n", #expr, __FILE__, __LINE__); abort();} 61 54 #else 62 55 # define assert(expr) -
uspace/lib/libc/include/ipc/bd.h
r52cdcbc red212f7 40 40 typedef enum { 41 41 BD_GET_BLOCK_SIZE = IPC_FIRST_USER_METHOD, 42 BD_GET_NUM_BLOCKS,43 42 BD_READ_BLOCKS, 44 43 BD_WRITE_BLOCKS -
uspace/lib/libc/include/sys/types.h
r52cdcbc red212f7 40 40 typedef long off_t; 41 41 typedef int mode_t; 42 typedef uint64_t bn_t; /**< Block number type. */43 42 44 43 typedef int32_t wchar_t; -
uspace/srv/bd/ata_bd/ata_bd.c
r52cdcbc red212f7 296 296 ipc_answer_1(callid, EOK, block_size); 297 297 continue; 298 case BD_GET_NUM_BLOCKS:299 ipc_answer_2(callid, EOK, LOWER32(disk[disk_id].blocks),300 UPPER32(disk[disk_id].blocks));301 continue;302 298 default: 303 299 retval = EINVAL; -
uspace/srv/bd/file_bd/file_bd.c
r52cdcbc red212f7 56 56 57 57 static const size_t block_size = 512; 58 static bn_t num_blocks;59 58 static FILE *img; 60 59 … … 100 99 { 101 100 int rc; 102 long img_size;103 101 104 102 rc = devmap_driver_register(NAME, file_bd_connection); … … 111 109 if (img == NULL) 112 110 return EINVAL; 113 114 if (fseek(img, 0, SEEK_END) != 0) {115 fclose(img);116 return EIO;117 }118 119 img_size = ftell(img);120 if (img_size < 0) {121 fclose(img);122 return EIO;123 }124 125 num_blocks = img_size / block_size;126 111 127 112 fibril_mutex_initialize(&dev_lock); … … 189 174 ipc_answer_1(callid, EOK, block_size); 190 175 continue; 191 case BD_GET_NUM_BLOCKS:192 ipc_answer_2(callid, EOK, LOWER32(num_blocks),193 UPPER32(num_blocks));194 continue;195 176 default: 196 177 retval = EINVAL; … … 205 186 { 206 187 size_t n_rd; 207 int rc;208 188 209 189 fibril_mutex_lock(&dev_lock); 210 190 211 clearerr(img); 212 rc = fseek(img, ba * block_size, SEEK_SET); 213 if (rc < 0) { 214 fibril_mutex_unlock(&dev_lock); 215 return EIO; 216 } 217 191 fseek(img, ba * block_size, SEEK_SET); 218 192 n_rd = fread(buf, block_size, cnt, img); 219 193 … … 235 209 { 236 210 size_t n_wr; 237 int rc;238 211 239 212 fibril_mutex_lock(&dev_lock); 240 213 241 clearerr(img); 242 rc = fseek(img, ba * block_size, SEEK_SET); 243 if (rc < 0) { 244 fibril_mutex_unlock(&dev_lock); 245 return EIO; 246 } 247 248 n_wr = fwrite(buf, block_size, cnt, img); 214 fseek(img, ba * block_size, SEEK_SET); 215 n_wr = fread(buf, block_size, cnt, img); 249 216 250 217 if (ferror(img) || n_wr < cnt) { … … 253 220 } 254 221 255 if (fflush(img) != 0) {256 fibril_mutex_unlock(&dev_lock);257 return EIO;258 }259 260 222 fibril_mutex_unlock(&dev_lock); 261 223 -
uspace/srv/bd/gxe_bd/gxe_bd.c
r52cdcbc red212f7 234 234 ipc_answer_1(callid, EOK, block_size); 235 235 continue; 236 case BD_GET_NUM_BLOCKS:237 retval = ENOTSUP;238 break;239 236 default: 240 237 retval = EINVAL; -
uspace/srv/bd/part/mbr_part/mbr_part.c
r52cdcbc red212f7 463 463 ipc_answer_1(callid, EOK, block_size); 464 464 continue; 465 case BD_GET_NUM_BLOCKS: 466 ipc_answer_2(callid, EOK, LOWER32(part->length), 467 UPPER32(part->length)); 468 continue; 465 469 466 default: 470 467 retval = EINVAL; -
uspace/srv/bd/rd/rd.c
r52cdcbc red212f7 153 153 ipc_answer_1(callid, EOK, block_size); 154 154 continue; 155 case BD_GET_NUM_BLOCKS:156 ipc_answer_2(callid, EOK, LOWER32(rd_size / block_size),157 UPPER32(rd_size / block_size));158 continue;159 155 default: 160 156 /* -
uspace/srv/vfs/vfs_ops.c
r52cdcbc red212f7 900 900 } 901 901 newpos = size + off; 902 file->pos = newpos;903 902 fibril_mutex_unlock(&file->lock); 904 903 ipc_answer_1(rid, EOK, newpos);
Note:
See TracChangeset
for help on using the changeset viewer.