std::cin in Fiasco/L4Re (with 'make qemu')

Stark, Josef j.stark at tum.de
Sun Sep 21 00:21:14 CEST 2014


Hi,

>I'm not sure where you enter this.
>For me, the following works quite fine:
>
>#include <stdio.h>
>
>int main(void)
>{
>  printf("Press some key: ");
>  char c = getchar();
>  printf("\nYour input: %c (%d)\n", c, c);
>
>  printf("Enter a number: ");
>  int number;
>  scanf("%x", &number);
>  printf("Your number: %d\n", number);
>
>  return 0;
>} 


If I copy this code into the hello example, and change the Makefile accordingly:

PKGDIR		?= ../..
L4DIR		?= $(PKGDIR)/../..
TARGET		= hello
SRC_C		= main.c
REQUIRES_LIBS   = libc_be_file_stdin
include $(L4DIR)/mk/prog.mk


I can successfully run it IF moe runs hello directly
(without Ned and a config, as a "make qemu E=hello" does).

If, however, hello is run through a config file and therefore Ned,
as in hello-cfg, it doesn't work. Execution does not halt and outputs
invalid values:

MOE: Starting: rom/ned rom/hello.cfg
MOE: loading 'rom/ned'
Ned says: Hi World!
Ned: loading file: 'rom/hello.cfg'
hello   | Press some key: 
hello   | Your input: � (-1)
hello   | Enter a number: Your number: -2147450972


How to make it work? Pass a certain capability to hello?

Josef


More information about the l4-hackers mailing list