diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2005-08-16 18:05:35 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2005-08-16 18:05:35 +0000 |
commit | e448b01f6b5b69ee7eefa74f0be5176d92a78aac (patch) | |
tree | 3a660c4e2bd6ec9cdecf22569832330075cef3ba /libgloss | |
parent | e357cc59114686b69ae9a8714bdc823a0901b8e4 (diff) | |
download | newlib-e448b01f6b5b69ee7eefa74f0be5176d92a78aac.zip newlib-e448b01f6b5b69ee7eefa74f0be5176d92a78aac.tar.gz newlib-e448b01f6b5b69ee7eefa74f0be5176d92a78aac.tar.bz2 |
2005-08-16 Shaun Jackman <sjackman@gmail.com>
* arm/syscalls.c (initialise_monitor_handles): Set
monitor_stderr to the result of SWI_open(":tt", "a")
instead of simply duplicating stdout.
Diffstat (limited to 'libgloss')
-rw-r--r-- | libgloss/ChangeLog | 6 | ||||
-rw-r--r-- | libgloss/arm/syscalls.c | 28 |
2 files changed, 32 insertions, 2 deletions
diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index f129ae4..2fc5503 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,9 @@ +2005-08-16 Shaun Jackman <sjackman@gmail.com> + + * arm/syscalls.c (initialise_monitor_handles): Set + monitor_stderr to the result of SWI_open(":tt", "a") + instead of simply duplicating stdout. + 2005-08-10 DJ Delorie <dj@redhat.com> * configure.in: Add m32c support. diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index a4f24c6..2701bb8 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -133,6 +133,16 @@ initialise_monitor_handles (void) { int i; + /* Open the standard file descriptors by opening the special + * teletype device, ":tt", read-only to obtain a descritpor for + * standard input and write-only to obtain a descriptor for standard + * output. Finally, open ":tt" in append mode to obtain a descriptor + * for standard error. Since this is a write mode, most kernels will + * probably return the same value as for standard output, but the + * kernel can differentiate the two using the mode flag and return a + * different descriptor for standard error. + */ + #ifdef ARM_RDI_MONITOR int volatile block[3]; @@ -144,7 +154,12 @@ initialise_monitor_handles (void) block[0] = (int) ":tt"; block[2] = 3; /* length of filename */ block[1] = 4; /* mode "w" */ - monitor_stdout = monitor_stderr = do_AngelSWI (AngelSWI_Reason_Open, (void *) block); + monitor_stdout = do_AngelSWI (AngelSWI_Reason_Open, (void *) block); + + block[0] = (int) ":tt"; + block[2] = 3; /* length of filename */ + block[1] = 8; /* mode "a" */ + monitor_stderr = do_AngelSWI (AngelSWI_Reason_Open, (void *) block); #else int fh; const char * name; @@ -161,7 +176,14 @@ initialise_monitor_handles (void) : "=r"(fh) : "i" (SWI_Open),"r"(name) : "r0","r1"); - monitor_stdout = monitor_stderr = fh; + monitor_stdout = fh; + + name = ":tt"; + asm ("mov r0,%2; mov r1, #8; swi %a1; mov %0, r0" + : "=r"(fh) + : "i" (SWI_Open),"r"(name) + : "r0","r1"); + monitor_stderr = fh; #endif for (i = 0; i < MAX_OPEN_FILES; i ++) @@ -171,6 +193,8 @@ initialise_monitor_handles (void) openfiles[0].pos = 0; openfiles[1].handle = monitor_stdout; openfiles[1].pos = 0; + openfiles[2].handle = monitor_stderr; + openfiles[2].pos = 0; } static int |