mirror of
https://github.com/FDOS/kernel.git
synced 2025-07-27 07:44:09 +02:00
allow printf to work correctly when SS!=DS
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1153 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d493dd629f
commit
9c7fd183f4
@ -131,7 +131,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DEBUG_NEED_PRINTF
|
#ifdef DEBUG_NEED_PRINTF
|
||||||
VOID VA_CDECL printf(const char * fmt, ...);
|
VOID VA_CDECL printf(const char FAR * fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __DEBUG_H */
|
#endif /* __DEBUG_H */
|
||||||
|
@ -191,6 +191,8 @@ VOID ASMCFUNC int21_service(iregs far * r);
|
|||||||
VOID ASMCFUNC FAR int0_handler(void);
|
VOID ASMCFUNC FAR int0_handler(void);
|
||||||
VOID ASMCFUNC FAR int6_handler(void);
|
VOID ASMCFUNC FAR int6_handler(void);
|
||||||
VOID ASMCFUNC FAR empty_handler(void);
|
VOID ASMCFUNC FAR empty_handler(void);
|
||||||
|
VOID ASMCFUNC FAR int13_handler(void);
|
||||||
|
/* VOID ASMCFUNC FAR int19_handler(void); */
|
||||||
VOID ASMCFUNC FAR int20_handler(void);
|
VOID ASMCFUNC FAR int20_handler(void);
|
||||||
VOID ASMCFUNC FAR int21_handler(void);
|
VOID ASMCFUNC FAR int21_handler(void);
|
||||||
VOID ASMCFUNC FAR int22_handler(void);
|
VOID ASMCFUNC FAR int22_handler(void);
|
||||||
@ -221,8 +223,8 @@ BOOL init_device(struct dhdr FAR *, PCStr cmdLine, int mode, VFP *top);
|
|||||||
|
|
||||||
/* prf.c */
|
/* prf.c */
|
||||||
|
|
||||||
VOID VA_CDECL init_printf(const char * fmt, ...);
|
VOID VA_CDECL init_printf(const char FAR * fmt, ...);
|
||||||
VOID VA_CDECL init_sprintf(char * buff, const char * fmt, ...);
|
VOID VA_CDECL init_sprintf(char FAR * buff, const char FAR * fmt, ...);
|
||||||
|
|
||||||
/* procsupt.asm */
|
/* procsupt.asm */
|
||||||
VOID ASMCFUNC FAR got_cbreak(void);
|
VOID ASMCFUNC FAR got_cbreak(void);
|
||||||
@ -253,6 +255,7 @@ extern struct dhdr DOSTEXTFAR ASM blk_dev; /* Block device (Disk) driver
|
|||||||
|
|
||||||
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
extern struct buffer FAR *DOSFAR firstAvailableBuf; /* first 'available' buffer */
|
||||||
extern struct lol ASM FAR DATASTART;
|
extern struct lol ASM FAR DATASTART;
|
||||||
|
extern intvec ASM FAR SAVEDIVLST;
|
||||||
|
|
||||||
extern BYTE DOSFAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
extern BYTE DOSFAR ASM _HMATextAvailable, /* first byte of available CODE area */
|
||||||
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
FAR ASM _HMATextStart[], /* first byte of HMAable CODE area */
|
||||||
|
26
kernel/prf.c
26
kernel/prf.c
@ -123,17 +123,17 @@ void put_console(int c)
|
|||||||
|
|
||||||
#ifndef FORSYS
|
#ifndef FORSYS
|
||||||
/* copied from bcc (Bruce's C compiler) stdarg.h */
|
/* copied from bcc (Bruce's C compiler) stdarg.h */
|
||||||
typedef char *va_list;
|
typedef char FAR *va_list;
|
||||||
#define va_start(arg, last) ((arg) = (char *) (&(last)+1))
|
#define va_start(arg, last) ((arg) = (va_list) (&(last)+1))
|
||||||
#define va_arg(arg, type) (((type *)(arg+=sizeof(type)))[-1])
|
#define va_arg(arg, type) (((type FAR *)(arg+=sizeof(type)))[-1])
|
||||||
#define va_end(arg)
|
#define va_end(arg)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static BYTE *charp = 0;
|
static BYTE FAR *charp = 0;
|
||||||
|
|
||||||
STATIC VOID handle_char(COUNT);
|
STATIC VOID handle_char(COUNT);
|
||||||
STATIC void do_printf(const char *, REG va_list);
|
STATIC void do_printf(const char FAR *, va_list);
|
||||||
VOID VA_CDECL printf(const char * fmt, ...);
|
VOID VA_CDECL printf(const char FAR * fmt, ...);
|
||||||
|
|
||||||
/* special handler to switch between sprintf and printf */
|
/* special handler to switch between sprintf and printf */
|
||||||
STATIC VOID handle_char(COUNT c)
|
STATIC VOID handle_char(COUNT c)
|
||||||
@ -150,7 +150,7 @@ STATIC VOID handle_char(COUNT c)
|
|||||||
#define LONGARG 4
|
#define LONGARG 4
|
||||||
|
|
||||||
/* printf -- short version of printf to conserve space */
|
/* printf -- short version of printf to conserve space */
|
||||||
VOID VA_CDECL printf(const char *fmt, ...)
|
VOID VA_CDECL printf(CONST BYTE FAR *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list arg;
|
va_list arg;
|
||||||
va_start(arg, fmt);
|
va_start(arg, fmt);
|
||||||
@ -158,7 +158,7 @@ VOID VA_CDECL printf(const char *fmt, ...)
|
|||||||
do_printf(fmt, arg);
|
do_printf(fmt, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID VA_CDECL sprintf(char * buff, const char * fmt, ...)
|
VOID VA_CDECL sprintf(char FAR * buff, CONST BYTE FAR * fmt, ...)
|
||||||
{
|
{
|
||||||
va_list arg;
|
va_list arg;
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ VOID VA_CDECL sprintf(char * buff, const char * fmt, ...)
|
|||||||
handle_char('\0');
|
handle_char('\0');
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
STATIC void do_printf(CONST BYTE FAR * fmt, va_list arg)
|
||||||
{
|
{
|
||||||
int base, size;
|
int base, size;
|
||||||
char s[13]; /* long enough for a 32-bit octal number string with sign */
|
char s[13]; /* long enough for a 32-bit octal number string with sign */
|
||||||
@ -226,7 +226,7 @@ STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
|||||||
case 'p':
|
case 'p':
|
||||||
{
|
{
|
||||||
UWORD w0 = va_arg(arg, unsigned);
|
UWORD w0 = va_arg(arg, unsigned);
|
||||||
char *tmp = charp;
|
char FAR *tmp = charp;
|
||||||
sprintf(s, "%04x:%04x", va_arg(arg, unsigned), w0);
|
sprintf(s, "%04x:%04x", va_arg(arg, unsigned), w0);
|
||||||
p = s;
|
p = s;
|
||||||
charp = tmp;
|
charp = tmp;
|
||||||
@ -266,7 +266,7 @@ STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
|||||||
long n;
|
long n;
|
||||||
ULONG u;
|
ULONG u;
|
||||||
BOOL minus = FALSE;
|
BOOL minus = FALSE;
|
||||||
BYTE *t = s + sizeof(s) - 1;
|
BYTE FAR *t = s + sizeof(s) - 1;
|
||||||
|
|
||||||
if (flags & LONGARG)
|
if (flags & LONGARG)
|
||||||
n = va_arg(arg, long);
|
n = va_arg(arg, long);
|
||||||
@ -329,7 +329,7 @@ STATIC void do_printf(CONST BYTE * fmt, va_list arg)
|
|||||||
#endif
|
#endif
|
||||||
#if !defined(FORSYS) && !defined(_INIT)
|
#if !defined(FORSYS) && !defined(_INIT)
|
||||||
|
|
||||||
extern void put_string(const char *);
|
extern void put_string(const char FAR *);
|
||||||
extern void put_unsigned(unsigned, int, int);
|
extern void put_unsigned(unsigned, int, int);
|
||||||
|
|
||||||
void hexd(char *title, UBYTE FAR * p, COUNT numBytes)
|
void hexd(char *title, UBYTE FAR * p, COUNT numBytes)
|
||||||
@ -370,7 +370,7 @@ void put_unsigned(unsigned n, int base, int width)
|
|||||||
put_string(s);
|
put_string(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void put_string(const char *s)
|
void put_string(const char FAR *s)
|
||||||
{
|
{
|
||||||
while(*s != '\0')
|
while(*s != '\0')
|
||||||
put_console(*s++);
|
put_console(*s++);
|
||||||
|
@ -296,8 +296,8 @@ UWORD ASMCFUNC syscall_MUX14(DIRECT_IREGS);
|
|||||||
|
|
||||||
/* prf.c */
|
/* prf.c */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
VOID VA_CDECL printf(const char * fmt, ...);
|
VOID VA_CDECL printf(const char FAR* fmt, ...);
|
||||||
VOID VA_CDECL sprintf(char * buff, const char * fmt, ...);
|
VOID VA_CDECL sprintf(char FAR * buff, const char FAR* fmt, ...);
|
||||||
#endif
|
#endif
|
||||||
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
|
VOID hexd(char *title, VOID FAR * p, COUNT numBytes);
|
||||||
void put_unsigned(unsigned n, int base, int width);
|
void put_unsigned(unsigned n, int base, int width);
|
||||||
|
@ -32,6 +32,7 @@ MATH_INSERT =+i4m
|
|||||||
# -ze enable extensions (i.e., near, far, export, etc.)
|
# -ze enable extensions (i.e., near, far, export, etc.)
|
||||||
# -zl remove default library information
|
# -zl remove default library information
|
||||||
# -zp=<num> pack structure members with alignment {1,2,4,8,16}
|
# -zp=<num> pack structure members with alignment {1,2,4,8,16}
|
||||||
|
# -zu SS!=DGROUP
|
||||||
#
|
#
|
||||||
# -3 optimization for 386 - given in $(CPUOPT)
|
# -3 optimization for 386 - given in $(CPUOPT)
|
||||||
# -g=<id> set code group name
|
# -g=<id> set code group name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user