wisp-cvs Mailing List for Wisp interpreter (Page 21)
Status: Alpha
Brought to you by:
digg
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(30) |
Sep
(312) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(5) |
Feb
(131) |
Mar
(17) |
Apr
(184) |
May
(252) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
From: <pi...@us...> - 2003-02-22 21:22:12
|
Update of /cvsroot/wisp/wisp/users/pisi/winix/beast In directory sc8-pr-cvs1:/tmp/cvs-serv29356/beast Log Message: Directory /cvsroot/wisp/wisp/users/pisi/winix/beast added to the repository |
From: <di...@us...> - 2003-02-17 20:27:23
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv22412 Modified Files: elf.py makehello.py Log Message: first ELF32 executable with symbols (static linkage, no relocation) generated Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- elf.py 16 Feb 2003 10:48:17 -0000 1.11 +++ elf.py 17 Feb 2003 20:27:18 -0000 1.12 @@ -370,7 +370,7 @@ t.align(4) t.emit_string('\0' * 40) # the null entry for name in names: - t.emit_tetra_sum(['.shstr/strings/' + name]) + t.emit_tetra_sum(['.shstrtab/strings/' + name]) t.emit_tetra_sum([name + '/sh_type']) t.emit_tetra_sum([name + '/sh_flags']) t.emit_tetra_sum([name]) Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- makehello.py 17 Feb 2003 00:19:08 -0000 1.10 +++ makehello.py 17 Feb 2003 20:27:18 -0000 1.11 @@ -18,6 +18,8 @@ m.place_symbol(name) return m +sections = {} + code = Linkie('<') # ia32 code.place_symbol('_start') code.emit_byte(0xBA); code.emit_tetra(14) # mov edx, 14 @@ -29,9 +31,11 @@ code.emit_byte(0xB8); code.emit_tetra(1) # mov eax, 1 code.emit_byte(0xCD); code.emit_byte(0x80) # int 0x80 -data = Linkie('<') # ia32 -data.place_symbol('message') -data.emit_string('Hello, world!\n') +sections['.text'] = code; del code + +sections['.data'] = Linkie('<') # ia32 +sections['.data'].place_symbol('message') +sections['.data'].emit_string('Hello, world!\n') def infer_by_prefix (name, dict): for l in range(len(name), -1, -1): @@ -42,26 +46,32 @@ def guess_shtype (name): return infer_by_prefix(name, {'': SHT.PROGBITS, '.bss': SHT.NOBITS, + '.dynstr': SHT.STRTAB, '.note': SHT.NOTE, - '.shstr': SHT.STRTAB}) + '.shstrtab': SHT.STRTAB, + '.symstr': SHT.STRTAB, + '.symtab': SHT.SYMTAB, + }) def guess_ptype (name): return infer_by_prefix(name, {'': PT.LOAD, '.note': PT.NOTE}) def guess_flags (name): - return infer_by_prefix(name, {'': 'rw--', - '.bss': 'rw--', - '.comment': '----', - '.data': 'rw--', - '.debug': '----', - '.line': '----', - '.note': '----', - '.rodata': 'r---', - '.shstr': '---s', - '.text': 'r-x-'}) + return infer_by_prefix(name, {'': 'rw--', + '.bss': 'rw--', + '.comment': '----', + '.data': 'rw--', + '.debug': '----', + '.dynstr': 'a--s', + '.line': '----', + '.note': '----', + '.rodata': 'r---', + '.shstrtab': '---s', + '.symstr': 'a--s', + '.text': 'r-x-'}) def guess_shflags (name): flags = guess_flags(name) sh_flags = 0 - if 'r' in flags: sh_flags |= SHF.ALLOC + if 'r' in flags or 'a' in flags: sh_flags |= SHF.ALLOC if 'w' in flags: sh_flags |= SHF.ALLOC | SHF.WRITE if 'x' in flags: sh_flags |= SHF.ALLOC | SHF.EXECINSTR if 's' in flags: sh_flags |= SHF.STRINGS @@ -76,26 +86,39 @@ symbols = {} -shstr = Linkie('<') -shstr.emit_byte(0) -symbols['.shstr/strings/.text'] = shstr.filesz() -shstr.emit_string('.text\0') -symbols['.shstr/strings/.data'] = shstr.filesz() -shstr.emit_string('.data\0') -symbols['.shstr/strings/.shstr'] = shstr.filesz() -shstr.emit_string('.shstr\0') - hello = Linkie('<') memory_boundary = 0x8048000 # must be at page boundary hello.extend(make_ELF32_header('<')) symbols['elf/type'] = ET.EXEC symbols['elf/machine'] = EM.I386 symbols['elf/flags'] = 0 # no flags for ia386 -program_header_table = make_ELF32_phtable('<', ['.text', '.data']) + +shentnames = ['.text', '.data', '.symstr', '.symtab', '.shstrtab'] + +sections['.shstrtab'] = Linkie('<') +sections['.shstrtab'].emit_byte(0) + +sections['.symstr'] = Linkie('<') +sections['.symstr'].emit_byte(0) + +sections['.symtab'] = Linkie('<') +sections['.symtab'].align(4) +sections['.symtab'].emit_string('\0' * 16) + +phentnames = [] +for name in shentnames: + if guess_pflags(name) <> 0: + phentnames.append(name) + symbols['.shstrtab/strings/' + name] = sections['.shstrtab'].filesz() + sections['.shstrtab'].emit_string(name) + sections['.shstrtab'].emit_byte(0) + +program_header_table = make_ELF32_phtable('<', phentnames) symbols['elf/phoff'] = hello.extend(program_header_table) -symbols['elf/phnum'] = 2 +symbols['elf/phnum'] = len(phentnames) -for name, section in (('.text', code), ('.data', data), ('.shstr', shstr)): +for name in shentnames: + section = sections[name] p_flags = guess_pflags(name) alignment = section.get_alignment() symbols[name + '/sh_align'] = alignment @@ -136,19 +159,30 @@ if address <> None: for symbol, value in section.get_symbols(): symbols[symbol] = address + value - print '%s = %08x' % (symbol, address + value) for symbol, value in section.get_symbols(): hello.place_symbol(symbol, offset + value) # for dump to work nicely + sofs = sections['.symstr'].filesz() + symbols['.symstr/strings/' + symbol] = sofs + sections['.symstr'].emit_string(symbol) + sections['.symstr'].emit_byte(0) + sections['.symtab'].emit_tetra(sofs) + sections['.symtab'].emit_tetra_sum([name]) + sections['.symtab'].emit_tetra(0) + sections['.symtab'].emit_byte(STB.GLOBAL << 4 | STT.NOTYPE) + sections['.symtab'].emit_byte(0) + sections['.symtab'].emit_wyde(shentnames.index(name) + 1) + for loc, typ, arg in section.get_notes(): hello.notify_linker(offset + loc, typ, arg) memory_boundary += section.memsz() memory_boundary = (memory_boundary + 0xFFF) & ~0xFFF # create section header table -section_header_table = make_ELF32_shtable('<', ['.text', '.data', '.shstr']) +section_header_table = make_ELF32_shtable('<', shentnames) symbols['elf/shoff'] = hello.extend(section_header_table) -symbols['elf/shnum'] = 4 -symbols['elf/shstrndx'] = 3 +symbols['elf/shnum'] = len(shentnames) + 1 +symbols['elf/shstrndx'] = shentnames.index('.shstrtab') + 1 +symbols['.symtab/sh_link'] = shentnames.index('.symstr') + 1 hello.link(symbols) hello.dump() |
From: <di...@us...> - 2003-02-17 00:19:12
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv20270 Modified Files: makehello.py Log Message: dump after linking, not before Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- makehello.py 16 Feb 2003 10:48:17 -0000 1.9 +++ makehello.py 17 Feb 2003 00:19:08 -0000 1.10 @@ -149,8 +149,8 @@ symbols['elf/shoff'] = hello.extend(section_header_table) symbols['elf/shnum'] = 4 symbols['elf/shstrndx'] = 3 -hello.dump() hello.link(symbols) +hello.dump() f = open('hello', 'w') hello.get_file().tofile(f) |
From: <di...@us...> - 2003-02-16 10:48:20
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv15102 Modified Files: .cvsignore elf.py linkie.py makehello.py Log Message: first working ELF32 executable (static linkage, no symbols, no relocation) generated Index: .cvsignore =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .cvsignore 6 Feb 2003 20:11:39 -0000 1.2 +++ .cvsignore 16 Feb 2003 10:48:17 -0000 1.3 @@ -2,3 +2,4 @@ *.pyo Makefile Makefile.in +hello Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- elf.py 15 Feb 2003 22:17:16 -0000 1.10 +++ elf.py 16 Feb 2003 10:48:17 -0000 1.11 @@ -351,18 +351,19 @@ h.emit_wyde_sum(['elf/shstrndx']) return h -def make_ELF32_pheader (byte_order, name): - h = Linkie(byte_order) - h.align(4) - h.emit_tetra_sum([name + '/p_type']) - h.emit_tetra_sum([name + '/offset']) - h.emit_tetra_sum([name]) # p_vaddr - h.emit_tetra_sum([name]) # p_paddr - h.emit_tetra_sum([name + '/filesz']) - h.emit_tetra_sum([name + '/memsz']) - h.emit_tetra_sum([name + '/p_flags']) - h.emit_tetra_sum([name + '/alignment']) - return h +def make_ELF32_phtable (byte_order, names): + t = Linkie(byte_order) + t.align(4) + for name in names: + t.emit_tetra_sum([name + '/p_type']) + t.emit_tetra_sum([name + '/offset']) + t.emit_tetra_sum([name]) # p_vaddr + t.emit_tetra_sum([name]) # p_paddr + t.emit_tetra_sum([name + '/filesz']) + t.emit_tetra_sum([name + '/memsz']) + t.emit_tetra_sum([name + '/p_flags']) + t.emit_tetra_sum([name + '/p_align']) + return t def make_ELF32_shtable (byte_order, names): t = Linkie(byte_order) @@ -377,7 +378,7 @@ t.emit_tetra_sum([name + '/sh_size']) t.emit_tetra_sum([name + '/sh_link']) t.emit_tetra_sum([name + '/sh_info']) - t.emit_tetra_sum([name + '/alignment']) + t.emit_tetra_sum([name + '/sh_align']) t.emit_tetra_sum([name + '/sh_entsize']) return t Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- linkie.py 15 Feb 2003 22:17:16 -0000 1.10 +++ linkie.py 16 Feb 2003 10:48:17 -0000 1.11 @@ -1,6 +1,6 @@ #### linkie.py - a Python module for low-level linkable objects # -# Copyleft © 2002 by Andres Soolo (di...@us...) +# Copyleft © 2003 by Andres Soolo (di...@us...) # This file is licensed under the GNU GPL v2. If you # don't know what that means, please do read the GPL. # Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- makehello.py 15 Feb 2003 22:17:16 -0000 1.8 +++ makehello.py 16 Feb 2003 10:48:17 -0000 1.9 @@ -1,6 +1,6 @@ #### makehello.py - test linkie.py by creating a greeter # -# Copyleft © 2002 by Andres Soolo (di...@us...) +# Copyleft © 2003 by Andres Soolo (di...@us...) # This file is licensed under the GNU GPL v2. If you # don't know what that means, please do read the GPL. # @@ -91,34 +91,56 @@ symbols['elf/type'] = ET.EXEC symbols['elf/machine'] = EM.I386 symbols['elf/flags'] = 0 # no flags for ia386 -program_header_table = make_ELF32_pheader('<', '.text') + \ - make_ELF32_pheader('<', '.data') +program_header_table = make_ELF32_phtable('<', ['.text', '.data']) symbols['elf/phoff'] = hello.extend(program_header_table) symbols['elf/phnum'] = 2 -# process the segments + for name, section in (('.text', code), ('.data', data), ('.shstr', shstr)): + p_flags = guess_pflags(name) alignment = section.get_alignment() - symbols[name + '/alignment'] = alignment - hello.align(min(alignment, 0x1000)) + symbols[name + '/sh_align'] = alignment + + if p_flags <> 0: + symbols[name + '/p_align'] = 0x1000 + hello.align(min(alignment, 0x1000)) + else: + # No program header entry => not loaded + # thusly no larger alignment necessary. + hello.align(min(alignment, 4)) + + hello.place_symbol(name) offset = hello.filesz() - address = memory_boundary | (offset & 0xFFF) - # take into account alignments larger than a page - address = (address + alignment - 1) & ~(alignment - 1) - symbols[name] = address + + if p_flags <> 0: + address = memory_boundary | (offset & 0xFFF) + # take into account alignments larger than a page + address = (address + alignment - 1) & ~(alignment - 1) + symbols[name + '/p_flags'] = guess_pflags(name) + symbols[name + '/p_type'] = guess_ptype(name) + symbols[name] = address + else: + address = None + symbols[name] = 0 + symbols[name + '/offset'] = offset symbols[name + '/memsz'] = section.memsz() symbols[name + '/filesz'] = section.filesz() symbols[name + '/sh_size'] = section.filesz() symbols[name + '/sh_type'] = guess_shtype(name) symbols[name + '/sh_info'] = 0 + symbols[name + '/sh_link'] = SHN.UNDEF + symbols[name + '/sh_entsize'] = 0 symbols[name + '/sh_flags'] = guess_shflags(name) - symbols[name + '/p_flags'] = guess_pflags(name) - symbols[name + '/p_type'] = guess_ptype(name) - data = section.get_file() - hello.from_array(data) + + hello.from_array(section.get_file()) + if address <> None: + for symbol, value in section.get_symbols(): + symbols[symbol] = address + value + print '%s = %08x' % (symbol, address + value) for symbol, value in section.get_symbols(): - symbols[symbol] = address + value hello.place_symbol(symbol, offset + value) # for dump to work nicely + for loc, typ, arg in section.get_notes(): + hello.notify_linker(offset + loc, typ, arg) memory_boundary += section.memsz() memory_boundary = (memory_boundary + 0xFFF) & ~0xFFF @@ -127,5 +149,9 @@ symbols['elf/shoff'] = hello.extend(section_header_table) symbols['elf/shnum'] = 4 symbols['elf/shstrndx'] = 3 -hello.link(symbols) hello.dump() +hello.link(symbols) + +f = open('hello', 'w') +hello.get_file().tofile(f) +f.close() |
From: <di...@us...> - 2003-02-15 22:17:19
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv2245 Modified Files: elf.py linkie.py makehello.py Log Message: advanced makehello.py a bit Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- elf.py 12 Feb 2003 23:05:08 -0000 1.9 +++ elf.py 15 Feb 2003 22:17:16 -0000 1.10 @@ -364,20 +364,22 @@ h.emit_tetra_sum([name + '/alignment']) return h -def make_ELF32_sheader (byte_order, name): - h = Linkie(byte_order) - h.align(4) - h.emit_tetra_sum(['.shstr/strings/' + name]) - h.emit_tetra_sum([name + '/sh_type']) - h.emit_tetra_sum([name + '/sh_flags']) - h.emit_tetra_sum([name]) - h.emit_tetra_sum([name + '/offset']) - h.emit_tetra_sum([name + '/sh_size']) - h.emit_tetra_sum([name + '/sh_link']) - h.emit_tetra_sum([name + '/sh_info']) - h.emit_tetra_sum([name + '/alignment']) - h.emit_tetra_sum([name + '/sh_entsize']) - return h +def make_ELF32_shtable (byte_order, names): + t = Linkie(byte_order) + t.align(4) + t.emit_string('\0' * 40) # the null entry + for name in names: + t.emit_tetra_sum(['.shstr/strings/' + name]) + t.emit_tetra_sum([name + '/sh_type']) + t.emit_tetra_sum([name + '/sh_flags']) + t.emit_tetra_sum([name]) + t.emit_tetra_sum([name + '/offset']) + t.emit_tetra_sum([name + '/sh_size']) + t.emit_tetra_sum([name + '/sh_link']) + t.emit_tetra_sum([name + '/sh_info']) + t.emit_tetra_sum([name + '/alignment']) + t.emit_tetra_sum([name + '/sh_entsize']) + return t # Thoughts of generating ELF32 files # * In ELF parlance, linker notes are called relocations. Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- linkie.py 15 Feb 2003 15:42:52 -0000 1.9 +++ linkie.py 15 Feb 2003 22:17:16 -0000 1.10 @@ -58,6 +58,8 @@ Places the specified bytes to the byte collector.""" if this._skipped <> 0: raise "Events out of order", this this._binary.fromstring(s) + def from_array (this, a): + this._binary.extend(a) def add_byte (this, ofs, value): this._binary[ofs] = chr(ord(this._binary[ofs]) + value) @@ -282,6 +284,6 @@ if rnotes.has_key(offset): for typ, arg in rnotes[offset]: print ' ' * (14 + (offset & 15) * 3) + \ - "`'-" * abs(typ) + arg + "``-" * abs(typ) + arg start = stop row += 16 Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- makehello.py 15 Feb 2003 15:35:30 -0000 1.7 +++ makehello.py 15 Feb 2003 22:17:16 -0000 1.8 @@ -33,16 +33,99 @@ data.place_symbol('message') data.emit_string('Hello, world!\n') +def infer_by_prefix (name, dict): + for l in range(len(name), -1, -1): + prefix = name[:l] + try: return dict[prefix] + except: pass + return None +def guess_shtype (name): + return infer_by_prefix(name, {'': SHT.PROGBITS, + '.bss': SHT.NOBITS, + '.note': SHT.NOTE, + '.shstr': SHT.STRTAB}) +def guess_ptype (name): + return infer_by_prefix(name, {'': PT.LOAD, + '.note': PT.NOTE}) +def guess_flags (name): + return infer_by_prefix(name, {'': 'rw--', + '.bss': 'rw--', + '.comment': '----', + '.data': 'rw--', + '.debug': '----', + '.line': '----', + '.note': '----', + '.rodata': 'r---', + '.shstr': '---s', + '.text': 'r-x-'}) +def guess_shflags (name): + flags = guess_flags(name) + sh_flags = 0 + if 'r' in flags: sh_flags |= SHF.ALLOC + if 'w' in flags: sh_flags |= SHF.ALLOC | SHF.WRITE + if 'x' in flags: sh_flags |= SHF.ALLOC | SHF.EXECINSTR + if 's' in flags: sh_flags |= SHF.STRINGS + return sh_flags +def guess_pflags (name): + flags = guess_flags(name) + p_flags = 0 + if 'r' in flags: p_flags |= PF.R + if 'w' in flags: p_flags |= PF.W + if 'x' in flags: p_flags |= PF.X + return p_flags + +symbols = {} + +shstr = Linkie('<') +shstr.emit_byte(0) +symbols['.shstr/strings/.text'] = shstr.filesz() +shstr.emit_string('.text\0') +symbols['.shstr/strings/.data'] = shstr.filesz() +shstr.emit_string('.data\0') +symbols['.shstr/strings/.shstr'] = shstr.filesz() +shstr.emit_string('.shstr\0') + hello = Linkie('<') -memory_boundary = 0x8048000 +memory_boundary = 0x8048000 # must be at page boundary hello.extend(make_ELF32_header('<')) -symbols = {} symbols['elf/type'] = ET.EXEC symbols['elf/machine'] = EM.I386 symbols['elf/flags'] = 0 # no flags for ia386 -program_header_table = make_ELF32_pheader('<', '.text') +program_header_table = make_ELF32_pheader('<', '.text') + \ + make_ELF32_pheader('<', '.data') symbols['elf/phoff'] = hello.extend(program_header_table) -# process the text segment -symbols['.text/offset'] = hello.extend(code) +symbols['elf/phnum'] = 2 +# process the segments +for name, section in (('.text', code), ('.data', data), ('.shstr', shstr)): + alignment = section.get_alignment() + symbols[name + '/alignment'] = alignment + hello.align(min(alignment, 0x1000)) + offset = hello.filesz() + address = memory_boundary | (offset & 0xFFF) + # take into account alignments larger than a page + address = (address + alignment - 1) & ~(alignment - 1) + symbols[name] = address + symbols[name + '/offset'] = offset + symbols[name + '/memsz'] = section.memsz() + symbols[name + '/filesz'] = section.filesz() + symbols[name + '/sh_size'] = section.filesz() + symbols[name + '/sh_type'] = guess_shtype(name) + symbols[name + '/sh_info'] = 0 + symbols[name + '/sh_flags'] = guess_shflags(name) + symbols[name + '/p_flags'] = guess_pflags(name) + symbols[name + '/p_type'] = guess_ptype(name) + data = section.get_file() + hello.from_array(data) + for symbol, value in section.get_symbols(): + symbols[symbol] = address + value + hello.place_symbol(symbol, offset + value) # for dump to work nicely + memory_boundary += section.memsz() + memory_boundary = (memory_boundary + 0xFFF) & ~0xFFF + +# create section header table +section_header_table = make_ELF32_shtable('<', ['.text', '.data', '.shstr']) +symbols['elf/shoff'] = hello.extend(section_header_table) +symbols['elf/shnum'] = 4 +symbols['elf/shstrndx'] = 3 hello.link(symbols) hello.dump() |
From: <di...@us...> - 2003-02-15 15:42:56
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv12327 Modified Files: linkie.py Log Message: use `\' instead of ^^ in Linkie.dump output Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- linkie.py 15 Feb 2003 15:35:30 -0000 1.8 +++ linkie.py 15 Feb 2003 15:42:52 -0000 1.9 @@ -282,6 +282,6 @@ if rnotes.has_key(offset): for typ, arg in rnotes[offset]: print ' ' * (14 + (offset & 15) * 3) + \ - '^^-' * abs(typ) + arg + "`'-" * abs(typ) + arg start = stop row += 16 |
From: <di...@us...> - 2003-02-15 15:35:36
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv10008 Modified Files: linkie.py makehello.py Log Message: a new output format for Linkie.dump Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- linkie.py 15 Feb 2003 09:14:47 -0000 1.7 +++ linkie.py 15 Feb 2003 15:35:30 -0000 1.8 @@ -246,18 +246,42 @@ if rnotes.has_key(ofs): rnotes[ofs].append((typ, arg)) else: rnotes[ofs] = [(typ, arg)] else: othernotes.append((ofs, typ, arg)) - buf = []; bufstart = 0 - for i in range(this.memsz()): - if len(buf) >= 16 or rsymbols.has_key(i) or rnotes.has_key(i): - if buf: print ' 0x%08x:' % bufstart, ' '.join(buf) - buf = []; bufstart = i - if rsymbols.has_key(i): - for s in rsymbols[i]: print s + ':' - if rnotes.has_key(i): - for typ, ofs in rnotes[i]: - print '%r(%s)' % (typ, ofs) - if i < len(this._binary): - buf.append('%02x' % ord(this._binary[i])) - else: - buf.append('oo') - if buf: print ' 0x%08x:' % bufstart, ' '.join(buf) + row = 0 + while row < this.memsz(): + start = 0 + while start < 16: + stop = start + 1 + while stop < 16 and not rsymbols.has_key(row + stop): + stop += 1 + # labels + offset = row + start + if rsymbols.has_key(offset): + for s in rsymbols[offset]: + print s + ':', + print + # bits + hex = ''; ascii = '' + for column in range(16): + if start <= column < stop: + offset = row + column + if offset < this.filesz(): + byte = this._binary[offset] + hex += '%02x ' % ord(byte) + if byte < ' ' or byte > '~': byte = '.' + ascii += byte + elif offset < this.memsz(): + hex += 'oo '; ascii += ':' + else: + hex += ' '; ascii += ' ' + else: + hex += ' '; ascii += ' ' + print ' [%08x] ' % row, hex, ascii + # FIXME: this doesn't handle wraparound of improperly + # aligned relocations quite properly + for offset in range(row + stop - 1, row + start - 1, -1): + if rnotes.has_key(offset): + for typ, arg in rnotes[offset]: + print ' ' * (14 + (offset & 15) * 3) + \ + '^^-' * abs(typ) + arg + start = stop + row += 16 Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- makehello.py 15 Feb 2003 09:14:47 -0000 1.6 +++ makehello.py 15 Feb 2003 15:35:30 -0000 1.7 @@ -9,6 +9,10 @@ from linkie import Linkie from elf import * +def binround_down (x, unit): + return x & ~(unit - 1) +def binround_up (x, unit): + return (x | (unit - 1)) + 1 def make_marker (name): m = Linkie('<') m.place_symbol(name) @@ -29,25 +33,9 @@ data.place_symbol('message') data.emit_string('Hello, world!\n') -header = make_ELF32_header('<') - -pheader = make_ELF32_pheader('<', '.text') -sheader = make_ELF32_pheader('<', '.text') - -(header + make_marker('PHEADER') + pheader + code + data + - make_marker('SHEADER') + sheader).dump() - -def binround_down (x, unit): - return x & ~(unit - 1) - -def binround_up (x, unit): - return (x | (unit - 1)) + 1 - -print; print '=== hello ===' hello = Linkie('<') memory_boundary = 0x8048000 hello.extend(make_ELF32_header('<')) -hello.align(4) symbols = {} symbols['elf/type'] = ET.EXEC symbols['elf/machine'] = EM.I386 |
From: <di...@us...> - 2003-02-15 09:14:52
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv15814 Modified Files: linkie.py makehello.py Log Message: made Linkie.extend return the offset of linkage point Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- linkie.py 14 Feb 2003 13:50:55 -0000 1.6 +++ linkie.py 15 Feb 2003 09:14:47 -0000 1.7 @@ -197,6 +197,7 @@ that._linker_notes = this._linker_notes[:] return that def extend (this, that): + # Returns the offset of /that/ inside /this/ after extension. if this._unresolved_locals: raise 'Incomplete linkie', this if that._unresolved_locals: raise 'Incomplete linkie', that if that.filesz(): this.deskip() @@ -208,7 +209,7 @@ this._symbols.append((sym, val + delta)) for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + delta, typ, arg)) - return this + return delta def __add__ (this, that): this = this.copy() this.extend(that) Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- makehello.py 14 Feb 2003 13:50:56 -0000 1.5 +++ makehello.py 15 Feb 2003 09:14:47 -0000 1.6 @@ -37,14 +37,24 @@ (header + make_marker('PHEADER') + pheader + code + data + make_marker('SHEADER') + sheader).dump() +def binround_down (x, unit): + return x & ~(unit - 1) + +def binround_up (x, unit): + return (x | (unit - 1)) + 1 + print; print '=== hello ===' hello = Linkie('<') +memory_boundary = 0x8048000 hello.extend(make_ELF32_header('<')) hello.align(4) symbols = {} symbols['elf/type'] = ET.EXEC symbols['elf/machine'] = EM.I386 -symbols['elf/phoff'] = hello.place_symbol('elf/phoff') -hello.extend(make_ELF32_pheader('<', '.text')) +symbols['elf/flags'] = 0 # no flags for ia386 +program_header_table = make_ELF32_pheader('<', '.text') +symbols['elf/phoff'] = hello.extend(program_header_table) +# process the text segment +symbols['.text/offset'] = hello.extend(code) hello.link(symbols) hello.dump() |
From: <di...@us...> - 2003-02-14 13:51:03
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv3439 Modified Files: linkie.py makehello.py Log Message: wrote Linkie.link Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- linkie.py 9 Feb 2003 16:01:39 -0000 1.5 +++ linkie.py 14 Feb 2003 13:50:55 -0000 1.6 @@ -123,7 +123,9 @@ raise 'Duplicate label', label this._locals[label] = len(this._binary) + this._skipped # Resolve open references to that label, if any - for i in range(len(this._unresolved_locals) - 1, -1, -1): + i = len(this._unresolved_locals) + while i > 0: + i = i - 1 referee, type, data = this._unresolved_locals[i] if referee == label: if type == -1: @@ -136,13 +138,14 @@ raise "Can't happen: unknown local reference type", this del this._unresolved_locals[i] # close the entry def place_symbol (this, symbol, value = None): - """place_symbol(symbol, value = None) + """place_symbol(symbol, value = None) => value Places a globally visible symbol in the linkie. Does NOT check uniqueness. None signifies the current offset.""" if type(symbol) <> StringType: raise 'Not a string', symbol if value == None: value = len(this._binary) + this._skipped this._symbols.append((symbol, value)) + return value def align (this, boundary): """align(boundary) Ensures that the following byte's memory address is divisible by @@ -193,7 +196,6 @@ that._symbols = this._symbols[:] that._linker_notes = this._linker_notes[:] return that - def extend (this, that): if this._unresolved_locals: raise 'Incomplete linkie', this if that._unresolved_locals: raise 'Incomplete linkie', that @@ -207,11 +209,23 @@ for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + delta, typ, arg)) return this - def __add__ (this, that): this = this.copy() this.extend(that) return this + + def link (this, symbols): + i = len(this._linker_notes) + while i > 0: + i = i - 1 + offset, type, arg = this._linker_notes[i] + if symbols.has_key(arg): + if type == 1: this.add_byte(offset, symbols[arg]) + elif type == 2: this.add_wyde(offset, symbols[arg]) + elif type == 4: this.add_tetra(offset, symbols[arg]) + else: raise 'Invalid linker note type', (offset, type, arg) + del this._linker_notes[i] + return len(this._linker_notes) def dump (this): filesz = len(this._binary) Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- makehello.py 8 Feb 2003 20:21:37 -0000 1.4 +++ makehello.py 14 Feb 2003 13:50:56 -0000 1.5 @@ -36,3 +36,15 @@ (header + make_marker('PHEADER') + pheader + code + data + make_marker('SHEADER') + sheader).dump() + +print; print '=== hello ===' +hello = Linkie('<') +hello.extend(make_ELF32_header('<')) +hello.align(4) +symbols = {} +symbols['elf/type'] = ET.EXEC +symbols['elf/machine'] = EM.I386 +symbols['elf/phoff'] = hello.place_symbol('elf/phoff') +hello.extend(make_ELF32_pheader('<', '.text')) +hello.link(symbols) +hello.dump() |
From: <di...@us...> - 2003-02-12 23:05:14
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv4698 Modified Files: elf.py Log Message: added some thoughts on generating ELF32 files Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- elf.py 8 Feb 2003 20:21:37 -0000 1.8 +++ elf.py 12 Feb 2003 23:05:08 -0000 1.9 @@ -378,3 +378,13 @@ h.emit_tetra_sum([name + '/alignment']) h.emit_tetra_sum([name + '/sh_entsize']) return h + +# Thoughts of generating ELF32 files +# * In ELF parlance, linker notes are called relocations. +# We need to solve relocations only when generating an +# executable file. +# * ELF symbols are defined relative to their corresponding sections' +# origins. Basically, a symbol's value consists of two parts: +# reference to its section and its location inside the section. +# * We'll need some symbols to represent offsets in the generated +# file. It's probably best to treat them as ELF absolute symbols. |
From: <pi...@us...> - 2003-02-10 10:50:50
|
Update of /cvsroot/wisp/wisp/users/pisi In directory sc8-pr-cvs1:/tmp/cvs-serv25200 Modified Files: dialect.pisi.wim Log Message: introduced talk-to-process Index: dialect.pisi.wim =================================================================== RCS file: /cvsroot/wisp/wisp/users/pisi/dialect.pisi.wim,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- dialect.pisi.wim 9 Feb 2003 15:56:10 -0000 1.7 +++ dialect.pisi.wim 10 Feb 2003 10:50:46 -0000 1.8 @@ -41,3 +41,25 @@ pathlist)) (raise 'no-good-command-in-path commando)) ) + + +;;;; Talk-to-process +(define (talk-to-process proc masterproc) + (let* ((pipe-child (sys:pipe)) + (pipe-parent (sys:pipe)) + (child (sys:fork))) + (if (zero? child) + ;; child continues + (begin + (sys:dup2 (car pipe-parent) 0) (sys:close (cdr pipe-parent)) + (sys:dup2 (cdr pipe-child) 1) (sys:close (car pipe-child)) + (dedicated proc)) + ;; parent + (my saved-data (cons (sys:dup 0) (sys:dup 1)) + (sys:dup2 (car pipe-child) 0) (sys:close (cdr pipe-child)) + (sys:dup2 (cdr pipe-parent) 1) (sys:close (car pipe-parent)) + (masterproc) + (sys:dup2 (car saved-data) 0) + (sys:dup2 (cdr saved-data) 1) + )))) + |
From: <di...@us...> - 2003-02-09 16:43:04
|
Update of /cvsroot/wisp/wisp/modules In directory sc8-pr-cvs1:/tmp/cvs-serv15761 Modified Files: Makefile.am Log Message: install shall depend on install-am Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/modules/Makefile.am,v retrieving revision 1.58 retrieving revision 1.59 diff -u -d -r1.58 -r1.59 --- Makefile.am 30 Sep 2002 18:24:55 -0000 1.58 +++ Makefile.am 9 Feb 2003 16:43:01 -0000 1.59 @@ -48,7 +48,7 @@ %.frwim: %.wim $(FRER) $< -install: +install: install-am sleep 1 touch $(DESTDIR)$(frwimdir)/*.frwim |
From: <di...@us...> - 2003-02-09 16:01:44
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv29552 Modified Files: linkie.py Log Message: implemented Linkie.extend Index: linkie.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/linkie.py,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- linkie.py 6 Feb 2003 20:34:41 -0000 1.4 +++ linkie.py 9 Feb 2003 16:01:39 -0000 1.5 @@ -194,10 +194,9 @@ that._linker_notes = this._linker_notes[:] return that - def __add__ (this, that): + def extend (this, that): if this._unresolved_locals: raise 'Incomplete linkie', this if that._unresolved_locals: raise 'Incomplete linkie', that - this = this.copy() if that.filesz(): this.deskip() this.align(that._alignment) delta = this.memsz() @@ -207,6 +206,11 @@ this._symbols.append((sym, val + delta)) for ofs, typ, arg in that._linker_notes: this._linker_notes.append((ofs + delta, typ, arg)) + return this + + def __add__ (this, that): + this = this.copy() + this.extend(that) return this def dump (this): |
From: <pi...@us...> - 2003-02-09 15:56:19
|
Update of /cvsroot/wisp/wisp/users/pisi In directory sc8-pr-cvs1:/tmp/cvs-serv26919 Modified Files: dialect.pisi.wim Log Message: fork-error replaced with stating Index: dialect.pisi.wim =================================================================== RCS file: /cvsroot/wisp/wisp/users/pisi/dialect.pisi.wim,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- dialect.pisi.wim 9 Feb 2003 11:59:14 -0000 1.6 +++ dialect.pisi.wim 9 Feb 2003 15:56:10 -0000 1.7 @@ -19,20 +19,25 @@ (hide loop ,@body) (loop))) -;;; (unix-command "command with options" (pathref)) -(define (unix-command commando (*pathlist* (cond - ((env-ref "PATH") (split-by-char #\: (env-ref "PATH"))) - (else '())))) +;;; (executable? /filename/) + +;;; (unix-command "command with options" (pathref)) +(define (unix-command commando + (pathlist (cond + ((env-ref "PATH") => + (cut split-by-char #\: <>)) + (else '())))) (if (not (any (lambda (otsikoht) (try - (begin - (my cmdlist (string->word-list commando) - (call-process `(,(string-append otsikoht "/" (first cmdlist)) ,@(cdr cmdlist)))) - #t) + (my cmdlist (string->word-list commando) + (my pathplace "$,[otsikoht]/$,(first cmdlist)" + (case (file-type pathplace) + ((regular) (call-process `(,pathplace ,@(cdr cmdlist))) #t) + (else #f)))) (except () #f))) - *pathlist*)) - (raise 'no-command-in-path commando)) + pathlist)) + (raise 'no-good-command-in-path commando)) ) |
From: <di...@us...> - 2003-02-09 15:41:40
|
Update of /cvsroot/wisp/wisp/modules In directory sc8-pr-cvs1:/tmp/cvs-serv20722/modules Modified Files: unix.wim Log Message: added a FIXME tag to |call-process| Index: unix.wim =================================================================== RCS file: /cvsroot/wisp/wisp/modules/unix.wim,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- unix.wim 18 Sep 2002 21:16:38 -0000 1.44 +++ unix.wim 9 Feb 2003 15:41:38 -0000 1.45 @@ -31,6 +31,7 @@ (exit 0)) (else (raise 'invalid-dedication proc)))) +; FIXME: if |dedicated| fails, fork will be done already. (define (call-process proc options ...) (my signal-failure? #f (for-each |
From: <pi...@us...> - 2003-02-09 11:59:17
|
Update of /cvsroot/wisp/wisp/users/pisi In directory sc8-pr-cvs1:/tmp/cvs-serv22110 Modified Files: dialect.pisi.wim Log Message: honour PATH Index: dialect.pisi.wim =================================================================== RCS file: /cvsroot/wisp/wisp/users/pisi/dialect.pisi.wim,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dialect.pisi.wim 9 Feb 2003 11:41:31 -0000 1.5 +++ dialect.pisi.wim 9 Feb 2003 11:59:14 -0000 1.6 @@ -20,7 +20,10 @@ (loop))) ;;; (unix-command "command with options" (pathref)) -(define (unix-command commando (*pathlist* '("/usr/bin" "/bin" "/sbin" "/usr/sbin"))) +(define (unix-command commando (*pathlist* (cond + ((env-ref "PATH") (split-by-char #\: (env-ref "PATH"))) + (else '())))) + (if (not (any (lambda (otsikoht) (try |
From: <pi...@us...> - 2003-02-09 11:41:34
|
Update of /cvsroot/wisp/wisp/users/pisi In directory sc8-pr-cvs1:/tmp/cvs-serv13493 Modified Files: dialect.pisi.wim Log Message: introduced unix-command Index: dialect.pisi.wim =================================================================== RCS file: /cvsroot/wisp/wisp/users/pisi/dialect.pisi.wim,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- dialect.pisi.wim 6 Feb 2003 16:14:27 -0000 1.4 +++ dialect.pisi.wim 9 Feb 2003 11:41:31 -0000 1.5 @@ -6,12 +6,30 @@ ;; ;;;; @(#) $Id$ +(module dialect.pisi) (export - forever) + forever unix-command) + +(use lists strings unix) ;;; (forever ...) - do something forever. (defmacro (forever . body) `(let (loop) (hide loop ,@body) (loop))) + +;;; (unix-command "command with options" (pathref)) +(define (unix-command commando (*pathlist* '("/usr/bin" "/bin" "/sbin" "/usr/sbin"))) + (if (not (any + (lambda (otsikoht) + (try + (begin + (my cmdlist (string->word-list commando) + (call-process `(,(string-append otsikoht "/" (first cmdlist)) ,@(cdr cmdlist)))) + #t) + (except () + #f))) + *pathlist*)) + (raise 'no-command-in-path commando)) +) |
From: <di...@us...> - 2003-02-09 09:32:15
|
Update of /cvsroot/wisp/wisp/users In directory sc8-pr-cvs1:/tmp/cvs-serv31721 Modified Files: Makefile.am Log Message: 'make clean' shall 'rm -f *~' Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/users/Makefile.am,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Makefile.am 6 Feb 2003 20:11:39 -0000 1.2 +++ Makefile.am 9 Feb 2003 09:32:11 -0000 1.3 @@ -8,3 +8,6 @@ EXTRA_DIST = README README.users SUBDIRS = dig pisi + +clean: clean-am + -rm -f *~ |
From: <di...@us...> - 2003-02-09 09:31:17
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv30905 Modified Files: Makefile.am Log Message: 'make clean' shall 'rm -f *~' Index: Makefile.am =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/Makefile.am,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- Makefile.am 6 Feb 2003 21:30:46 -0000 1.4 +++ Makefile.am 9 Feb 2003 09:31:12 -0000 1.5 @@ -12,4 +12,4 @@ all: clean: clean-am - -rm -f *.pyc *.pyo + -rm -f *~ *.pyc *.pyo |
From: <di...@us...> - 2003-02-09 09:30:09
|
Update of /cvsroot/wisp/wisp In directory sc8-pr-cvs1:/tmp/cvs-serv29968 Modified Files: NEWS Log Message: announce |system-path-ref| Index: NEWS =================================================================== RCS file: /cvsroot/wisp/wisp/NEWS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- NEWS 6 Feb 2003 20:05:34 -0000 1.3 +++ NEWS 9 Feb 2003 09:30:03 -0000 1.4 @@ -7,3 +7,4 @@ Fixed: automatic location of gmp.h and gc.h Added: wrapper for socket(2) Added: users directory for sandbox games + Added: the |system-path-ref| accessor |
From: <pi...@us...> - 2003-02-09 00:31:55
|
Update of /cvsroot/wisp/wisp In directory sc8-pr-cvs1:/tmp/cvs-serv18989 Modified Files: .cvsignore Log Message: added depcomp Index: .cvsignore =================================================================== RCS file: /cvsroot/wisp/wisp/.cvsignore,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- .cvsignore 7 Feb 2003 09:08:48 -0000 1.14 +++ .cvsignore 9 Feb 2003 00:31:52 -0000 1.15 @@ -9,6 +9,7 @@ config.status configure configure.lineno +depcomp gmon.out install-sh missing |
From: <pi...@us...> - 2003-02-09 00:05:18
|
Update of /cvsroot/wisp/wisp/users/pisi/winix In directory sc8-pr-cvs1:/tmp/cvs-serv5248/winix Log Message: Directory /cvsroot/wisp/wisp/users/pisi/winix added to the repository |
From: <pi...@us...> - 2003-02-08 23:55:21
|
Update of /cvsroot/wisp/wisp/users/pisi/winix In directory sc8-pr-cvs1:/tmp/cvs-serv5882/winix Added Files: README.winix Log Message: initial import --- NEW FILE: README.winix --- Winix. !!! BIOHAZARD !!! Winix is experimental! The Beast can harm your computer! * What is Winix? Winix is my experimental project to bring Scheme (clean functional logic) and *nix (hierarchical filesystem, processes) closer together, and use best of two worlds. To be more exact, Winix is a hybrid of Wisp and Linux kernel. No support for other schemes or unix kernels is planned. * Why such a stupid name? I like it. Don't ask. Think on: Wisp, *nix, Minix. And of course Win(dows) and (os) IX. * What it does? The main objective is experimentig with Wisp on top of Linux kernel. I achive it by replacing the traditional init process - the parent of all other processes - with Wisp. There's no more init.d nor rc.local. To make practical of such Winix system, Winix sets up an environment that allows you to continue using your linux box like nothing had changed - except startup procedure. Winix makes use of a startup that follow make style dependencies (although not using make). See [RefDep1] for some additional thoughts on this topic. Each facility provides a moudele other modules can depend on - something like package managers do with packages. Winix tries to be FBC compatible, modular and tunable. * FBC FBC (Fcking Big Computer) is a word. Nothing else. Or... hell knows. Terms FBC and FBN relate closely to each other - connected FBC-s sontruct a FBN (You Know What I Mean). A FBC is a node of a network (graph), that can perform some logical operations (have a processor and ram), communicate with other FBCs (nodes) of the FBN (graph) using network links (edges of the graph). There are FBC-s with different tasks, but they all have the same basic modules: fbc.processor - the 'computing node'. This module deals with hardware, devices, /proc filesystem, time, random, sysctl configuration etc. fbc.network - initalizes networking (flushes iptables, brings up networking links) fbc.storage - a node must be able to store information. Either on local or remote filesystems. Note: there are slight problems with classifying instructions for pppoe connections (that require storage) or NFS root systems... After FBC is up and running, a host application is executed. For Winix it's... * SMN SMN is a set of selected functions a FBC may have in a certain FBN. Basically there are three of them at the moment: Server - a bare fbc with no fancy devices, only services. Client - a fbc with possibly some strange devices. smart client. compare to plan9's terminal [RefNet1] Workstation - mixture of both. NOTE: UGLY. At the moment there's only a client setup. A client at the moment can deal with: smn.client.in.kbms - mouse and keyboard smn.client.out.visual - xfree and xfs smn.client.out.audio - tunes audio using aumix Finally.. a bash script is executed that brings up windowmaker on my system. The system is tunable using windowmaker menu. You can: 1) turn the fbc node off (what means bring down the smn.client portion before turning the system off. 2) reset the fbc - turn off smn.client and fbc, then restart 3) softreset - turn off smn.client (basically all user software) and restart it 4) reload - reload 'winix firmware' without (?) terminating any user program. * How can i try it? Consult INSTALL.winix for manual installation instructions. Work is going on to put this beast on a bootable cdrom for easy transportation and installation. Consult README.beast for instructions for creating an ISO image of The Beast. Other booting methods (USB flash drives etc) is considered, but not worked on. For some thoughts read [RefBoot1] and [RefBoot2]. REFERENCES: [RefDep1] http://lnx-bbc.org/bbctools3.html - minit: a make based init. [RefBoot1] http://lnx-bbc.org/bbctools1.html - linux on a small cdrom. [RefBoot2] http://www.knopper.net/knoppix/index-en.html - a bootable linux cd [RefNet1] http://www.cs.bell-labs.com/sys/doc/9.html - plan9 and different specialized nodes of a network. * to be continued... @(#) $Id: README.winix,v 1.1 2003/02/08 23:55:16 pisi Exp $ |
From: <di...@us...> - 2003-02-08 20:21:41
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv24451 Modified Files: elf.py makehello.py Log Message: implemented make_ELF32_sheader Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- elf.py 8 Feb 2003 18:38:42 -0000 1.7 +++ elf.py 8 Feb 2003 20:21:37 -0000 1.8 @@ -346,7 +346,7 @@ h.emit_wyde(0x34) # e_ehsize h.emit_wyde(32) # e_phentsize h.emit_wyde_sum(['elf/phnum']) - h.emit_wyde_sum(['elf/shentsize']) + h.emit_wyde(40) # e_shentsize h.emit_wyde_sum(['elf/shnum']) h.emit_wyde_sum(['elf/shstrndx']) return h @@ -362,4 +362,19 @@ h.emit_tetra_sum([name + '/memsz']) h.emit_tetra_sum([name + '/p_flags']) h.emit_tetra_sum([name + '/alignment']) + return h + +def make_ELF32_sheader (byte_order, name): + h = Linkie(byte_order) + h.align(4) + h.emit_tetra_sum(['.shstr/strings/' + name]) + h.emit_tetra_sum([name + '/sh_type']) + h.emit_tetra_sum([name + '/sh_flags']) + h.emit_tetra_sum([name]) + h.emit_tetra_sum([name + '/offset']) + h.emit_tetra_sum([name + '/sh_size']) + h.emit_tetra_sum([name + '/sh_link']) + h.emit_tetra_sum([name + '/sh_info']) + h.emit_tetra_sum([name + '/alignment']) + h.emit_tetra_sum([name + '/sh_entsize']) return h Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- makehello.py 8 Feb 2003 18:38:42 -0000 1.3 +++ makehello.py 8 Feb 2003 20:21:37 -0000 1.4 @@ -9,6 +9,11 @@ from linkie import Linkie from elf import * +def make_marker (name): + m = Linkie('<') + m.place_symbol(name) + return m + code = Linkie('<') # ia32 code.place_symbol('_start') code.emit_byte(0xBA); code.emit_tetra(14) # mov edx, 14 @@ -27,11 +32,7 @@ header = make_ELF32_header('<') pheader = make_ELF32_pheader('<', '.text') +sheader = make_ELF32_pheader('<', '.text') -header.dump() -print -code.dump() -print -data.dump() -print -(header + pheader + code + data).dump() +(header + make_marker('PHEADER') + pheader + code + data + + make_marker('SHEADER') + sheader).dump() |
From: <di...@us...> - 2003-02-08 18:38:46
|
Update of /cvsroot/wisp/wisp/users/dig In directory sc8-pr-cvs1:/tmp/cvs-serv18683 Modified Files: elf.py makehello.py Log Message: implemented make_ELF32_pheader Index: elf.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/elf.py,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- elf.py 6 Feb 2003 21:58:59 -0000 1.6 +++ elf.py 8 Feb 2003 18:38:42 -0000 1.7 @@ -344,9 +344,22 @@ h.emit_tetra_sum(['elf/shoff']) h.emit_tetra_sum(['elf/flags']) h.emit_wyde(0x34) # e_ehsize - h.emit_wyde_sum(['elf/phentsize']) + h.emit_wyde(32) # e_phentsize h.emit_wyde_sum(['elf/phnum']) h.emit_wyde_sum(['elf/shentsize']) h.emit_wyde_sum(['elf/shnum']) h.emit_wyde_sum(['elf/shstrndx']) + return h + +def make_ELF32_pheader (byte_order, name): + h = Linkie(byte_order) + h.align(4) + h.emit_tetra_sum([name + '/p_type']) + h.emit_tetra_sum([name + '/offset']) + h.emit_tetra_sum([name]) # p_vaddr + h.emit_tetra_sum([name]) # p_paddr + h.emit_tetra_sum([name + '/filesz']) + h.emit_tetra_sum([name + '/memsz']) + h.emit_tetra_sum([name + '/p_flags']) + h.emit_tetra_sum([name + '/alignment']) return h Index: makehello.py =================================================================== RCS file: /cvsroot/wisp/wisp/users/dig/makehello.py,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- makehello.py 6 Feb 2003 21:28:21 -0000 1.2 +++ makehello.py 8 Feb 2003 18:38:42 -0000 1.3 @@ -7,7 +7,7 @@ #### @(#) $Id$ from linkie import Linkie -from elf import make_ELF32_header +from elf import * code = Linkie('<') # ia32 code.place_symbol('_start') @@ -26,10 +26,12 @@ header = make_ELF32_header('<') +pheader = make_ELF32_pheader('<', '.text') + header.dump() print code.dump() print data.dump() print -(header + code + data).dump() +(header + pheader + code + data).dump() |