Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <548325F5.2050205@pennware.com>
Date: Sat, 06 Dec 2014 09:51:17 -0600
From: Richard Pennington <rich@...nware.com>
To: musl@...ts.openwall.com
Subject: Bare metal musl data points.

Hi,

A few examples of bare metal musl in action.

The simplest main(). No I/O. Just startup code and libc initialization:

dev main 367 % cat main.c
int main()
{
}
dev main 357 % size main
    text    data     bss     dec     hex filename
    5358    2080   33156   40594    9e92 main
dev main 368 % make run
Running main
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver

The simplest hello world example in C. Polled serial I/O:

dev hello 371 % cat main.c
#include <stdio.h>

int main()
{
     printf("hello world\n");
}
dev hello 361 % size hello
    text    data     bss     dec     hex filename
   26377    2228   34204   62809    f559 hello
dev hello 370 % make run
Running hello
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
hello world

Hello world again in C++. Yikes!

dev hellocpp 373 % cat main.cpp
#include <iostream>

int main()
{
   std::cout << "hello world" << std::endl;
}
dev hellocpp 363 % size hellocpp
    text    data     bss     dec     hex filename
1327518    2568   43600 1373686  14f5f6 hellocpp

calhost.localdomain hellocpp 374 % make run
Running hellocpp
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
hello world

A full ELK build with file system, virtual memory, etc.:

/* ELK running as a VM enabled OS.
  */
#include <sys/cdefs.h>
#include <stdio.h>

#include "command.h"

int main(int argc, char **argv)
{
   setprogname("elk");
   printf("%s started. Type \"help\" for a list of commands.\n", 
getprogname());
   // Enter the kernel command processor.
   do_commands(getprogname());
}
dev elk 377 % size elk
    text    data     bss     dec     hex filename
  223830    3456   54540  281826   44ce2 elk
dev elk 379 % make run
Running elk
enter 'control-A x' to exit QEMU
audio: Could not init `oss' audio driver
elk started. Type "help" for a list of commands.
elk % ps
Total pages: 7936 (32505856 bytes), Free pages: 7926 (32464896 bytes)
    PID    TID       TADR STATE        PRI NAME
      0      0 0x800452e8 RUNNING        1 kernel
      0      2 0x8004ae54 IDLE           3 [idle0]
elk % date
Thu Jan  1 00:00:31 1970
elk %
[~] main%

Fun stuff.

Rich

http://ellcc.org

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.