mit-pdos / biscuit Goto Github PK
View Code? Open in Web Editor NEWBiscuit research OS
License: BSD 3-Clause "New" or "Revised" License
Biscuit research OS
License: BSD 3-Clause "New" or "Revised" License
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.10.3 linux/amd64
N/A
go env
)?GOOS="linux"
GOARCH="amd64"
N/A
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
That I am able to run Go binaries in biscuit
N/A
Are there any support in biscuit to run user-space Go binaries? I see C++ and C (e.g. user/c/lsh.c
) but no Go. Where do I start?
Hi, I am trying to port some userland applications to biscuit. How did you compile and test redis and nginx?
Also, why is USERMIN so high? Why not something like 0x400000 which makes it closer to compatible with Linux static binaries?
Thank you for building this. I am also very interested in OSes made by go.
I've look around in it. It was fun.
But I don't find the exit command. Need a help.
I wonder how do we add interfaces or how do we modify biscuit to let it be able to connect to the internet. When I tried the command lnc to connect to my custom host outside QEMU, it has the message saying no route to host. After I dig into the kernel, I noticed that it only has 127.0.0.1 and a magic ip and gateway defined in src/ixgbe/ixgbe.go as follow:
// 18.26.5.49 (bhw)
me := Ip4_t(0x121a0531)
x.ip = me
bnet.Nic_insert(me, x)
netmask := Ip4_t(0xfffffe00)
// 18.26.5.1
gw := Ip4_t(0x121a0401)
I wonder if I am correct that this is the place where biscuit setup its network interface and how the ip and gateway is selected. In addition, how we should configure to make biscuit able to connect to hosts outside QEMU. Also, does biscuit provide ping and ICMP packet processing? Thanks.
Building with go version go1.6.2 linux/amd64
Yes
I am building go.img with docker (Linux 16.04) but running QEMU on macOS Mojave with MacBook Pro 15' 2017.
I run QEMU with
make qemu CPUS=1
While I was allocating memory through malloc with the following C program
int* ptr = (int*)malloc(sizeof(int) * (1 << (18 + 8))); // allocating memory of size 256MB
free(ptr);
and repeatedly free and reallocate with following C program
for (int j = 0; j < 5; ++j) {
for (int i = 4; i < 17; ++i) {
int* ptr = (int*)malloc(sizeof(int) * (1 << (i + 8)));
free(ptr);
printf("%d %d\n", j, i);
}
}
I expected to see no free error which means that I am able to allocate memory and free successfully.
For allocating large amount of memory say 256MB, it fails. However when biscuit boots, it is boot with showing that we still have around 500MB free memory.
As for the second issue, it seems that free is not working successfully therefore I am getting out of memory error (malloc returns nullptr) after I have malloced with accumulated memory of size also around 256MB (about 128MB in total for first iteration and almost 128MB for second iteration then failed at the last malloc)
Thanks!
biscuit/GNUmakefile has GOPATH ?= $(shell pwd)
which only sets GOPATH if it's not already set. If the user has GOPATH set to any value that doesn't include the current directory as an element, the build fails:
~/src/biscuit/biscuit$ rm -f mkfs; GOPATH=/whatever make qemu CPUS=2
GOPATH="/whatever" ../bin/go build src/mkfs/mkfs.go
src/mkfs/mkfs.go:8:8: cannot find package "fs" in any of:
/home/tv/src/biscuit/src/fs (from $GOROOT)
/whatever/src/fs (from $GOPATH)
src/mkfs/mkfs.go:9:8: cannot find package "ufs" in any of:
/home/tv/src/biscuit/src/ufs (from $GOROOT)
/whatever/src/ufs (from $GOPATH)
src/mkfs/mkfs.go:10:8: cannot find package "ustr" in any of:
/home/tv/src/biscuit/src/ustr (from $GOROOT)
/whatever/src/ustr (from $GOPATH)
GNUmakefile:119: recipe for target 'mkfs' failed
make: *** [mkfs] Error 1
Please answer these questions before submitting your issue. Thanks!
go version
)?go1.14.7 linux/amd64
Yes, I also tried go1.15, which has the same problem
go env
)?Ubuntu 16.04.7 LTS, Linux kernel 4.15.0-112-generic
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
make qemu CPUS=2
get into the Biscuit OS and be able to type "ls"
BiscuitOS
go version: go1.10.1
4763 MB of physical memory
CPUID: family: 6, model: 1a
sse3 true, ssse3 true, sse41 true, sse42 true, avx false
invariant TSC not supported
bmi1 false, bmi2 false
1GB pages not supported
No hardware performance monitoring
panic: 64bit addressess not supported
goroutine 1 [running]:
ahci.attach_ahci(0x8086, 0x2922, 0x2000)
/home/zym/src/biscuit/biscuit/src/ahci/ahci.go:94 +0x73a
pci.pci_attach(0x8086, 0x2922, 0x0, 0x4, 0x0)
/home/zym/src/biscuit/biscuit/src/pci/pci.go:221 +0xd2
pci.Pcibus_attach.func2(0x0, 0x4)
/home/zym/src/biscuit/biscuit/src/pci/pci.go:164 +0x9d
pci.Pcibus_attach()
/home/zym/src/biscuit/biscuit/src/pci/pci.go:179 +0x53
main.attach_devs(0x5a98e0)
/home/zym/src/biscuit/biscuit/src/kernel/main.go:952 +0x105
main.main()
/home/zym/src/biscuit/biscuit/src/kernel/main.go:1654 +0x1f7
exit with code 0000000000000002 .
halting
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.13.8 linux/amd64
yes
go env
)?GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jack/.cache/go-build"
GOENV="/home/jack/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jack/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/lib/go-1.13"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.13/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build706439729=/tmp/go-build -gno-record-gcc-switches"
following instructions of README.md mostly:
cd
into src and build golang toolkitcd
into biscuit, adjusted GOPATH, QOPTS and run make qemu CPUS=2
Here's detailed modifications:
diff --git a/biscuit/GNUmakefile b/biscuit/GNUmakefile
index bb4cae8898..15b53ace54 100644
--- a/biscuit/GNUmakefile
+++ b/biscuit/GNUmakefile
@@ -8,7 +8,7 @@ ASFLAGS := $(BASEFLAGS) -nostdlib -nostdinc -I$(TOP)
CFLAGS := $(BASEFLAGS) -ffreestanding -nostdlib -nostdinc -fno-builtin \
-mno-red-zone -fno-stack-protector
CXXFLAGS := $(BASEFLAGS) -ffreestanding -nostdlib -fno-builtin -mno-red-zone
-GOPATH ?= $(shell pwd)
+GOPATH := $(shell pwd)
# bootloader sources
ASMS := boot.S
CS := bootmain.c main.c chentry.c
@@ -85,7 +85,7 @@ SKELDEPS := $(shell find $(SKEL))
CPUS := $(shell echo $${CPUS:-1})
-QOPTS := -m 8G -smp cpus=$(CPUS) -cpu Nehalem
+QOPTS := -m 2G -smp cpus=$(CPUS) -cpu Nehalem
# for testing bhw2's configuration
#QOPTS := -m 8G -cpu Nehalem -smp sockets=2,cores=10,threads=2
kernel should boot without error
SeaBIOS (version 1.13.0-1ubuntu1)
iPXE (http://ipxe.org) 00:03.0 CA00 PCI2.10 PnP PMM+7FF8C9C0+7FECC9C0 CA00
Booting from Hard Disk...
LAPIC Mhz: 00000000000003E7
CPU Mhz: 0000000000000AF8
no random!
Reserved 65536 pages (256MB)
BiscuitOS
go version: go1.10.1
1685 MB of physical memory
CPUID: family: 6, model: 1a
sse3 true, ssse3 true, sse41 true, sse42 true, avx false
invariant TSC not supported
bmi1 false, bmi2 false
1GB pages not supported
No hardware performance monitoring
AHCI 8086 2922 (0:4:0), bara 0xfebb1000, MSI 57
ACPI CPUs 2, found 1 APs (0 hyperthreads) across 2 packages
Joining at most 4 CPUs split between packages (no hyperthreads) on 2 packages
cpu 0000000000000001 joined
done! 1 APs found (1 joined)
Package counts:
0: 1
1: 1
Using MEMORY FS
FS log length 1024, maxtrans 512
no FS recovery needed: head 82
start [bin/init []]
read too few elf bytes (program headers)
panic: exec failed -1
goroutine 1 [running]:
main.main.func2(0xc000512260, 0x8, 0x8, 0x0, 0x0, 0x0)
/home/jack/osdev/biscuit/biscuit/src/kernel/main.go:1688 +0x668
main.main()
/home/jack/osdev/biscuit/biscuit/src/kernel/main.go:1693 +0x38a
exit with code 0000000000000002 .
halting
The kernel throws #UD
(illegal instruction) error when syscall
is ran; can it be enabled in boot?
Please answer these questions before submitting your issue. Thanks!
go version
)?Building with go version go1.6.2 linux/amd64
Yes
go env
)?I am building go.img with docker (Linux 16.04) but running QEMU on macOS Mojave with MacBook Pro 15' 2017.
I run QEMU with
make qemu CPUS=1
While I was benchmarking the process creating overhead with the following C program
#include "litc.h"
#include <unistd.h>
double create_process_overhead(int times){
for (int i = 0; i < times; i++) {
int pid = fork();
if (pid == 0) exit(0);
wait(0);
}
return 0;
}
int main(void){
for (int i = 0; i < 104; ++i) {
create_process_overhead(500);
}
return 0;
}
I expected to see no outputs.
I saw outputs of "POOF" randomly. And as long as I lower the times like calling creating_process_overhead(100), I haven't seen any "POOF" so far.
The output only exists when performing forking or pthread_create with large amount of times say 500.
Is it output by Biscuit? But I don't see any possible "POOF" string in the biscuit repository.
Thanks!
It seems that biscuit has its own libc implementation and is able to run Redis as a user space program. But when I try to build redis with litc like this:
make CFLAGS="-fno-builtin -nostdinc -I/path/to/biscuit/biscuit/user/c/include -static" MALLOC=libc
It fails with the following errors:
anet.c: In function ‘anetV6Only’:
anet.c:420:35: error: ‘IPV6_V6ONLY’ undeclared (first use in this function)
if (setsockopt(s,IPPROTO_IPV6,IPV6_V6ONLY,&yes,sizeof(yes)) == -1) {
^~~~~~~~~~~
anet.c:420:35: note: each undeclared identifier is reported only once for each function it appears in
anet.c: In function ‘_anetTcpServer’:
anet.c:434:13: error: ‘hints’ undeclared (first use in this function); did you mean ‘uint’?
memset(&hints,0,sizeof(hints));
^~~~~
uint
anet.c:437:22: error: ‘AI_PASSIVE’ undeclared (first use in this function)
hints.ai_flags = AI_PASSIVE; /* No effect if bindaddr != NULL */
^~~~~~~~~~
anet.c:439:50: error: ‘servinfo’ undeclared (first use in this function); did you mean ‘sys_info’?
if ((rv = getaddrinfo(bindaddr,_port,&hints,&servinfo)) != 0) {
^~~~~~~~
sys_info
anet.c:443:10: error: ‘p’ undeclared (first use in this function)
for (p = servinfo; p != NULL; p = p->ai_next) {
I tried to fix some of these, but more compilation errors appear afterwards. Could you please provide instructions on building Redis?
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.16.6 linux/amd64
no
go env
)?x86-64 WSL2 Ubuntu
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.