Add memcmp(), clean up bochsrc.txt

This commit is contained in:
2025-12-11 00:53:29 +01:00
parent 6feea1444a
commit 172859831d
3 changed files with 21 additions and 0 deletions

View File

@ -60,3 +60,16 @@ usize_t strlen(const char *str) {
for (s = str; *s; ++s);
return (s - str);
}
int memcmp(const void *s1, const void *s2, usize_t n) {
unsigned char *p = (unsigned char *)s1;
unsigned char *q = (unsigned char *)s2;
while (n--) {
if (*p != *q) {
return (int)*p - (int)*q;
}
p++, q++;
}
return 0;
}

View File

@ -36,6 +36,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
usize_t memset(void *dst, byte_t b, usize_t n);
usize_t memcpy(void *dst, const void *src, usize_t n);
int memcmp(const void *s1, const void *s2, usize_t n);
void strncpy(char* dst, const char* src, usize_t n);
usize_t strlen(const char *str);

View File

@ -1,22 +1,28 @@
# machine
megs: 64
cpu: model=pentium
# roms
romimage: file=/usr/share/bochs/BIOS-bochs-latest, options=fastboot
vgaromimage: file=/usr/share/bochs/VGABIOS-lgpl-latest.bin
# device config
ata0: enabled=1
ata0-master: type=cdrom, path=out/i386_pc/mop3.iso, status=inserted
com1: enabled=1, mode=file, dev=bochs-com1.log
# clock
clock: sync=realtime
# boot device
boot: cdrom
# logging
error: action=report
panic: action=report
info: action=report
debug: action=ignore
log: bochs.log
# display
display_library: x