RetroBSD

2.11BSD operating system for microcontrollers
It is currently Wed Jun 26, 2019 12:43 am

All times are UTC




Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: 4.4BSD-Lite2 on github
PostPosted: Wed Apr 23, 2014 6:06 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
I created a separate project on Github: https://github.com/sergev/4.4BSD-Lite2
It contains the sources of 4.4BSD operating system, untouched, exactly as distributed by CSRG in 1995. You can find the full story here: http://oreilly.com/catalog/opensources/book/kirkmck.html

We can use these sources and documentation as a reference material. Hopefully, someday we will port it to MZ.


Top
 Profile  
 
PostPosted: Wed Apr 23, 2014 7:39 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
The tapes were stored at Svalbard Global Seed Vault, weren't they? :D

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Sun May 25, 2014 12:02 pm 

Joined: Sat Nov 16, 2013 7:05 pm
Posts: 2
Hi, Does anyone know how much RAM and FLASH 4.4BSD-Lite2 would consume (guessing) ?.
What are the advantages above current RetroBSD ?.


Top
 Profile  
 
PostPosted: Sat Oct 18, 2014 9:24 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
PaulHolland wrote:
Hi, Does anyone know how much RAM and FLASH 4.4BSD-Lite2 would consume (guessing) ?.
What are the advantages above current RetroBSD ?.

With all the networking and filesystems enabled, including NFS client (but not server), the kernel takes about 500k of flash memory and 200k of RAM. On pic32mz, 300k of RAM remain available for user programs and networking buffers.

The advantages are (1) TCP/IP networking stack, (2) paged virtual memory, (3) increased max size of user programs, (4) significantly reduced swapping activity and task switch latency.


Top
 Profile  
 
PostPosted: Mon Oct 20, 2014 8:15 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
Quote:
..significantly reduced swapping activity

Why this?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Oct 20, 2014 8:40 am 
Contributor

Joined: Mon Apr 29, 2013 1:56 am
Posts: 196
Pito wrote:
Quote:
..significantly reduced swapping activity

Why this?


Because you no longer need to replace the entire process in physical RAM by another one when switching between the two compared to 2.11? You only need to swap when you run out of free memory pages and decide to write the dirty pages into the swap file and not when you need to reuse the same address range. You get individual address spaces for processes.


Top
 Profile  
 
PostPosted: Mon Oct 20, 2014 8:55 am 
Contributor
User avatar

Joined: Thu Nov 08, 2012 7:04 am
Posts: 2401
Location: Rapa Nui
So for example 2 jobs (2 processes) 120kB large each do fit into 300kB and do not need swapping into the swap?

_________________
Pukao Hats Cleaning Services Ltd.


Top
 Profile  
 
PostPosted: Mon Oct 20, 2014 4:30 pm 
Contributor

Joined: Mon Apr 29, 2013 1:56 am
Posts: 196
Pito wrote:
So for example 2 jobs (2 processes) 120kB large each do fit into 300kB and do not need swapping into the swap?


Unless they try to use more than the total amount of the available physical memory, there should be little or no swapping at all.


Top
 Profile  
 
PostPosted: Mon Oct 20, 2014 5:01 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Serge and all,

I am not that familiar with that BSD version....

Paged virtual memory? Does this mean that VMS style applications can be written with the mz processor? i.e.- applications are written as if they are alone running in a large virtual memory space.

Or said another way, the processor supports a virtual to physical memory address translation map?

Also, hopefully applications can 'lock' some of their RAM and program into physical memory? (for fast response).

I am not sure what the overhead of allowing processes to only use the necessary RAM is, but allowing more than one resident process is high on my list.

Did I say this clearly enough?? I hope so.

Wiz


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 1:24 pm 

Joined: Thu Oct 23, 2014 1:16 pm
Posts: 7
Hi

How is your port coming along? I see your Github repository is quite active. Is it running on a board yet?

--
Trygve


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 6:20 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Trygve,
trygvis wrote:
How is your port coming along? I see your Github repository is quite active. Is it running on a board yet?

Oh, no real board yet. The kernel is still far from complete. I'm almost done with creating a root filesystem image: everything compiled, ELF binaries converted to a.out etc. This weekend I expect to run the kernel on simulator with filesystem mounted, and see where it will break.

