[syslinux] Com32 error?
G. Murali Krishnan
gmkrishn at cs.uchicago.edu
Mon Nov 18 13:13:55 PST 2002
I presume that bounce_ptr is a pointer to a buffer I can use as I please.
If copy the string over to bounce_ptr and then call INT22, I still get the
"." in the output. Now it doesn't print the ":ello, World!" at all. Here
is the code if you are interested.
I am using syslinux-2.00, not the prerelease versions.
#include <com32.h>
#define NULL ((void *)0)
#define SEGMENT(ptr) ((unsigned int)((long)(ptr) >> 16))
#define OFFSET(ptr) ((unsigned int)(((long)(ptr)) & 0xFFFF))
static inline void memset(void *buf, int ch, unsigned int len)
{
asm volatile("cld; rep; stosb"
: "+D" (buf), "+c" (len) : "a" (ch) : "memory");
}
void strcopy(char *dest, char *src)
{
char *tmp=src;
while (*tmp) (*dest++=*tmp++);
*dest=0x0;
}
int _start(unsigned int nargs, char *cmdline,
void (*syscall)(unsigned char, com32sys_t *, com32sys_t *),
void *bounce_ptr, unsigned int bounce_len)
{
char *msg = "Hello, World!\r\n";
com32sys_t inreg, outreg;
const char *p;
strcopy(bounce_ptr,msg);
memset(&inreg, 0, sizeof inreg);
inreg.eax.w[0]=0x02;
inreg.es =SEGMENT(bounce_ptr);
inreg.ebx.w[0]= OFFSET(bounce_ptr);
syscall(0x22,&inreg,NULL);
memset(&inreg,0,sizeof inreg);
msg[0]=':';
for ( p = msg ; *p ; p++ ) {
inreg.edx.b[0] = *p;
inreg.eax.b[1] = 0x02; /* Write Character */
syscall(0x21, &inreg, NULL);
}
return 0;
}
- Murali
On Mon, 18 Nov 2002, H. Peter Anvin wrote:
> G. Murali Krishnan wrote:
> > Well I tried my first COM32 program, which is supposed to print
> > "Hello, World" and then ":ello, World" in the next line.
> > It prints the second line alright, but prints a "." instead of the
> > first line.
>
> The "." comes from SYSLINUX... it's just a loading symbol.
>
> > I am using INT 22h for the first print and INT 21h (as in the sample
> > code) for the second line. Here is the code itself. It is based on the
> > sample code. Any pointers on whats wrong? Is there any place, where one
> > can see more sample COM32 code?
>
> Not at this time. I'm working on a newlib (libc) port for COM32, until
> I have had time to finish that COM32 is a bit of an experimental feature.
>
> > inreg.es =SEGMENT(msg);
> > inreg.ebx.w[0]= OFFSET(msg); /* Pointer to msg */
>
> You can't do this -- you need to copy "msg" down into the low memory
> bounce buffer.
>
> -hpa
>
>
> _______________________________________________
> SYSLINUX mailing list
> Submissions to SYSLINUX at zytor.com
> Unsubscribe or set options at:
> http://www.zytor.com/mailman/listinfo/syslinux
> Please do not send private replies to mailing list traffic.
>
################################################################
# Ry 254, Ryerson Hall, # Ph : +1 773 702-1031 (Off) #
# 1100 E 58th Street # +1 773 575-4836 (Cell) #
# Chicago, IL - 60637, # URL : http://www.g-murali.com #
# USA. # email: gmkrishn at cs.uchicago.edu #
################################################################
More information about the Syslinux
mailing list