Andrew Dennison | 1 Jun 05:09 2007
Picon

Task / driver loading

Kohsuke,

I am starting work on adding the capability to load elf images for
drivers and tasks from a task.

The way I'm planning to do this is to add elf file parsing to the
kernel, basically duplicating the elf loading capability present in
the bootloader.

I would then expose two syscalls, something like:

__syscall int task_load_elf(task_t task, char *img, u_long img_size,
void **stack)
- loads elf EXEC or REL file and allocate memory
- probably also does thread_create(), thread_load(), thread_resume()

__syscall int driver_load_elf(char *img, u_long img_size)
- loads elf REL file and allocate memory
- start driver

This means starting an application would be something like:

task_create(task_self(), VM_NONE, &task);
task_load_elf(task, elf_img, size);

Does this fit in with your ideas, or do you have some work you have
already done in this area?

Andrew

(Continue reading)

Kohsuke Ohtani | 1 Jun 19:27 2007
Picon
Picon

Re: Task / driver loading

Hi,

Andrew Dennison wrote:
> This means starting an application would be something like:
> 
> task_create(task_self(), VM_NONE, &task);
> task_load_elf(task, elf_img, size);
> 
> Does this fit in with your ideas, or do you have some work you have
> already done in this area?

I've already made it as an exec server.

I think that parsing file image should be done in a user mode program to 
keep a kernel simple. This is because there are some different file 
formats, and a kernel can not access any file systems.

However, we have to add some hooks to kernel mode code in order to load 
a driver module dynamically. Even in such case, I prefer to implement 
the file parser within user mode code, and only fix-up of symbols should 
be done in kernel mode code. It may be done via IOCTL of a static (boot) 
driver module.

An attached code is from exec server. I hope it helps you understand the 
Prex task loading mechanism.

- Kohsuke

---------------------------------------------------------------
/*
(Continue reading)

Andrew Dennison | 2 Jun 00:18 2007
Picon

Re: Task / driver loading

On 6/2/07, Kohsuke Ohtani <kohtani <at> users.sourceforge.net> wrote:
> Hi,
>
> Andrew Dennison wrote:
> > This means starting an application would be something like:
> >
> > task_create(task_self(), VM_NONE, &task);
> > task_load_elf(task, elf_img, size);
> >
> > Does this fit in with your ideas, or do you have some work you have
> > already done in this area?
>
> I've already made it as an exec server.
>
> I think that parsing file image should be done in a user mode program to
> keep a kernel simple. This is because there are some different file
> formats, and a kernel can not access any file systems.

The bit that was missing for me was that task_load() or an equivalent
was not exposed to user space. I now see that you are actually mapping
memory and populating the image from userspace in elf_load(). I saw
reference to an exec server in the makefiles but I wasn't sure if it
actually existed or not.

I am happy to work with this mechanism - I can achieve what I need in
either way and I thought you may want to keep these mechanisms in
userspace - hence the question. I'm more used to the Linux kernel
approach, but I'm happy to do things differently.

Would it be possible for you to either release a new version with the
(Continue reading)

Andrew Dennison | 6 Jun 00:52 2007
Picon

[PATCH 00/22] Description of following patches

Patches 01 - 13 are general tweaks / bugfixes

Patches 14 - 18 resolve driver symbols and remove old jump table
mechanism. Drivers can also depend on symbols exported by other
drivers.

Patches 19 - 22 Change the prex config mechanism to be based on
makefile style variables. This config change allows drivers to be
statically linked into the kernel or built as loadable modules
(original behaviour). It also eliminates dead code for unused
features, while only increasing the prexos image by a few bytes for
the full i386-pc platform.

config.h is autogenerated from conf/$(PREX_ARCH)-$(PREX_PLATFORM)

A simple script using sed (conf/convert.sh) is provided to convert an
existing conf/config-$(PREX_ARCH)-$(PREX_PLATFORM).h file to the new
format

With this change the prex build process now requires sed

Platform specific notes:

All these features have been used for a while on my embedded powerpc
platform and work well.

i386: changes are ported to i386 and compile tested, but I haven't run
prex i386

arm: changes are ported to arm but I haven't built an arm cross
(Continue reading)

Andrew Dennison | 6 Jun 01:15 2007
Picon

Re: [PATCH 00/22] Description of following patches

Kohsuke,

All the subsequent patches have been blocked by sourceforge, for example:

-------
Your mail to 'Prex-devel' with the subject

   [PATCH 01/22] typos in 0.4.3

Is being held until the list moderator can review it for approval.

The reason it is being held:

   Message has a suspicious header
------

Can you please determine what is suspicious about the headers this time?

The patches are inline plain text built and sent with a script. This
works fine for everything but the sourceforge email list...

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
andrewd.lists@gmail.com | 6 Jun 02:06 2007
Picon

[PATCH 01/22] typos in 0.4.3

typos in 0.4.3
---
 dev/power/cpufreq.c  |    2 +-
 sys/include/system.h |    2 +-
 user/bin/kmon/cmd.c  |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dev/power/cpufreq.c b/dev/power/cpufreq.c
index 7151bfa..8446113 100644
--- a/dev/power/cpufreq.c
+++ b/dev/power/cpufreq.c
 <at>  <at>  -55,7 +55,7  <at>  <at>  static int cpufreq_init(void);
  * Driver structure
  */
 struct driver cpufreq_drv __driver_entry = {
-	/* name */	"CPU Freqency Control",
+	/* name */	"CPU Frequency Control",
 	/* order */	3,		/* Must larger than pm driver */
 	/* init */	cpufreq_init,
 };
