* Processes with growing heap support
@ 2002-11-01 1:42 Harry Kalogirou
0 siblings, 0 replies; 3+ messages in thread
From: Harry Kalogirou @ 2002-11-01 1:42 UTC (permalink / raw)
To: Linux-8086
[-- Attachment #1: Type: text/plain, Size: 1795 bytes --]
Ok it is done. I commited to the CVS code to support growing heap.
There are two new configuration variables you need :
CONFIG_EXEC_ELKS which enables support for the new executable format
CONFIG_ADVANCED_MM which enables some new features in the memory
manager, that you better have when using the new
executable format.
The kernel can still run the standar minix executables like it used to.
To create executables in the new format you will need the patched linker
ld86. The patch is attached to this e-mail. There are two patches for
the linker, one for the package dev-0.16.0 and one for dev-0.16.9. You
better go with dev-0.16.0 since the kernel Oops-es when compiler with
dev-0.16.9. The dev-0.16.9 patch is attached more for Robert to add it
easier to that version.
The patch makes the linker to create an executable with the "big" a.aout
header when given the -D<stack size> option. So giving -D0x1000 to the
linker creates an executable with the new header, that when loaded from
ELKS will have an 0x1000 bytes stack and a nice growing heap.
I started changing the elkscmd package to create this type of binaries
for the most used utilities. On my testbox having init, getty, login,
and ash in the new format gives me 302KB free memory when logged in!
----------------------------
# ps
1 0 root S 26676 init
8 5 root R 27264 ps
7 7 root S 27166 /bin/getty
6 6 root S 27166 /bin/getty
5 5 root S 27068 -/bin/ash
# meminfo
memory usage : 460KB total, 158KB used, 302KB free
swap usage : 0KB total, 0KB used, 0KB free
#
----------------------------
I also include a patch to make the dev-0.16.x complilable with the
ansified ELKS kernel headers.
Harry
[-- Attachment #2: dev86-0.16.0.diff --]
[-- Type: text/x-patch, Size: 2549 bytes --]
diff -urN linux-86-vanila/ld/globvar.h linux-86/ld/globvar.h
--- linux-86-vanila/ld/globvar.h Tue Oct 29 23:05:22 2002
+++ linux-86/ld/globvar.h Wed Oct 30 15:57:56 2002
@@ -13,6 +13,7 @@
/* K&R _explicitly_ says extern followed by public is OK */
extern char hexdigit[]; /* constant */
extern int headerless; /* Don't output header on exe */
+extern int bigheader;
extern bin_off_t text_base_value; /* Base address of text seg */
extern bin_off_t data_base_value; /* Base or alignment of data seg */
diff -urN linux-86-vanila/ld/ld.c linux-86/ld/ld.c
--- linux-86-vanila/ld/ld.c Tue Oct 29 23:05:22 2002
+++ linux-86/ld/ld.c Wed Oct 30 15:56:45 2002
@@ -19,6 +19,7 @@
PUBLIC bin_off_t data_base_value = 0; /* XXX */
PUBLIC bin_off_t heap_top_value = 0; /* XXX */
PUBLIC int headerless = 0;
+PUBLIC int bigheader = 0;
PUBLIC char hexdigit[] = "0123456789abcdef";
PRIVATE bool_t flag[128];
@@ -172,6 +173,7 @@
data_base_value = strtoul(arg+2, (char **)0, 16);
if (errno != 0)
use_error("invalid data address");
+ bigheader = 1;
break;
case 'H': /* heap top address */
if (arg[2] == 0 && ++argn >= argc)
diff -urN linux-86-vanila/ld/writex86.c linux-86/ld/writex86.c
--- linux-86-vanila/ld/writex86.c Tue Oct 29 23:05:22 2002
+++ linux-86/ld/writex86.c Wed Oct 30 15:57:25 2002
@@ -17,7 +17,7 @@
#define ELF_SYMS 0
#endif
-# define FILEHEADERLENGTH (headerless?0:A_MINHDR)
+# define FILEHEADERLENGTH (headerless?0:(bigheader?sizeof(struct exec):A_MINHDR))
/* part of header not counted in offsets */
#define DPSEG 2
@@ -620,8 +620,10 @@
offtocn((char *) &header.a_total, (bin_off_t) heap_top_value,
sizeof header.a_total);
- if( FILEHEADERLENGTH )
- writeout((char *) &header, FILEHEADERLENGTH);
+ if(bigheader)
+ offtocn((char *) &header.a_dbase, data_base_value, sizeof header.a_dbase);
+ if( header.a_hdrlen )
+ writeout((char *) &header, header.a_hdrlen);
}
PRIVATE void writenulls(count)
--- linux-86-vanila/libc/bcc/heap.c Fri Nov 1 02:43:13 2002
+++ linux-86/libc/bcc/heap.c Fri Nov 1 02:41:12 2002
@@ -44,9 +44,6 @@
js go_down
add ax,[brk_addr] ! Goin up!
jc Enomem
- sub bx,#511 ! Safety space 512 bytes
- cmp bx,ax ! Too close ?
- jb Enomem
sbrk_ok:
#if !defined(__MSDOS__) && !defined(__STANDALONE__)
@@ -121,6 +118,7 @@
#ifdef L___brk_addr
char * __brk_addr = 0; /* This holds the current return for sbrk(0) */
+
char *
__brk(val)
{
[-- Attachment #3: dev86-0.16.9.diff --]
[-- Type: text/x-patch, Size: 2561 bytes --]
diff -urN dev86-0.16.9-vanila/ld/globvar.h dev86-0.16.9/ld/globvar.h
--- dev86-0.16.9-vanila/ld/globvar.h Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/ld/globvar.h Fri Nov 1 02:23:53 2002
@@ -13,6 +13,7 @@
/* K&R _explicitly_ says extern followed by public is OK */
extern char hexdigit[]; /* constant */
extern int headerless; /* Don't output header on exe */
+extern int bigheader;
extern int cpm86; /* Generate CP/M-86 CMD header */
extern bin_off_t text_base_value; /* Base address of text seg */
diff -urN dev86-0.16.9-vanila/ld/ld.c dev86-0.16.9/ld/ld.c
--- dev86-0.16.9-vanila/ld/ld.c Fri Nov 1 02:20:11 2002
+++ dev86-0.16.9/ld/ld.c Fri Nov 1 02:24:46 2002
@@ -19,6 +19,7 @@
PUBLIC bin_off_t data_base_value = 0; /* XXX */
PUBLIC bin_off_t heap_top_value = 0; /* XXX */
PUBLIC int headerless = 0;
+PUBLIC int bigheader = 0;
PUBLIC int cpm86 = 0;
PUBLIC char hexdigit[] = "0123456789abcdef";
@@ -176,6 +177,7 @@
data_base_value = strtoul(arg+2, (char **)0, 16);
if (errno != 0)
use_error("invalid data address");
+ bigheader = 1;
break;
case 'H': /* heap top address */
if (arg[2] == 0 && ++argn >= argc)
diff -urN dev86-0.16.9-vanila/ld/writex86.c dev86-0.16.9/ld/writex86.c
--- dev86-0.16.9-vanila/ld/writex86.c Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/ld/writex86.c Fri Nov 1 02:27:50 2002
@@ -18,7 +18,7 @@
#define ELF_SYMS 0
#endif
-# define FILEHEADERLENGTH (headerless?0:(cpm86?CPM86_HEADERLEN:A_MINHDR))
+# define FILEHEADERLENGTH (headerless?0:(bigheader?sizeof(struct exec):(cpm86?CPM86_HEADERLEN:A_MINHDR)))
/* part of header not counted in offsets */
#define DPSEG 2
@@ -651,8 +651,10 @@
offtocn((char *) &header.a_total, (bin_off_t) heap_top_value,
sizeof header.a_total);
- if( FILEHEADERLENGTH )
- writeout((char *) &header, FILEHEADERLENGTH);
+ if(bigheader)
+ offtocn((char *) &header.a_dbase, data_base_value, sizeof header.a_dbase);
+ if( header.a_hdrlen )
+ writeout((char *) &header, header.a_hdrlen);
}
PRIVATE void writenulls(count)
diff -urN dev86-0.16.9-vanila/libc/bcc/heap.c dev86-0.16.9/libc/bcc/heap.c
--- dev86-0.16.9-vanila/libc/bcc/heap.c Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/libc/bcc/heap.c Fri Nov 1 02:34:02 2002
@@ -44,9 +44,6 @@
js go_down
add ax,[brk_addr] ! Goin up!
jc Enomem
- sub bx,#511 ! Safety space 512 bytes
- cmp bx,ax ! Too close ?
- jb Enomem
sbrk_ok:
#if !defined(__MSDOS__) && !defined(__STANDALONE__)
[-- Attachment #4: dev86-0.16.x-ansi.diff --]
[-- Type: text/x-patch, Size: 956 bytes --]
diff -urN linux-86/libbsd/Make.defs linux-86-vanila/libbsd/Make.defs
--- linux-86/libbsd/Make.defs Sun Feb 3 03:07:06 2002
+++ linux-86-vanila/libbsd/Make.defs Wed Oct 30 16:45:32 2002
@@ -27,8 +27,7 @@
# Normal standard 8086 code
ifeq ($(PLATFORM),i86-ELKS)
-ARCH=-0
-
+ARCH=-ansi -0
# 8086 elks code With "Caller saves" and "First arg in AX"
# ARCH=-0 -C-c -C-f
endif
@@ -60,5 +59,5 @@
endif # ifeq ($(PLATFORM),i386-Linux)
-CFLAGS=$(CCFLAGS) $(LIBDEFS)
+CFLAGS=$(ARCH) $(CCFLAGS) $(LIBDEFS)
LDFLAGS=$(LKFLAGS)
--- linux-86/libc/Make.defs Wed Oct 30 16:33:05 2002
+++ linux-86-vanila/libc/Make.defs Wed Oct 30 16:48:28 2002
@@ -4,7 +4,7 @@
ifeq ($(PLATFORM),i86-ELKS)
OBJ=crt0.o
LIBC=$(TOP)/libc.a
-ARCH=-Mn
+ARCH=-ansi -Mn
LIB_CPU=i86
LIB_OS=ELKS
endif
@@ -15,7 +15,7 @@
ifeq ($(PLATFORM),i86-FAST)
OBJ=crt0.o
LIBC=$(TOP)/libc_f.a
-ARCH=-Mf
+ARCH=-ansi -Mf
LIB_CPU=i86
LIB_OS=ELKS
endif
^ permalink raw reply [flat|nested] 3+ messages in thread* [Resend] Processes with growing heap support
@ 2003-07-16 22:45 Harry Kalogirou
2003-07-16 23:19 ` Riley Williams
0 siblings, 1 reply; 3+ messages in thread
From: Harry Kalogirou @ 2003-07-16 22:45 UTC (permalink / raw)
To: Linux-8086
[-- Attachment #1: Type: text/plain, Size: 1794 bytes --]
Ok it is done. I commited to the CVS code to support growing heap.
There are two new configuration variables you need :
CONFIG_EXEC_ELKS which enables support for the new executable format
CONFIG_ADVANCED_MM which enables some new features in the memory
manager, that you better have when using the new
executable format.
The kernel can still run the standar minix executables like it used to.
To create executables in the new format you will need the patched linker
ld86. The patch is attached to this e-mail. There are two patches for
the linker, one for the package dev-0.16.0 and one for dev-0.16.9. You
better go with dev-0.16.0 since the kernel Oops-es when compiler with
dev-0.16.9. The dev-0.16.9 patch is attached more for Robert to add it
easier to that version.
The patch makes the linker to create an executable with the "big" a.aout
header when given the -D<stack size> option. So giving -D0x1000 to the
linker creates an executable with the new header, that when loaded from
ELKS will have an 0x1000 bytes stack and a nice growing heap.
I started changing the elkscmd package to create this type of binaries
for the most used utilities. On my testbox having init, getty, login,
and ash in the new format gives me 302KB free memory when logged in!
----------------------------
# ps
1 0 root S 26676 init
8 5 root R 27264 ps
7 7 root S 27166 /bin/getty
6 6 root S 27166 /bin/getty
5 5 root S 27068 -/bin/ash
# meminfo
memory usage : 460KB total, 158KB used, 302KB free
swap usage : 0KB total, 0KB used, 0KB free
#
----------------------------
I also include a patch to make the dev-0.16.x complilable with the
ansified ELKS kernel headers.
Harry
[-- Attachment #2: dev86-0.16.0.diff --]
[-- Type: text/x-patch, Size: 2474 bytes --]
diff -urN linux-86-vanila/ld/globvar.h linux-86/ld/globvar.h
--- linux-86-vanila/ld/globvar.h Tue Oct 29 23:05:22 2002
+++ linux-86/ld/globvar.h Wed Oct 30 15:57:56 2002
@@ -13,6 +13,7 @@
/* K&R _explicitly_ says extern followed by public is OK */
extern char hexdigit[]; /* constant */
extern int headerless; /* Don't output header on exe */
+extern int bigheader;
extern bin_off_t text_base_value; /* Base address of text seg */
extern bin_off_t data_base_value; /* Base or alignment of data seg */
diff -urN linux-86-vanila/ld/ld.c linux-86/ld/ld.c
--- linux-86-vanila/ld/ld.c Tue Oct 29 23:05:22 2002
+++ linux-86/ld/ld.c Wed Oct 30 15:56:45 2002
@@ -19,6 +19,7 @@
PUBLIC bin_off_t data_base_value = 0; /* XXX */
PUBLIC bin_off_t heap_top_value = 0; /* XXX */
PUBLIC int headerless = 0;
+PUBLIC int bigheader = 0;
PUBLIC char hexdigit[] = "0123456789abcdef";
PRIVATE bool_t flag[128];
@@ -172,6 +173,7 @@
data_base_value = strtoul(arg+2, (char **)0, 16);
if (errno != 0)
use_error("invalid data address");
+ bigheader = 1;
break;
case 'H': /* heap top address */
if (arg[2] == 0 && ++argn >= argc)
diff -urN linux-86-vanila/ld/writex86.c linux-86/ld/writex86.c
--- linux-86-vanila/ld/writex86.c Tue Oct 29 23:05:22 2002
+++ linux-86/ld/writex86.c Wed Oct 30 15:57:25 2002
@@ -17,7 +17,7 @@
#define ELF_SYMS 0
#endif
-# define FILEHEADERLENGTH (headerless?0:A_MINHDR)
+# define FILEHEADERLENGTH (headerless?0:(bigheader?sizeof(struct exec):A_MINHDR))
/* part of header not counted in offsets */
#define DPSEG 2
@@ -620,8 +620,10 @@
offtocn((char *) &header.a_total, (bin_off_t) heap_top_value,
sizeof header.a_total);
- if( FILEHEADERLENGTH )
- writeout((char *) &header, FILEHEADERLENGTH);
+ if(bigheader)
+ offtocn((char *) &header.a_dbase, data_base_value, sizeof header.a_dbase);
+ if( header.a_hdrlen )
+ writeout((char *) &header, header.a_hdrlen);
}
PRIVATE void writenulls(count)
--- linux-86-vanila/libc/bcc/heap.c Fri Nov 1 02:43:13 2002
+++ linux-86/libc/bcc/heap.c Fri Nov 1 02:41:12 2002
@@ -44,9 +44,6 @@
js go_down
add ax,[brk_addr] ! Goin up!
jc Enomem
- sub bx,#511 ! Safety space 512 bytes
- cmp bx,ax ! Too close ?
- jb Enomem
sbrk_ok:
#if !defined(__MSDOS__) && !defined(__STANDALONE__)
@@ -121,6 +118,7 @@
#ifdef L___brk_addr
char * __brk_addr = 0; /* This holds the current return for sbrk(0) */
+
char *
__brk(val)
{
[-- Attachment #3: dev86-0.16.9.diff --]
[-- Type: text/x-patch, Size: 2493 bytes --]
diff -urN dev86-0.16.9-vanila/ld/globvar.h dev86-0.16.9/ld/globvar.h
--- dev86-0.16.9-vanila/ld/globvar.h Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/ld/globvar.h Fri Nov 1 02:23:53 2002
@@ -13,6 +13,7 @@
/* K&R _explicitly_ says extern followed by public is OK */
extern char hexdigit[]; /* constant */
extern int headerless; /* Don't output header on exe */
+extern int bigheader;
extern int cpm86; /* Generate CP/M-86 CMD header */
extern bin_off_t text_base_value; /* Base address of text seg */
diff -urN dev86-0.16.9-vanila/ld/ld.c dev86-0.16.9/ld/ld.c
--- dev86-0.16.9-vanila/ld/ld.c Fri Nov 1 02:20:11 2002
+++ dev86-0.16.9/ld/ld.c Fri Nov 1 02:24:46 2002
@@ -19,6 +19,7 @@
PUBLIC bin_off_t data_base_value = 0; /* XXX */
PUBLIC bin_off_t heap_top_value = 0; /* XXX */
PUBLIC int headerless = 0;
+PUBLIC int bigheader = 0;
PUBLIC int cpm86 = 0;
PUBLIC char hexdigit[] = "0123456789abcdef";
@@ -176,6 +177,7 @@
data_base_value = strtoul(arg+2, (char **)0, 16);
if (errno != 0)
use_error("invalid data address");
+ bigheader = 1;
break;
case 'H': /* heap top address */
if (arg[2] == 0 && ++argn >= argc)
diff -urN dev86-0.16.9-vanila/ld/writex86.c dev86-0.16.9/ld/writex86.c
--- dev86-0.16.9-vanila/ld/writex86.c Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/ld/writex86.c Fri Nov 1 02:27:50 2002
@@ -18,7 +18,7 @@
#define ELF_SYMS 0
#endif
-# define FILEHEADERLENGTH (headerless?0:(cpm86?CPM86_HEADERLEN:A_MINHDR))
+# define FILEHEADERLENGTH (headerless?0:(bigheader?sizeof(struct exec):(cpm86?CPM86_HEADERLEN:A_MINHDR)))
/* part of header not counted in offsets */
#define DPSEG 2
@@ -651,8 +651,10 @@
offtocn((char *) &header.a_total, (bin_off_t) heap_top_value,
sizeof header.a_total);
- if( FILEHEADERLENGTH )
- writeout((char *) &header, FILEHEADERLENGTH);
+ if(bigheader)
+ offtocn((char *) &header.a_dbase, data_base_value, sizeof header.a_dbase);
+ if( header.a_hdrlen )
+ writeout((char *) &header, header.a_hdrlen);
}
PRIVATE void writenulls(count)
diff -urN dev86-0.16.9-vanila/libc/bcc/heap.c dev86-0.16.9/libc/bcc/heap.c
--- dev86-0.16.9-vanila/libc/bcc/heap.c Fri Nov 1 02:20:12 2002
+++ dev86-0.16.9/libc/bcc/heap.c Fri Nov 1 02:34:02 2002
@@ -44,9 +44,6 @@
js go_down
add ax,[brk_addr] ! Goin up!
jc Enomem
- sub bx,#511 ! Safety space 512 bytes
- cmp bx,ax ! Too close ?
- jb Enomem
sbrk_ok:
#if !defined(__MSDOS__) && !defined(__STANDALONE__)
[-- Attachment #4: dev86-0.16.x-ansi.diff --]
[-- Type: text/x-patch, Size: 916 bytes --]
diff -urN linux-86/libbsd/Make.defs linux-86-vanila/libbsd/Make.defs
--- linux-86/libbsd/Make.defs Sun Feb 3 03:07:06 2002
+++ linux-86-vanila/libbsd/Make.defs Wed Oct 30 16:45:32 2002
@@ -27,8 +27,7 @@
# Normal standard 8086 code
ifeq ($(PLATFORM),i86-ELKS)
-ARCH=-0
-
+ARCH=-ansi -0
# 8086 elks code With "Caller saves" and "First arg in AX"
# ARCH=-0 -C-c -C-f
endif
@@ -60,5 +59,5 @@
endif # ifeq ($(PLATFORM),i386-Linux)
-CFLAGS=$(CCFLAGS) $(LIBDEFS)
+CFLAGS=$(ARCH) $(CCFLAGS) $(LIBDEFS)
LDFLAGS=$(LKFLAGS)
--- linux-86/libc/Make.defs Wed Oct 30 16:33:05 2002
+++ linux-86-vanila/libc/Make.defs Wed Oct 30 16:48:28 2002
@@ -4,7 +4,7 @@
ifeq ($(PLATFORM),i86-ELKS)
OBJ=crt0.o
LIBC=$(TOP)/libc.a
-ARCH=-Mn
+ARCH=-ansi -Mn
LIB_CPU=i86
LIB_OS=ELKS
endif
@@ -15,7 +15,7 @@
ifeq ($(PLATFORM),i86-FAST)
OBJ=crt0.o
LIBC=$(TOP)/libc_f.a
-ARCH=-Mf
+ARCH=-ansi -Mf
LIB_CPU=i86
LIB_OS=ELKS
endif
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Processes with growing heap support
2003-07-16 22:45 [Resend] " Harry Kalogirou
@ 2003-07-16 23:19 ` Riley Williams
2003-07-17 0:09 ` Harry Kalogirou
0 siblings, 1 reply; 3+ messages in thread
From: Riley Williams @ 2003-07-16 23:19 UTC (permalink / raw)
To: Harry Kalogirou, Linux-8086
Hi Harry.
> Ok it is done. I committed to the CVS code to support growing heap.
When did you add this code to the CVS ??? I've just sync'd to the CVS with
`cvs update` and no changes were applied.
Also, did you get my email re elks-0.1.3-pre1 ???
Best wishes from Riley.
---
* Nothing as pretty as a smile, nothing as ugly as a frown.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 14-Jul-2003
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Processes with growing heap support
2003-07-16 23:19 ` Riley Williams
@ 2003-07-17 0:09 ` Harry Kalogirou
0 siblings, 0 replies; 3+ messages in thread
From: Harry Kalogirou @ 2003-07-17 0:09 UTC (permalink / raw)
To: Riley Williams; +Cc: Linux-8086
> Hi Harry.
>
> > Ok it is done. I committed to the CVS code to support growing heap.
>
> When did you add this code to the CVS ??? I've just sync'd to the CVS with
> `cvs update` and no changes were applied.
>
> Also, did you get my email re elks-0.1.3-pre1 ???
>
This patches are not for ELKS CVS but for the linker.
This is a resend of an old message of mine, after a request by
Miquel.
I got your e-mail about the release but I got it late and had no time!
:(
--
Harry Kalogirou <harkal@gmx.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-07-17 0:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-01 1:42 Processes with growing heap support Harry Kalogirou
-- strict thread matches above, loose matches on Subject: below --
2003-07-16 22:45 [Resend] " Harry Kalogirou
2003-07-16 23:19 ` Riley Williams
2003-07-17 0:09 ` Harry Kalogirou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox