- add missing files
- update of the configure example git-svn-id: http://svn.lfbs.rwth-aachen.de/svn/scc/trunk/MetalSVM@98 315a16e6-25f9-4109-90ae-ca3045a26c18
This commit is contained in:
parent
9794d7a1bd
commit
27e1aee7ef
3 changed files with 118 additions and 0 deletions
|
@ -62,6 +62,8 @@ extern "C" {
|
||||||
#define HAVE_ARCH_MEMSET
|
#define HAVE_ARCH_MEMSET
|
||||||
#define HAVE_ARCH_MEMCPY
|
#define HAVE_ARCH_MEMCPY
|
||||||
#define HAVE_ARCH_STRLEN
|
#define HAVE_ARCH_STRLEN
|
||||||
|
#define HAVE_ARCH_STRCPY
|
||||||
|
#define HAVE_ARCH_STRNCPY
|
||||||
|
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
typedef long long int64_t;
|
typedef long long int64_t;
|
||||||
|
@ -71,6 +73,12 @@ typedef unsigned short uint16_t;
|
||||||
typedef short int16_t;
|
typedef short int16_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef char int8_t;
|
typedef char int8_t;
|
||||||
|
typedef unsigned short wchar_t;
|
||||||
|
|
||||||
|
#ifndef _WINT_T
|
||||||
|
#define _WINT_T
|
||||||
|
typedef unsigned int wint_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
35
include/stdarg.h
Normal file
35
include/stdarg.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 Stefan Lankes, Chair for Operating Systems,
|
||||||
|
* RWTH Aachen University
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* This file is part of MetalSVM.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ANSI_STDARG_H__
|
||||||
|
#define __ANSI_STDARG_H__
|
||||||
|
|
||||||
|
#include <metalsvm/stdarg.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define __VALIST va_list
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
75
libgloss/crt0.asm
Normal file
75
libgloss/crt0.asm
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
;
|
||||||
|
; Copyright 2010 Stefan Lankes, Chair for Operating Systems,
|
||||||
|
; RWTH Aachen University
|
||||||
|
;
|
||||||
|
; Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
; you may not use this file except in compliance with the License.
|
||||||
|
; You may obtain a copy of the License at
|
||||||
|
;
|
||||||
|
; http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
;
|
||||||
|
; Unless required by applicable law or agreed to in writing, software
|
||||||
|
; distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
; See the License for the specific language governing permissions and
|
||||||
|
; limitations under the License.
|
||||||
|
;
|
||||||
|
; This file is part of metalsvm.
|
||||||
|
|
||||||
|
[BITS 32]
|
||||||
|
SECTION .data
|
||||||
|
cmdline DB "cmdline", 0
|
||||||
|
argv DD 0, 0
|
||||||
|
|
||||||
|
SECTION .text
|
||||||
|
global _start
|
||||||
|
extern main
|
||||||
|
extern __do_global_dtors
|
||||||
|
extern __do_global_ctors
|
||||||
|
extern hardware_init_hook
|
||||||
|
extern software_init_hook
|
||||||
|
extern atexit
|
||||||
|
extern exit
|
||||||
|
_start:
|
||||||
|
; call init hooks, if any exists
|
||||||
|
lea eax, [hardware_init_hook]
|
||||||
|
cmp eax, 0
|
||||||
|
je L1
|
||||||
|
call eax
|
||||||
|
L1:
|
||||||
|
lea eax, [software_init_hook]
|
||||||
|
cmp eax, 0
|
||||||
|
je L2
|
||||||
|
call eax
|
||||||
|
L2:
|
||||||
|
; register a function to be called at normal process termination
|
||||||
|
push __do_global_dtors
|
||||||
|
call atexit
|
||||||
|
pop eax
|
||||||
|
|
||||||
|
; call init function
|
||||||
|
call __do_global_ctors
|
||||||
|
|
||||||
|
; build argc/argv pair and then push
|
||||||
|
; them onto the stack...
|
||||||
|
mov [argv+0], DWORD cmdline
|
||||||
|
mov eax, [esp+4]
|
||||||
|
mov [argv+4], eax
|
||||||
|
push argv
|
||||||
|
push 2
|
||||||
|
|
||||||
|
; call the user's function
|
||||||
|
call main
|
||||||
|
|
||||||
|
; remove argc/argv pair
|
||||||
|
add esp, 8
|
||||||
|
|
||||||
|
; call exit from the C library so atexit gets called, and the
|
||||||
|
; C++ destructors get run. This calls our exit routine below
|
||||||
|
; when it's done.
|
||||||
|
; call "exit"
|
||||||
|
push eax
|
||||||
|
call exit
|
||||||
|
|
||||||
|
; endless loop
|
||||||
|
jmp $
|
Loading…
Add table
Reference in a new issue