diff --git a/sys/include/system.h b/sys/include/system.h
index f697483..b6a3cd8 100755
--- a/sys/include/system.h
+++ b/sys/include/system.h
 <at>  <at>  -58,7 +58,7  <at>  <at>  struct info_kernel {
 #define KERNEL_INFO(ki) \
 { \
 	SYSNAME, \
-	"Unkown", \
+	"Unknown", \
(Continue reading)

Kohsuke Ohtani | 6 Jun 02:13 2007
Picon
Picon

Re: [PATCH 00/22] Description of following patches

Andrew Dennison wrote:
> Kohsuke,
> 
> All the subsequent patches have been blocked by sourceforge, for example:

Your patches may have the multipart content-type in the mail header. I 
don't know why they were filtered. I have changed the setting of this 
mailing-list not to check the mail header. And, you dont have to send 
your patches again.

- Kohsuke

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
andrewd.lists@gmail.com | 6 Jun 02:18 2007
Picon

[PATCH 02/22] undefined symbols are fatal

undefined symbols are fatal
---
 boot/common/elf.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/boot/common/elf.c b/boot/common/elf.c
index 8aa4b1c..b9abb71 100755
--- a/boot/common/elf.c
+++ b/boot/common/elf.c
 <at>  <at>  -122,8 +122,8  <at>  <at>  static int relocate_section_rela(Elf32_Sym *sym_table, Elf32_Rela *rela,
 			if (relocate_rela(rela, sym_val, target_sect) != 0)
 				return -1;
 		} else if (ELF32_ST_BIND(sym->st_info) != STB_WEAK) {
-			elf_dbg("Undefined symbol for rela[%x]\n", i);
-			return 0;
+			printk("Undefined symbol for rela[%x]\n", i);
+			return -1;
 		} else
 			elf_dbg("Undefined weak symbol for rela[%x]\n", i);
 		rela++;
--

-- 
1.5.0.3.GIT

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
andrewd.lists@gmail.com | 6 Jun 02:18 2007
Picon

[PATCH 03/22] more dependencies and intermediate elf file for binary output

more dependencies and intermediate elf file for binary output
---
 mk/Makefile.inc |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/mk/Makefile.inc b/mk/Makefile.inc
index 5d3aafb..19a44b8 100755
--- a/mk/Makefile.inc
+++ b/mk/Makefile.inc
 <at>  <at>  -151,7 +151,7  <at>  <at>  endif
 # Rules to compile kernel
 #
 ifeq ($(TYPE),KERNEL)
-$(TARGET): $(OBJS) $(LIBS)
+$(TARGET): $(OBJS) $(LIBS) $(LD_SCRIPT)
 	$(LD) $(LDFLAGS) -T $(LD_SCRIPT) -o $ <at>  $(OBJS) $(LIBS)
 	$(ASMGEN)
 ifdef SYMBOL
 <at>  <at>  -164,7 +164,7  <at>  <at>  endif
 # Rules to compile device driver
 #
 ifeq ($(TYPE),DRIVER)
-$(TARGET):  $(OBJS)
+$(TARGET):  $(OBJS) $(LD_SCRIPT)
 	$(LD) $(LDFLAGS) -T $(LD_SCRIPT) -o $ <at>  $(OBJS) $(LIBS)
 	$(ASMGEN)
 ifdef SYMBOL
 <at>  <at>  -177,9 +177,12  <at>  <at>  endif
 # Rules to compile binary file
 #
(Continue reading)

andrewd.lists@gmail.com | 6 Jun 02:18 2007
Picon

[PATCH 04/22] allow global platform specific flags

allow global platform specific flags
---
 mk/boot.mk |    1 +
 mk/dev.mk  |    1 +
 mk/sys.mk  |    1 +
 3 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/mk/boot.mk b/mk/boot.mk
index 1b3a017..b2fc818 100755
--- a/mk/boot.mk
+++ b/mk/boot.mk
 <at>  <at>  -10,4 +10,5  <at>  <at>  CFLAGS = $(INC_FLAGS) -nostdinc -fno-builtin
 CPPFLAGS = $(INC_FLAGS)
 LDFLAGS = -static -nostdlib

+-include $(PREX_SRC)/boot/arch/$(PREX_ARCH)/$(PREX_PLATFORM)/boot.mk
 include $(PREX_SRC)/mk/Makefile.inc
diff --git a/mk/dev.mk b/mk/dev.mk
index 6f94175..68ddc5b 100755
--- a/mk/dev.mk
+++ b/mk/dev.mk
 <at>  <at>  -14,4 +14,5  <at>  <at>  ifeq ($(KTRACE),1)
 CFLAGS += -finstrument-functions
 endif

+-include $(PREX_SRC)/dev/arch/$(PREX_ARCH)/$(PREX_PLATFORM)/dev.mk
 include $(PREX_SRC)/mk/Makefile.inc
diff --git a/mk/sys.mk b/mk/sys.mk
index 37c5fb4..fea91ac 100755
--- a/mk/sys.mk
(Continue reading)


Gmane