Changeset 204674e in mainline


Ignore:
Timestamp:
2006-01-15T16:49:10Z (19 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4be51c8
Parents:
81703f9
Message:

"Hello world" from user space :)

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/src/interrupt.c

    r81703f9 r204674e  
    2828
    2929#include <arch/interrupt.h>
     30#include <syscall/syscall.h>
    3031#include <print.h>
    3132#include <debug.h>
     
    111112}
    112113
    113 void syscall(int n, void *stack)
     114void syscall(int n, void *st)
    114115{
    115         printf("cpu%d: syscall\n", CPU->id);
    116         thread_usleep(1000);
     116        __native *stack = (__native *) st;
     117       
     118        if (stack[-2] < SYSCALL_END)
     119                syscall_table[stack[-2]](stack[-5], stack[-3], stack[-4]);
     120        else
     121                panic("Undefined syscall %d", stack[-2]);
    117122}
    118123
  • generic/include/syscall/syscall.h

    r81703f9 r204674e  
    3030#define __SYSCALL_H__
    3131
     32#include <typedefs.h>
     33
    3234typedef enum {
    3335        SYS_CTL = 0,
     
    3941
    4042extern int sys_ctl(void);
    41 extern int sys_io(void);
     43extern int sys_io(int fd, const void *buf, size_t count);
    4244
    4345extern syshandler_t syscall_table[SYSCALL_END];
  • generic/src/syscall/syscall.c

    r81703f9 r204674e  
    2727 */
    2828
    29 #include <arch/types.h>
    3029#include <syscall/syscall.h>
     30#include <print.h>
     31#include <putchar.h>
    3132
    3233int sys_ctl(void) {
     34        printf("SYS_CTL\n");
    3335        return 0;
    3436}
    3537
    36 int sys_io(void) {
     38int sys_io(int fd, const void * buf, size_t count) {
     39       
     40        // TODO: buf sanity checks and a lot of other stuff ...
     41
     42        size_t i;
     43       
     44        for (i = 0; i < count; i++)
     45                putchar(((char *) buf)[i]);
     46       
    3747        return 0;
    3848}
Note: See TracChangeset for help on using the changeset viewer.