As you probably know, 4.4bsd-lite distribution comes with several pieces of kernel code missing: namely execve() call, resource maps, clists and block i/o routines. It's a known issue, extensively described by Bill Jolitz in his famous articles about 386bsd. So my next step is to put some effort in filling these gaps. Sources of early FreeBSD and NetBSD versions should help.

--Serge


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 6:41 pm 

Joined: Thu Oct 23, 2014 1:16 pm
Posts: 7
Ok, thanks for the update.

What do I need to do to compile and the run the kernel? Do you have any instructions on how to use OVPsim with your image? I'm on Linux.

--
Trygve


Top
 Profile  
 
PostPosted: Thu Oct 23, 2014 6:57 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Sure.
To build the kernel, follow these instructions: https://github.com/sergev/Tilden/wiki/Build

How to use OVPsim to simulate pic32: https://github.com/sergev/pic32sim/blob ... /README.md

The command to run the kernel on simulator:
Code:
$ pic32mz -s boot.hex vmunix.hex

Here boot.hex is a standard chipKIT WiFire bootloader, slightly modified to speed up the simulation.

File vmunix.hex is a result of kernel build process ($BSDSRC/sys/compile/WIFIRE.pic32/vmunix.hex).

Best wishes,
--Serge


Top
 Profile  
 
PostPosted: Sun Oct 26, 2014 3:28 pm 

Joined: Thu Oct 23, 2014 1:16 pm
Posts: 7
Hi

I've built an image for the pmax machine (from on your Tilden repository with some adjustments) and it's booting with the gxemul emulator. I didn't get a license for the OVPsim so I had to go another way for now.

I found a clist implementation and some bits for the vfs_bio stuff that is missing and gotten this far:

Code:
gxemul-0.6.0.1$ ./gxemul -e pmax /home/trygvis/dev/com.github/sergev/Tilden/sys/compile/GENERIC.pmax/vmunix -d s7:pmax_root.img 2>&1 | tee vmunix.log
GXemul 0.6.0.1    Copyright (C) 2003-2014  Anders Gavare
Read the source code and/or documentation for other Copyright messages.

Simple setup...
    net:
        simulated network: 10.0.0.0/8 (max outgoing: TCP=100, UDP=100)
        simulated gateway+nameserver: 10.0.0.254 (60:50:40:30:20:10)
        simulated nameserver uses real nameserver 192.168.1.1
        domain: vs.trygvis.io
    machine:
        memory: 24 MB
        cpu0: R2000 (I+D = 8+8 KB)
        machine: DEC PMAX 3100 (KN01) (16.67 MHz)
        bootstring(+bootarg): boot 3/rz1/vmunix -a
        diskimage: pmax_root.img
            SCSI DISK id 7, read/write, 29 MB (60003 sectors)
        loading /home/trygvis/dev/com.github/sergev/Tilden/sys/compile/GENERIC.pmax/vmunix
        cpu0: starting at 0x80030000 (gp=0x801abf70)

NOTE: This is a LEGACY emulation mode.

-------------------------------------------------------------------------------

Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 57 compiled 2014-10-25
    trygvis@birgitte:Tilden/sys/compile/GENERIC.pmax
