Skip to content
Snippets Groups Projects
Select Git revision
  • 3c701098674a7751d549ca6a62e3290d34cc802a
  • master default protected
  • replication_test
  • release-1.10 protected
  • dev protected
  • 556-usage-statistics
  • 553-semantic-recommendation-2
  • 553-semantic-recommendation
  • release-1.9 protected
  • 551-init-broker-service-permissions
  • 549-test-oai-pmh
  • 545-saving-multiple-times-breaks-pid-metadata
  • 499-standalone-compute-service-2
  • 539-load-tests
  • hotfix/helm-chart
  • luca_ba_new_interface
  • 534-bug-when-adding-access-to-user-that-is-not-registered-at-dashboard-service
  • release-1.8 protected
  • 533-integrate-semantic-recommendation
  • feature/openshift
  • 518-spark-doesn-t-map-the-headers-correct
  • v1.10.4 protected
  • v1.10.3 protected
  • v1.10.2 protected
  • v1.10.1 protected
  • v1.10.0-rc13 protected
  • v1.10.0-rc12 protected
  • v1.10.0-rc11 protected
  • v1.10.0-rc10 protected
  • v1.10.0-rc9 protected
  • v1.10.0-rc8 protected
  • v1.10.0-rc7 protected
  • v1.10.0-rc6 protected
  • v1.10.0-rc5 protected
  • v1.10.0-rc4 protected
  • v1.10.0-rc3 protected
  • v1.10.0-rc2 protected
  • v1.10.0rc1 protected
  • v1.10.0rc0 protected
  • v1.10.0 protected
  • v1.9.3 protected
41 results

mweise.pub

Blame
  • modules-image.c 1.76 KiB
    /**
     * linker references to embedded modules.image
     */
    
    #include <kernel/printk.h>
    #include <kernel/ar.h>
    #include <kernel/kmem.h>
    #include <kernel/string.h>
    #include <kernel/xentium.h>
    
    #define MSG "MODIMG: "
    
    
    extern unsigned char _binary_modules_image_start __attribute__((weak));
    extern unsigned char _binary_modules_image_end __attribute__((weak));
    extern unsigned char _binary_modules_image_size __attribute__((weak));
    
    struct archive mod_ar;
    
    
    void module_image_load_embedded(void)
    {
    	ar_load(&_binary_modules_image_start,
    		(unsigned int)&_binary_modules_image_size, &mod_ar);
    
    #if 0
    	ar_print_files(&mod_ar);
    	ar_print_symbols(&mod_ar);
    #endif
    }
    
    
    void *module_lookup_symbol_embedded(char *sym_name)
    {
    	return ar_find_symbol(&mod_ar, sym_name);
    }
    
    void *module_lookup_embedded(char *mod_name)
    {
    	return ar_find_file(&mod_ar, mod_name);
    }
    
    void *module_read_embedded(char *mod_name)
    {
    	unsigned int fsize;
    
    	void *ptr;
    
    	fsize = ar_read_file(&mod_ar, mod_name, NULL);
    
    	ptr = kmalloc(fsize);
    	if (!ptr)
    		return NULL;
    
    	if (!ar_read_file(&mod_ar, mod_name, ptr)) {
    		kfree(ptr);
    		return NULL;
    	}
    
    	return ptr;
    }
    
    
    /**
     * @brief try to load all xentium kernels found in the embedded image
     *
     * @note assumes all files with suffix ".xen" are a kernel
     */
    
    void module_load_xen_kernels(void)
    {
    	char *list;
    	char *fname;
    	void *file;
    
    
    	list = ar_get_file_list(&mod_ar);
    
    	if (!list)
    		return;
    
    
    	while (1) {
    		fname = strsep(&list, " ");
    		if (!fname)
    			break;
    
    		if (!strstr(fname, ".xen"))
    			continue;
    
    		pr_info(MSG "Loading Xentium kernel %s\n", fname);
    
    		file = module_read_embedded(fname);
    		if (!file)
    			pr_err(MSG "Failed to read file %s\n", fname);
    
    		if (xentium_kernel_add(file))
    			pr_err(MSG "Error adding Xentium kernel %s\n", fname);
    
    		kfree(file);
    
    	}
    
    	kfree(list);
    }