Hi Peter Anvin
I tried to use open file and read file SYSLINUX API. But it always make my
PC104 freeze. My snip code :
===============================================int __start(void)
{
int ax,cx,dx,es,si,di,t;
com32sys_t inreg,outreg;
memset(&inreg, 0, sizeof inreg);
memset(&outreg, 0, sizeof outreg);
strcopy(__com32.cs_bounce, "test.txt");
inreg.eax.w[0] = 0x0006; // Open file
inreg.esi.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, &outreg);
si = outreg.esi.w[0];
cx = outreg.ecx.w[0];
ax = outreg.eax.w[0];
if ((ax % cx) == 0)
t = ax / cx;
else
t = (ax / cx) + 1;
memset(&inreg, 0, sizeof inreg);
inreg.esi.w[0] = si;
inreg.ecx.w[0] = t;
inreg.eax.w[0] = 0x0007; // Read file
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, NULL);
memset(&inreg, 0, sizeof inreg);
inreg.eax.w[0] = 0x0002; // Write content of file to console
inreg.ebx.w[0] = OFFS(__com32.cs_bounce);
inreg.es = SEG(__com32.cs_bounce);
__com32.cs_intcall(0x22, &inreg, NULL);
memset(&inreg, 0, sizeof inreg);
inreg.eax.w[0] = 0x000C; // Clean up
inreg.edx.w[0] = 0x0000;
__com32.cs_intcall(0x22, &inreg, NULL);
..........................
========================================Please tell me where is the error in my
codes.
Thanks very much
Phung Chi Kien
Automation Institute
Hanoi
Vietnam
H. Peter Anvin
2003-Sep-15 06:00 UTC
[syslinux] Re: Can not use read file SYSLINUX API call
Phung Chi Kien wrote:> Hi Peter Anvin > I tried to use open file and read file SYSLINUX API. But it always make my > PC104 freeze. My snip code : >Can you please include the whole file, so that it can be compiled? -hpa
H. Peter Anvin
2003-Sep-15 06:02 UTC
[syslinux] Re: Can not use read file SYSLINUX API call
Phung Chi Kien wrote:> > memset(&inreg, 0, sizeof inreg); > inreg.eax.w[0] = 0x000C; // Clean up > inreg.edx.w[0] = 0x0000; > __com32.cs_intcall(0x22, &inreg, NULL); >Your invoking CLEAN UP here seems rather suspicious. CLEAN UP means that you're taking over full control of the boot process from this point on. Have you tried simply returning? -hpa