Mercurial > lcfOS
changeset 12:fcdae30b2782
Fixup of variable argument things
author | windel |
---|---|
date | Mon, 14 Nov 2011 21:31:27 +0100 |
parents | 607898120eb1 |
children | d07d4701a103 |
files | cos/Makefile cos/bochsrc.txt cos/include/kernel.h cos/include/stdarg.h cos/kernel/goto64.asm cos/kernel/snprintf.c |
diffstat | 6 files changed, 15 insertions(+), 53 deletions(-) [+] |
line wrap: on
line diff
--- a/cos/Makefile Sun Nov 13 23:24:10 2011 +0100 +++ b/cos/Makefile Mon Nov 14 21:31:27 2011 +0100 @@ -1,8 +1,8 @@ # vim: set noexpandtab: -all: lcfosc.elf +all: bootdisk.img Makefile -bootdisk.img: lcfosc.elf grub/menu.lst +bootdisk.img: lcfosc.elf grub/menu.lst Makefile objcopy -O binary lcfosc.elf lcfosc.bin cp grub/emptybootdisk.img bootdisk.img mcopy -D o -i bootdisk.img lcfosc.bin :: @@ -16,6 +16,7 @@ -nostdlib \ -nostartfiles \ -fno-builtin \ + -mcmodel=large \ -Iinclude OBJECTS = \ @@ -26,10 +27,10 @@ lcfosc.elf: $(CRT0) $(OBJECTS) linker.ld ld -T linker.ld -o lcfosc.elf $(CRT0) $(OBJECTS) -%.o : %.asm +%.o : %.asm Makefile nasm -f elf64 -o $@ $< -%.o : %.c +%.o : %.c Makefile gcc $(CFLAGS) -o $@ -c $< -Wall -Wextra -Werror clean:
--- a/cos/bochsrc.txt Sun Nov 13 23:24:10 2011 +0100 +++ b/cos/bochsrc.txt Mon Nov 14 21:31:27 2011 +0100 @@ -65,7 +65,7 @@ #display_library: win32, options="gui_debug" # use Win32 debugger gui #display_library: wx #display_library: x, options="hideIPS" # disable IPS output in status bar -#display_library: x, options="gui_debug" # use GTK debugger gui +display_library: x, options="gui_debug" # use GTK debugger gui #======================================================================= # ROMIMAGE: @@ -859,7 +859,7 @@ # Example: # magic_break: enabled=1 #======================================================================= -#magic_break: enabled=1 +magic_break: enabled=1 #======================================================================= # PORT_E9_HACK:
--- a/cos/include/kernel.h Sun Nov 13 23:24:10 2011 +0100 +++ b/cos/include/kernel.h Mon Nov 14 21:31:27 2011 +0100 @@ -50,6 +50,12 @@ void loadPageTable(void* tableAddress); void enablePaging(void); +// Variable argument list things: +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +typedef __builtin_va_list va_list; + struct multiboot_aout_symbol_table { uint32_t tabsize; uint32_t strsize, addr, reserved;
--- a/cos/include/stdarg.h Sun Nov 13 23:24:10 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -Copyright (C) 1988 Free Software Foundation - -This file is part of GNU CC. - -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY. No author or distributor -accepts responsibility to anyone for the consequences of using it -or for whether it serves any particular purpose or works at all, -unless he says so in writing. Refer to the GNU CC General Public -License for full details. - -Everyone is granted permission to copy, modify and redistribute -GNU CC, but only under the conditions described in the -GNU CC General Public License. A copy of this license is -supposed to have been given to you along with GNU CC so you -can know your rights and responsibilities. It should be in a -file named COPYING. Among other things, the copyright notice -and this notice must be preserved on all copies. -*/ - -#ifndef __stdarg_h -#define __stdarg_h - -typedef char *va_list; - -// In a 64 bits kernel we are using 64 bits pointers: -#define STACKITEM long - -/* Amount of space required in an argument list for an arg of type TYPE. - TYPE may alternatively be an expression whose type is used. */ - -#define __va_rounded_size(TYPE) \ - (((sizeof (TYPE) + sizeof (STACKITEM) - 1) / sizeof (STACKITEM)) * sizeof (STACKITEM)) - -#define va_start(AP, LASTARG) \ - (AP = ((char *) &(LASTARG) + __va_rounded_size(LASTARG))) - -#define va_end(AP) /* Nothing */ - -#define va_arg(AP, TYPE) (AP += __va_rounded_size (TYPE), \ - *((TYPE *) (AP - __va_rounded_size (TYPE)))) - -#endif /* __stdarg_h */
--- a/cos/kernel/goto64.asm Sun Nov 13 23:24:10 2011 +0100 +++ b/cos/kernel/goto64.asm Mon Nov 14 21:31:27 2011 +0100 @@ -145,7 +145,7 @@ stackEnd: einde: -XCHG BX, BX ; bochs breakpoint +# XCHG BX, BX ; bochs breakpoint # Call kernel: extern kmain
--- a/cos/kernel/snprintf.c Sun Nov 13 23:24:10 2011 +0100 +++ b/cos/kernel/snprintf.c Mon Nov 14 21:31:27 2011 +0100 @@ -3,7 +3,6 @@ */ #include "kernel.h" -#include "stdarg.h" #include "ctype.h" unsigned char _ctype[] = { @@ -86,7 +85,7 @@ break; case 'c': /* single character */ - *b++ = va_arg(pvar, char); + *b++ = 'x'; // TODO: va_arg(pvar, char); l--; break;