real mem = 25165824
avail mem = 20156416
using 614 buffers containing 2514944 bytes of memory
cpu0 (MIPS R2000 revision 0.0)
fpu0 (MIPS R2010 revision 0.0)
data cache size 16K inst cache size 16K
dc0 at nexus0 csr 0xbc000000 priority 2
pm0 (color display)
bpf: le0 attached
le0 at nexus0 csr 0xb8000000 priority 1 ethernet address 10:20:30:40:50:60
sii0 at nexus0 csr 0xba000000
sii: RESET
sii_StartCmd: rz target 0 cmd 0x12 addr ffffeeb8 size 44 dma 1
sii_StartCmd: Couldn't select target 0 error 6
sii_CmdDone: rz target 0 cmd 12 err 6 resid 44
sii_StartCmd: rz target 1 cmd 0x12 addr ffffeeb8 size 44 dma 1
sii_StartCmd: Couldn't select target 1 error 6
sii_CmdDone: rz target 1 cmd 12 err 6 resid 44
sii_StartCmd: rz target 2 cmd 0x12 addr ffffeeb8 size 44 dma 1
sii_StartCmd: Couldn't select target 2 error 6
sii_CmdDone: rz target 2 cmd 12 err 6 resid 44
sii_StartCmd: rz target 3 cmd 0x12 addr ffffeeb8 size 44 dma 1
sii_StartCmd: Couldn't select target 3 error 6
sii_CmdDone: rz target 3 cmd 12 err 6 resid 44
sii_StartCmd: rz target 4 cmd 0x12 addr ffffeeb8 size 44 dma 1
sii_StartCmd: Couldn't select target 4 error 6
sii_CmdDone: rz target 4 cmd 12 err 6 resid 44
sii_StartCmd: tz target 5 cmd 0x12 addr ffffeec0 size 44 dma 1
sii_StartCmd: Couldn't select target 5 error 6
sii_CmdDone: tz target 5 cmd 12 err 6 resid 44
sii_StartCmd: tz target 6 cmd 0x12 addr ffffeec0 size 44 dma 1
sii_StartCmd: Couldn't select target 6 error 6
sii_CmdDone: tz target 6 cmd 12 err 6 resid 44
root device? rz1
bpf: sl0 attached
bpf: sl1 attached
bpf: sl2 attached
bpf: sl3 attached
bpf: lo0 attached
ufs_mountroot failed: 6
getblk:331: before
getblk:333: dp=0xc0417d10
ktlbmiss: PC 80030b5c RA 8013fd2c ADR ffffd200
SR 2008ec00 CR c SP 8002ffe0
panic: kernel stack overflow
8016239c+30 (801b7000,0,0,8002ffec) ra 8015a014 sz -104
80159fac+68 (801b7000,0,0,8002ffec) ra 80050ef0 sz -48
80050e64+8c (801b7000,0,0,8002ffec) ra 80031108 sz -32
80030aa8+660 (801b7000,0,0,8002ffec) ra 80031108 sz 0
stacktrace: loop!
syncing disks... done

dumping to dev 9, offset 8
dump device bad
[ warning: LOW reference: vaddr=0x00000062, exception TLBL, pc=0x80051918 <kprintf+0x400> ]


Right now it semes like there is some issue with accessing the SCSI system which might be an issue with gxemul for all I know. Will have to look into it a bit further.

It seems fairly easy to replace the clist and vfs_bio parts, but the exec might be a bigger job.

Did you get any further?

--
Trygve


Top
 Profile  
 
PostPosted: Sun Oct 26, 2014 8:17 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Trygve,

Wow, I wouldn't imagine it's possible to run pmax code. It's so old cpu design, it does not comply even with MIPS release 1 architecture. Single-page TLB entries, strange structure of Status and Cause registers, no ERET instruction etc.

Meanwhile, I've ported clists, block i/o and execve from NetBSD 1.0. See:
https://github.com/sergev/Tilden/commit ... 48cd9a44ae
https://github.com/sergev/Tilden/commit ... fa92862c6d
https://github.com/sergev/Tilden/commit ... 895d3491a8

The kernel still goes panic somewhere in ffs_mountroot. Probably something is wrong with sd driver.
Code:
Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 4 compiled 2014-10-26
    vak@kucha:Tilden/sys/compile/WIFIRE.pic32
cpu: PIC32MZ2048ECG100 rev A4, 200 MHz
oscillator: system PLL div 1:6 mult x50
real mem = 512 kbytes
avail mem = 336 kbytes
using 16 buffers containing 49152 bytes of memory
spi1 at pins sdi=F1/sdo=C1/sck=D1
spi2 at pins sdi=F0/sdo=D11/sck=G6
spi3 at pins sdi=B10/sdo=C4/sck=B14
spi4 at pins sdi=F5/sdo=G0/sck=D10
uart1 at pins rx=D14/tx=D15, interrupts 112/113/114
uart4 at pins rx=F2/tx=F8, interrupts 170/171/172, console
sd0 at port spi3, pin cs=C3
bpf: lo0 attached
sd0: type I, size 206848 kbytes, speed 12 Mbit/sec
sd0a: partition type b7, sector 2, size 102400 kbytes
sd0b: partition type b8, sector 204802, size 2048 kbytes
sd0c: partition type b7, sector 208898, size 102400 kbytes
ufs_mountroot failed: 22
panic: cannot mount root
syncing disks... done

dumping to dev 1, offset 205824
dump device bad


Top
 Profile  
 
PostPosted: Sun Oct 26, 2014 8:30 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
It makes little sense to use simulators other that OVPsim. It's the only one which does really match pic32 architecture, including shadow register sets, MCU extensions, microMIPS and DSP. QEMU might be a candidate, but it does not have shadow sets, and it's TLB accuracy is questionable (no real ASID support). I'm not sure about MCU extensions as well.


