Changes in / [c742954:c483fca] in mainline
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia64/src/drivers/ski.c
rc742954 rc483fca 37 37 #include <console/console.h> 38 38 #include <console/chardev.h> 39 #include <ddi/ddi.h> 39 40 #include <sysinfo/sysinfo.h> 40 41 #include <stdint.h> … … 69 70 70 71 static ski_instance_t *instance = NULL; 72 static parea_t ski_parea; 71 73 72 74 /** Ask debug console if a key was pressed. … … 105 107 int count = POLL_LIMIT; 106 108 109 if (ski_parea.mapped && !console_override) 110 return; 111 107 112 while (count > 0) { 108 113 wchar_t ch = ski_getchar(); … … 122 127 123 128 while (true) { 124 // TODO FIXME: 125 // This currently breaks the kernel console 126 // before we get the override from uspace. 127 if (console_override) 128 poll_keyboard(instance); 129 129 poll_keyboard(instance); 130 130 thread_usleep(POLL_INTERVAL); 131 131 } … … 140 140 static void ski_init(void) 141 141 { 142 uintptr_t faddr; 143 142 144 if (instance) 143 145 return; … … 150 152 : "r15", "r8" 151 153 ); 154 155 faddr = frame_alloc(1, FRAME_LOWMEM | FRAME_ATOMIC, 0); 156 if (faddr == 0) 157 panic("Cannot allocate page for ski console."); 158 159 ddi_parea_init(&ski_parea); 160 ski_parea.pbase = faddr; 161 ski_parea.frames = 1; 162 ski_parea.unpriv = false; 163 ski_parea.mapped = false; 164 ddi_parea_register(&ski_parea); 165 166 sysinfo_set_item_val("ski.paddr", NULL, (sysarg_t) faddr); 152 167 153 168 instance = malloc(sizeof(ski_instance_t)); … … 190 205 static void ski_putwchar(outdev_t *dev, wchar_t ch) 191 206 { 192 // TODO FIXME: 193 // This currently breaks the kernel console 194 // before we get the override from uspace. 195 if (console_override) { 196 if (ascii_check(ch)) { 197 if (ch == '\n') 198 ski_do_putchar('\r'); 199 200 ski_do_putchar(ch); 201 } else { 202 ski_do_putchar('?'); 203 } 207 if (ski_parea.mapped && !console_override) 208 return; 209 210 if (ascii_check(ch)) { 211 if (ch == '\n') 212 ski_do_putchar('\r'); 213 214 ski_do_putchar(ch); 215 } else { 216 ski_do_putchar('?'); 204 217 } 205 218 } -
kernel/generic/include/mm/as.h
rc742954 rc483fca 268 268 269 269 extern as_t *as_create(unsigned int); 270 extern void as_destroy(as_t *);271 270 extern void as_hold(as_t *); 272 271 extern void as_release(as_t *); -
kernel/generic/src/console/console.c
rc742954 rc483fca 209 209 void grab_console(void) 210 210 { 211 sysinfo_set_item_val("kconsole", NULL, true); 211 212 event_notify_1(EVENT_KCONSOLE, false, true); 212 213 bool prev = console_override; … … 226 227 void release_console(void) 227 228 { 229 sysinfo_set_item_val("kconsole", NULL, false); 228 230 console_override = false; 229 231 event_notify_1(EVENT_KCONSOLE, false, false); -
kernel/generic/src/mm/as.c
rc742954 rc483fca 187 187 * 188 188 */ 189 void as_destroy(as_t *as)189 static void as_destroy(as_t *as) 190 190 { 191 191 DEADLOCK_PROBE_INIT(p_asidlock); -
kernel/generic/src/proc/program.c
rc742954 rc483fca 150 150 prg->loader_status = elf_load((elf_header_t *) image_addr, as); 151 151 if (prg->loader_status != EE_OK) { 152 as_ destroy(as);152 as_release(as); 153 153 prg->task = NULL; 154 154 prg->main_thread = NULL; … … 176 176 void *loader = program_loader; 177 177 if (!loader) { 178 as_ destroy(as);178 as_release(as); 179 179 log(LF_OTHER, LVL_ERROR, 180 180 "Cannot spawn loader as none was registered"); … … 184 184 prg->loader_status = elf_load((elf_header_t *) program_loader, as); 185 185 if (prg->loader_status != EE_OK) { 186 as_ destroy(as);186 as_release(as); 187 187 log(LF_OTHER, LVL_ERROR, "Cannot spawn loader (%s)", 188 188 elf_error(prg->loader_status)); -
tools/xcw/bin/helenos-bld-config
rc742954 rc483fca 33 33 34 34 SRC_ROOT="$(dirname "$0")/../../.." 35 MAKEFILE_COMMON="$SRC_ROOT"/Makefile.common 36 MAKEFILE_CONFIG="$SRC_ROOT"/Makefile.config 37 CONFIG_MK="$SRC_ROOT"/uspace/export/config.mk 35 if [ -z "$EXPORT_DIR" ]; then 36 EXPORT_DIR="$SRC_ROOT/uspace/export" 37 fi 38 MAKEFILE_COMMON="$EXPORT_DIR"/Makefile.common 39 MAKEFILE_CONFIG="$EXPORT_DIR"/Makefile.config 40 CONFIG_MK="$EXPORT_DIR"/config.mk 38 41 39 42 # Extract simple 'name = value' variable definition from Makefile -
tools/xcw/bin/helenos-cc
rc742954 rc483fca 34 34 XCW="$(dirname "$0")" 35 35 SRC_ROOT="$XCW/../../.." 36 if [ -z "$EXPORT_DIR" ]; then 37 EXPORT_DIR="$SRC_ROOT/uspace/export" 38 fi 36 39 UARCH="$("$XCW"/helenos-bld-config --uarch)" 37 40 CC="$("$XCW"/helenos-bld-config --cc)" … … 49 52 "$@" \ 50 53 -I"$XCW"/../include \ 51 -I"$SRC_ROOT"/uspace/lib/c/include \ 52 -I"$SRC_ROOT"/abi/include \ 53 -I"$SRC_ROOT"/uspace/lib/c/arch/"$UARCH"/include 54 -I"$EXPORT_DIR"/include/libc \ 55 -I"$EXPORT_DIR"/include -
tools/xcw/bin/helenos-ld
rc742954 rc483fca 34 34 XCW="$(dirname "$0")" 35 35 SRC_ROOT="$XCW/../../.." 36 if [ -z "$EXPORT_DIR" ]; then 37 EXPORT_DIR="$SRC_ROOT/uspace/export" 38 fi 36 39 UARCH="$("$XCW"/helenos-bld-config --uarch)" 37 40 CFLAGS="$("$XCW"/helenos-bld-config --cflags)" … … 43 46 $CFLAGS \ 44 47 "$@" \ 45 "$ SRC_ROOT"/uspace/lib/c/crt0.o \46 "$ SRC_ROOT"/uspace/lib/c/crt1.o \47 "$ SRC_ROOT"/uspace/lib/c/libc.a \48 "$EXPORT_DIR"/lib/crt0.o \ 49 "$EXPORT_DIR"/lib/crt1.o \ 50 "$EXPORT_DIR"/lib/libc.a \ 48 51 -lgcc -
tools/xcw/bin/helenos-pkg-config
rc742954 rc483fca 35 35 SRC_ROOT="$XCW/../../.." 36 36 UARCH="$("$XCW"/helenos-bld-config --uarch)" 37 if [ -z "$EXPORT_DIR" ]; then 38 EXPORT_DIR="$SRC_ROOT/uspace/export" 39 fi 40 INCLUDE_DIR="$EXPORT_DIR/include" 41 LIB_DIR="$EXPORT_DIR/lib" 37 42 38 libmath_cflags="-I$SRC_ROOT/uspace/lib/math/include\ 39 -I$SRC_ROOT/uspace/lib/math/arch/$UARCH/include" 40 libmath_libs="$SRC_ROOT/uspace/lib/math/libmath.a" 43 libmath_cflags="-I$INCLUDE_DIR/libmath" 44 libmath_libs="$LIB_DIR/libmath.a" 41 45 42 libgui_cflags="-I$ SRC_ROOT/uspace/lib/gui"43 libgui_libs="$ SRC_ROOT/uspace/lib/gui/libgui.a"46 libgui_cflags="-I$INCLUDE_DIR/libgui" 47 libgui_libs="$LIB_DIR/libgui.a" 44 48 45 libdraw_cflags="-I$SRC_ROOT/uspace/lib/draw" 46 libdraw_libs="$SRC_ROOT/uspace/lib/draw/libdraw.a \ 47 $SRC_ROOT/uspace/lib/softrend/libsoftrend.a" 49 libdraw_cflags="-I$INCLUDE_DIR/libdraw" 50 libdraw_libs="$LIB_DIR/libdraw.a $LIB_DIR/libsoftrend.a" 48 51 49 libhound_cflags="-I$ SRC_ROOT/uspace/lib/hound/include"50 libhound_libs="$ SRC_ROOT/uspace/lib/hound/libhound.a"52 libhound_cflags="-I$INCLUDE_DIR/libhound" 53 libhound_libs="$LIB_DIR/libhound.a" 51 54 52 libpcm_cflags="-I$ SRC_ROOT/uspace/lib/pcm/include"53 libpcm_libs="$ SRC_ROOT/uspace/lib/pcm/libpcm.a"55 libpcm_cflags="-I$INCLUDE_DIR/libpcm" 56 libpcm_libs="$LIB_DIR/libpcm.a" 54 57 55 58 action=none -
uspace/Makefile
rc742954 rc483fca 273 273 $(MAKE) -r -C $(basename $@) all-test PRECHECK=$(PRECHECK) 274 274 275 export: lib/posix.build lib/math.build lib/clui.build275 export: $(BUILDS) 276 276 $(MAKE) -r -C lib/posix export EXPORT_DIR=$(EXPORT_DIR) 277 277 -
uspace/app/fontviewer/fontviewer.c
rc742954 rc483fca 170 170 source_t leading_bg = rgb(170, 238, 255); 171 171 source_t leading_fg = rgb(0, 170, 212); 172 173 font_t *font; 172 font_t *info_font = NULL; 173 font_t *font = NULL; 174 174 175 errno_t rc = create_font(&font, points); 175 176 if (rc != EOK) { 176 177 printf("Failed creating font\n"); 177 return rc; 178 } 179 180 font_t *info_font; 178 goto out_err; 179 } 180 181 181 rc = embedded_font_create(&info_font, 16); 182 182 if (rc != EOK) { 183 183 printf("Failed creating info font\n"); 184 return rc;184 goto out_err; 185 185 } 186 186 … … 188 188 rc = font_get_metrics(font, &font_metrics); 189 189 if (rc != EOK) 190 return rc;190 goto out_err; 191 191 192 192 surface_coord_t top = 50; … … 238 238 } 239 239 240 font_release(font); 241 return EOK; 240 out_err: 241 if (font) 242 font_release(font); 243 if (info_font) 244 font_release(info_font); 245 return rc; 242 246 } 243 247 -
uspace/drv/char/ski-con/ski-con.c
rc742954 rc483fca 1 1 /* 2 2 * Copyright (c) 2005 Jakub Jermar 3 * Copyright (c) 201 7Jiri Svoboda3 * Copyright (c) 2018 Jiri Svoboda 4 4 * All rights reserved. 5 5 * … … 31 31 */ 32 32 33 #include <as.h> 33 34 #include <async.h> 34 35 #include <ddf/driver.h> 35 36 #include <ddf/log.h> 37 #include <ddi.h> 36 38 #include <errno.h> 37 39 #include <fibril.h> … … 40 42 #include <stdlib.h> 41 43 #include <stdbool.h> 44 #include <sysinfo.h> 42 45 43 46 #include "ski-con.h" … … 68 71 ddf_fun_t *fun = NULL; 69 72 bool bound = false; 73 uintptr_t faddr; 74 void *addr = AS_AREA_ANY; 70 75 errno_t rc; 71 76 … … 87 92 con->cds.sarg = con; 88 93 94 rc = sysinfo_get_value("ski.paddr", &faddr); 95 if (rc != EOK) 96 faddr = 0; /* No kernel driver to arbitrate with */ 97 98 if (faddr != 0) { 99 addr = AS_AREA_ANY; 100 rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE, 101 &addr); 102 if (rc != EOK) { 103 ddf_msg(LVL_ERROR, "Cannot map kernel driver arbitration area."); 104 goto error; 105 } 106 } 107 89 108 rc = ddf_fun_bind(fun); 90 109 if (rc != EOK) { … … 107 126 return EOK; 108 127 error: 128 if (addr != AS_AREA_ANY) 129 as_area_destroy(addr); 109 130 if (bound) 110 131 ddf_fun_unbind(fun); … … 127 148 } 128 149 150 /** Detect if SKI console is in use by the kernel. 151 * 152 * This is needed since the kernel has no way of fencing off the user-space 153 * driver. 154 * 155 * @return @c true if in use by the kernel. 156 */ 157 static bool ski_con_disabled(void) 158 { 159 sysarg_t kconsole; 160 161 /* 162 * XXX Ideally we should get information from our kernel counterpart 163 * driver. But there needs to be a mechanism for the kernel console 164 * to inform the kernel driver. 165 */ 166 if (sysinfo_get_value("kconsole", &kconsole) != EOK) 167 return false; 168 169 return kconsole != false; 170 } 171 129 172 /** Poll Ski for keypresses. */ 130 173 static errno_t ski_con_fibril(void *arg) … … 135 178 136 179 while (true) { 137 while ( true) {180 while (!ski_con_disabled()) { 138 181 c = ski_con_getchar(); 139 182 if (c == 0) … … 246 289 uint8_t *dp = (uint8_t *) data; 247 290 248 for (i = 0; i < size; i++) 249 ski_con_putchar(con, dp[i]); 291 if (!ski_con_disabled()) { 292 for (i = 0; i < size; i++) { 293 ski_con_putchar(con, dp[i]); 294 } 295 } 250 296 251 297 *nwr = size; -
uspace/drv/char/ski-con/ski-con.h
rc742954 rc483fca 56 56 fibril_mutex_t buf_lock; 57 57 fibril_condvar_t buf_cv; 58 /** Memory area mapped to arbitrate with the kernel driver */ 59 void *mem_area; 58 60 } ski_con_t; 59 61 -
uspace/lib/c/generic/loader.c
rc742954 rc483fca 200 200 } 201 201 202 rc = loader_set_program(ldr, path, fd);202 rc = loader_set_program(ldr, abspath, fd); 203 203 vfs_put(fd); 204 204 return rc; -
uspace/lib/draw/font/bitmap_backend.c
rc742954 rc483fca 212 212 213 213 data->decoder->release(data->decoder_data); 214 free(data); 214 215 } 215 216 -
uspace/lib/drv/generic/driver.c
rc742954 rc483fca 145 145 } 146 146 147 /* Add one reference that will be dropped by driver_dev_remove() */148 dev_add_ref(dev);149 147 dev->handle = dev_handle; 150 148 dev->name = dev_name; … … 733 731 return NULL; 734 732 735 /* Add one reference that will be dropped by ddf_fun_destroy() */736 733 fun->dev = dev; 737 fun_add_ref(fun);734 dev_add_ref(fun->dev); 738 735 739 736 fun->bound = false; … … 743 740 fun->name = str_dup(name); 744 741 if (fun->name == NULL) { 745 delete_function(fun);742 fun_del_ref(fun); /* fun is destroyed */ 746 743 return NULL; 747 744 } -
uspace/lib/hound/src/protocol.c
rc742954 rc483fca 615 615 break; 616 616 default: 617 async_answer_0(&call, ENOTSUP); 617 /* 618 * In case we called async_get_call() after we had 619 * already received IPC_M_PHONE_HUNGUP deeper in the 620 * protocol handling, the capability handle will be 621 * invalid, so act carefully here. 622 */ 623 if (call.cap_handle != CAP_NIL) 624 async_answer_0(&call, ENOTSUP); 618 625 return; 619 626 } -
uspace/lib/posix/Makefile
rc742954 rc483fca 36 36 ../math/libmath.a \ 37 37 ../clui/libclui.a \ 38 ../gui/libgui.a \ 39 ../draw/libdraw.a \ 40 ../softrend/libsoftrend.a \ 41 ../hound/libhound.a \ 42 ../pcm/libpcm.a \ 38 43 $(LIBC_PREFIX)/libc.a \ 39 44 $(LIBC_PREFIX)/crt0.o \ … … 93 98 include $(USPACE_PREFIX)/Makefile.common 94 99 95 export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc 100 export: $(EXPORT_DIR)/config.mk $(EXPORT_DIR)/config.rc \ 101 $(EXPORT_DIR)/Makefile.common $(EXPORT_DIR)/Makefile.config 96 102 97 103 $(EXPORT_DIR)/config.mk: export-libs export-includes … … 111 117 sed 's:$$(HELENOS_EXPORT_ROOT):$$HELENOS_EXPORT_ROOT:g' < $< >$@ 112 118 119 $(EXPORT_DIR)/Makefile.common: ../../../Makefile.common 120 cp $< $@ 121 122 $(EXPORT_DIR)/Makefile.config: ../../../Makefile.config 123 cp $< $@ 124 113 125 export-libs: $(EXPORT_FILES) export-includes 114 126 mkdir -p $(EXPORT_DIR)/lib … … 124 136 cp -L ../clui/tinput.h $(EXPORT_DIR)/include.new/libclui 125 137 rm -rf $(EXPORT_DIR)/include 138 mkdir -p $(EXPORT_DIR)/include.new/libdraw 139 cp -r -L -t $(EXPORT_DIR)/include.new/libdraw ../draw/*.h 140 mkdir -p $(EXPORT_DIR)/include.new/libdraw/codec 141 cp -r -L -t $(EXPORT_DIR)/include.new/libdraw/codec ../draw/codec/*.h 142 mkdir -p $(EXPORT_DIR)/include.new/libgui 143 cp -L -t $(EXPORT_DIR)/include.new/libgui ../gui/*.h 144 mkdir -p $(EXPORT_DIR)/include.new/libhound 145 cp -r -L -t $(EXPORT_DIR)/include.new/libhound ../hound/include/* 146 mkdir -p $(EXPORT_DIR)/include.new/libpcm 147 cp -r -L -t $(EXPORT_DIR)/include.new/libpcm ../pcm/include/* 126 148 mv $(EXPORT_DIR)/include.new $(EXPORT_DIR)/include -
uspace/lib/usbhost/src/bus.c
rc742954 rc483fca 370 370 int bus_endpoint_add(device_t *device, const usb_endpoint_descriptors_t *desc, endpoint_t **out_ep) 371 371 { 372 int err ;372 int err = EINVAL; 373 373 assert(device); 374 374 … … 392 392 assert((ep->required_transfer_buffer_policy & ~ep->transfer_buffer_policy) == 0); 393 393 394 /* Bus reference */395 endpoint_add_ref(ep);396 397 394 const size_t idx = bus_endpoint_index(ep->endpoint, ep->direction); 398 395 if (idx >= ARRAY_SIZE(device->endpoints)) { … … 425 422 } 426 423 fibril_mutex_unlock(&device->guard); 427 if (err) { 428 endpoint_del_ref(ep); 429 return err; 430 } 424 if (err) 425 goto drop; 431 426 432 427 if (out_ep) { … … 438 433 return EOK; 439 434 drop: 440 /* Bus reference */441 435 endpoint_del_ref(ep); 442 return EINVAL;436 return err; 443 437 } 444 438 -
uspace/srv/devman/devtree.c
rc742954 rc483fca 144 144 } 145 145 146 fun_add_ref(fun); 147 insert_fun_node(tree, fun, str_dup(""), NULL); 146 if (!insert_fun_node(tree, fun, str_dup(""), NULL)) { 147 fun_del_ref(fun); /* fun is destroyed */ 148 fibril_rwlock_write_unlock(&tree->rwlock); 149 return false; 150 } 148 151 149 152 match_id_t *id = create_match_id(); … … 162 165 } 163 166 164 dev_add_ref(dev);165 167 insert_dev_node(tree, dev, fun); 166 168 -
uspace/srv/devman/driver.c
rc742954 rc483fca 462 462 list_remove(&dev->driver_devices); 463 463 fibril_mutex_unlock(&driver->driver_mutex); 464 /* Give an extra reference to driver_reassign_fibril */ 465 dev_add_ref(dev); 464 466 fid_t fid = fibril_create(driver_reassign_fibril, dev); 465 467 if (fid == 0) { 466 468 log_msg(LOG_DEFAULT, LVL_ERROR, 467 469 "Error creating fibril to assign driver."); 470 dev_del_ref(dev); 468 471 } 469 472 fibril_add_ready(fid); -
uspace/srv/devman/drv_conn.c
rc742954 rc483fca 284 284 285 285 fun_node_t *fun = create_fun_node(); 286 /* One reference for creation, one for us */ 287 fun_add_ref(fun); 286 /* 287 * Hold a temporary reference while we work with fun. The reference from 288 * create_fun_node() moves to the device tree. 289 */ 288 290 fun_add_ref(fun); 289 291 fun->ftype = ftype; … … 300 302 fun_busy_unlock(fun); 301 303 fun_del_ref(fun); 302 delete_fun_node(fun);304 fun_del_ref(fun); /* fun is destroyed */ 303 305 async_answer_0(call, ENOMEM); 304 306 return; -
uspace/srv/devman/fun.c
rc742954 rc483fca 317 317 318 318 insert_dev_node(&device_tree, dev, fun); 319 dev_add_ref(dev);320 319 } 321 320
Note:
See TracChangeset
for help on using the changeset viewer.