Top
 Profile  
 
PostPosted: Sun Oct 26, 2014 9:57 pm 

Joined: Thu Oct 23, 2014 1:16 pm
Posts: 7
That's probably true, but I was hoping to be able to at least get some of the code going. And I haven't heard anything from the OVPsim people about my license so I'm kinda stuck.

I got a bit further when I switched to another machine that has a different SCSI controller and uses a R3000 instead of R2000. Right now I'm got "rmfree: not implemented yet" and "panic: setrunqueue".


Top
 Profile  
 
PostPosted: Mon Oct 27, 2014 4:51 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hopefully Imperas will provide you a license, so we can use the same environment. Maybe later I will try to port pic32sim to QEMU engine. But for initial kernel bringup I prefer to use a reliable trusted tool.

Today I have fixed a couple of bugs in sd driver and tlb_update routine, and ported resource maps from NetBSD 1.0. Now the kernel is able to mount a root filesystem. I got this far:
Code:
sd0: type I, size 339968 kbytes, speed 12 Mbit/sec
sd0a: partition type b7, sector 2, size 204800 kbytes
sd0b: partition type b8, sector 409602, size 32768 kbytes
sd0c: partition type b7, sector 475138, size 102400 kbytes
WARNING: preposterous clock chip time -- CHECK AND RESET THE DATE!
panic: pmap_enter: kernel wired
syncing disks... done

dumping to dev 2, offset 338944
dump device bad

The panic happens inside pmap_enter() routine in file sys/mips/pic32/pmap.c - looks like something is wrong with PG_WIRED status of kernel pages. I had modified this place for dual page TLB entries, so it might be still buggy.


Top
 Profile  
 
PostPosted: Fri Oct 31, 2014 3:49 am 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Got some progress with 4.4bsd. Now the system is able to boot up to the shell prompt in single-user mode.

Code:
Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.

4.4BSD-Lite build 91 compiled 2014-10-30
    sergev@ubuntu-sergev:Tilden/sys/compile/WIFIRE.pic32
cpu: PIC32MZ2048ECG100 rev A4, 200 MHz
oscillator: system PLL div 1:6 mult x50
real mem = 512 kbytes
avail mem = 336 kbytes
using 16 buffers containing 49152 bytes of memory
spi1 at pins sdi=F1/sdo=C1/sck=D1
spi2 at pins sdi=F0/sdo=D11/sck=G6
spi3 at pins sdi=B10/sdo=C4/sck=B14
spi4 at pins sdi=F5/sdo=G0/sck=D10
uart1 at pins rx=D14/tx=D15, interrupts 112/113/114
uart4 at pins rx=F2/tx=F8, interrupts 170/171/172, console
sd0 at port spi3, pin cs=C3
bpf: lo0 attached
sd0: type I, size 339968 kbytes, speed 12 Mbit/sec
sd0a: partition type b7, sector 2, size 204800 kbytes
sd0b: partition type b8, sector 409602, size 32768 kbytes
sd0c: partition type b7, sector 475138, size 102400 kbytes
WARNING: preposterous clock chip time -- CHECK AND RESET THE DATE!
Enter pathname of shell or RETURN for sh:
erase ^H, kill ^U, intr ^C status ^T
Don't login as root, use the su command.
# ls
.cshrc          bin             root            u
.profile        dev             sbin            usr
COPYRIGHT       etc             tmp             var
# date
Thu Oct 30 19:02:37 PST 2014
# cal
    October 2014
 S  M Tu  W Th  F  S
          1  2  3  4
 5  6  7  8  9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

# _

The system is still highly unstable. Virtual memory part is a bit touchy. Nested interrupts don't yet work as expected. Anyway, now it become clear that 4.4bsd on pic32 is quite real.


Top
 Profile  
 
PostPosted: Sat Nov 01, 2014 4:41 pm 

Joined: Sat Nov 01, 2014 7:17 am
Posts: 1
There is a manual page that tells you all about it within the src/libvmf folder (vmf.0). There is also a user guide in nroff format (vmlib.ms) which you can view by passing it through nroff (nroff vmlib.ms >vmlib.txt), but the formatting doesn't come out right (I guess the format is ancient) so it's hard to read.

_________________
wasi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 26 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission